* [Devel] [PATCH hci-8.1 v2 1/7] ms/selftests/bpf: Upon failures, exit with code 1 in test_xsk.sh
2026-10-27 15:51 [Devel] [PATCH hci-8.1 v2 0/7] selftests: fix sticky failure in runners Eva Kurchatova
@ 2026-10-27 15:51 ` Eva Kurchatova
2026-10-27 15:55 ` no-reply
2026-10-27 15:51 ` [Devel] [PATCH hci-8.1 v2 2/7] selftests/memfd: fail run_hugetlbfs_test.sh when a test fails Eva Kurchatova
` (5 subsequent siblings)
6 siblings, 1 reply; 15+ messages in thread
From: Eva Kurchatova @ 2026-10-27 15:51 UTC (permalink / raw)
To: khorenko; +Cc: devel
Currently, even if some subtests fails, the end result will still yield
"ok 1 selftests: bpf: test_xsk.sh". Fix it by exiting with 1 if there are
any failures.
Signed-off-by: Ricardo B. Marlière <rbm@suse.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Magnus Karlsson <magnus.karlsson@intel.com>
Link: https://lore.kernel.org/bpf/20250828-selftests-bpf-test_xsk_ret-v1-1-e6656c01f397@suse.com
(cherry picked from commit 2a912258c90e895363c0ffc0be8a47f112ab67b7)
https://virtuozzo.atlassian.net/browse/VSTOR-134205
Feature: fix selftests
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
tools/testing/selftests/bpf/test_xsk.sh | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/testing/selftests/bpf/test_xsk.sh b/tools/testing/selftests/bpf/test_xsk.sh
index 65aafe0003db..62db060298a4 100755
--- a/tools/testing/selftests/bpf/test_xsk.sh
+++ b/tools/testing/selftests/bpf/test_xsk.sh
@@ -241,4 +241,6 @@ done
if [ $failures -eq 0 ]; then
echo "All tests successful!"
+else
+ exit 1
fi
--
2.56.0
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 15+ messages in thread* [Devel] [PATCH hci-8.1 v2 2/7] selftests/memfd: fail run_hugetlbfs_test.sh when a test fails
2026-10-27 15:51 [Devel] [PATCH hci-8.1 v2 0/7] selftests: fix sticky failure in runners Eva Kurchatova
2026-10-27 15:51 ` [Devel] [PATCH hci-8.1 v2 1/7] ms/selftests/bpf: Upon failures, exit with code 1 in test_xsk.sh Eva Kurchatova
@ 2026-10-27 15:51 ` Eva Kurchatova
2026-10-27 15:55 ` no-reply
2026-10-27 15:51 ` [Devel] [PATCH hci-8.1 v2 3/7] selftests: sigaltstack: report the failures the signal handler records Eva Kurchatova
` (4 subsequent siblings)
6 siblings, 1 reply; 15+ messages in thread
From: Eva Kurchatova @ 2026-10-27 15:51 UTC (permalink / raw)
To: khorenko; +Cc: devel
The script runs memfd_test and the fuse test on hugetlbfs, puts the
huge page count back and exits with the status of whatever ran last,
so a test that failed or aborted was reported as passed. The hugetlbfs
F_SEAL_EXEC bug went unnoticed that way until the abort was seen by eye.
Exit with a failure when either test did.
https://virtuozzo.atlassian.net/browse/VSTOR-134205
Feature: fix selftests
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
tools/testing/selftests/memfd/run_hugetlbfs_test.sh | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/memfd/run_hugetlbfs_test.sh b/tools/testing/selftests/memfd/run_hugetlbfs_test.sh
index fb633eeb0290..083bd72d9d41 100755
--- a/tools/testing/selftests/memfd/run_hugetlbfs_test.sh
+++ b/tools/testing/selftests/memfd/run_hugetlbfs_test.sh
@@ -57,8 +57,9 @@ fi
#
# Run the hugetlbfs test
#
-./memfd_test hugetlbfs
-./run_fuse_test.sh hugetlbfs
+ret=0
+./memfd_test hugetlbfs || ret=1
+./run_fuse_test.sh hugetlbfs || ret=1
#
# Give back any huge pages allocated for the test
@@ -66,3 +67,5 @@ fi
if [ -n "$nr_hugepgs" ]; then
echo $nr_hugepgs > /proc/sys/vm/nr_hugepages
fi
+
+exit $ret
--
2.56.0
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 15+ messages in thread* [Devel] [PATCH hci-8.1 v2 3/7] selftests: sigaltstack: report the failures the signal handler records
2026-10-27 15:51 [Devel] [PATCH hci-8.1 v2 0/7] selftests: fix sticky failure in runners Eva Kurchatova
2026-10-27 15:51 ` [Devel] [PATCH hci-8.1 v2 1/7] ms/selftests/bpf: Upon failures, exit with code 1 in test_xsk.sh Eva Kurchatova
2026-10-27 15:51 ` [Devel] [PATCH hci-8.1 v2 2/7] selftests/memfd: fail run_hugetlbfs_test.sh when a test fails Eva Kurchatova
@ 2026-10-27 15:51 ` Eva Kurchatova
2026-10-27 15:56 ` no-reply
2026-10-27 15:51 ` [Devel] [PATCH hci-8.1 v2 4/7] selftests/zram: fail when a step fails Eva Kurchatova
` (3 subsequent siblings)
6 siblings, 1 reply; 15+ messages in thread
From: Eva Kurchatova @ 2026-10-27 15:51 UTC (permalink / raw)
To: khorenko; +Cc: devel
The handler records a failed check with ksft_test_result_fail() and
the test goes on, then ends with ksft_exit_pass() whatever was
recorded, so a failed check was reported as a pass. End by the
recorded results.
https://virtuozzo.atlassian.net/browse/VSTOR-134205
Feature: fix selftests
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
tools/testing/selftests/sigaltstack/sas.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/tools/testing/selftests/sigaltstack/sas.c b/tools/testing/selftests/sigaltstack/sas.c
index 07227fab1cc9..758d8014cab1 100644
--- a/tools/testing/selftests/sigaltstack/sas.c
+++ b/tools/testing/selftests/sigaltstack/sas.c
@@ -192,6 +192,5 @@ int main(void)
ksft_test_result_pass(
"sigaltstack is still SS_AUTODISARM after signal\n");
- ksft_exit_pass();
- return 0;
+ ksft_finished();
}
--
2.56.0
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 15+ messages in thread* [Devel] [PATCH hci-8.1 v2 4/7] selftests/zram: fail when a step fails
2026-10-27 15:51 [Devel] [PATCH hci-8.1 v2 0/7] selftests: fix sticky failure in runners Eva Kurchatova
` (2 preceding siblings ...)
2026-10-27 15:51 ` [Devel] [PATCH hci-8.1 v2 3/7] selftests: sigaltstack: report the failures the signal handler records Eva Kurchatova
@ 2026-10-27 15:51 ` Eva Kurchatova
2026-10-27 15:57 ` no-reply
2026-10-27 15:51 ` [Devel] [PATCH hci-8.1 v2 5/7] ms/selftests/futex: futex_waitv wouldblock test should fail Eva Kurchatova
` (2 subsequent siblings)
6 siblings, 1 reply; 15+ messages in thread
From: Eva Kurchatova @ 2026-10-27 15:51 UTC (permalink / raw)
To: khorenko; +Cc: devel
The library prints FAIL for a step that fails and carries on, zram01
and zram02 print their verdict and exit 0 either way, and zram.sh
exits with the status of zram02 alone, so no zram failure reached the
runner. A step that reports FAIL now fails its test, and the suite
takes the worst result of its two tests, a failure over a skip over a
pass.
https://virtuozzo.atlassian.net/browse/VSTOR-134205
Feature: fix selftests
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
tools/testing/selftests/zram/zram.sh | 11 +++++++++--
tools/testing/selftests/zram/zram01.sh | 4 ++++
tools/testing/selftests/zram/zram02.sh | 1 +
tools/testing/selftests/zram/zram_lib.sh | 24 +++++++++++++++---------
4 files changed, 29 insertions(+), 11 deletions(-)
diff --git a/tools/testing/selftests/zram/zram.sh b/tools/testing/selftests/zram/zram.sh
index b0b91d9b0dc2..56adeb17768f 100755
--- a/tools/testing/selftests/zram/zram.sh
+++ b/tools/testing/selftests/zram/zram.sh
@@ -4,15 +4,22 @@ TCID="zram.sh"
. ./zram_lib.sh
+# A failure outranks a skip, a skip outranks a pass
+result () {
+ [ $1 -eq $ksft_skip ] && [ $ret -ne 0 ] || ret=$1
+}
+
run_zram () {
echo "--------------------"
echo "running zram tests"
echo "--------------------"
-./zram01.sh
+./zram01.sh || result $?
echo ""
-./zram02.sh
+./zram02.sh || result $?
}
check_prereqs
+ret=0
run_zram
+exit $ret
diff --git a/tools/testing/selftests/zram/zram01.sh b/tools/testing/selftests/zram/zram01.sh
index 8f4affe34f3e..8ab63c98c1af 100755
--- a/tools/testing/selftests/zram/zram01.sh
+++ b/tools/testing/selftests/zram/zram01.sh
@@ -33,6 +33,9 @@ zram_algs="lzo"
zram_fill_fs()
{
+ # An earlier step failed, and after a failed mount the directory
+ # would be filled on the host's filesystem
+ [ $ERR_CODE -ne 0 ] && return
for i in $(seq $dev_start $dev_end); do
echo "fill zram$i..."
local b=0
@@ -70,6 +73,7 @@ zram_cleanup
if [ $ERR_CODE -ne 0 ]; then
echo "$TCID : [FAIL]"
+ exit 1
else
echo "$TCID : [PASS]"
fi
diff --git a/tools/testing/selftests/zram/zram02.sh b/tools/testing/selftests/zram/zram02.sh
index 2418b0c4ed13..54e17bbfdbb7 100755
--- a/tools/testing/selftests/zram/zram02.sh
+++ b/tools/testing/selftests/zram/zram02.sh
@@ -39,6 +39,7 @@ zram_cleanup
if [ $ERR_CODE -ne 0 ]; then
echo "$TCID : [FAIL]"
+ exit 1
else
echo "$TCID : [PASS]"
fi
diff --git a/tools/testing/selftests/zram/zram_lib.sh b/tools/testing/selftests/zram/zram_lib.sh
index 21ec1966de76..25e32cb956df 100755
--- a/tools/testing/selftests/zram/zram_lib.sh
+++ b/tools/testing/selftests/zram/zram_lib.sh
@@ -131,12 +131,14 @@ zram_max_streams()
for max_s in $zram_max_streams; do
local sys_path="/sys/block/zram${i}/max_comp_streams"
echo $max_s > $sys_path || \
- echo "FAIL failed to set '$max_s' to $sys_path"
+ { echo "FAIL failed to set '$max_s' to $sys_path"; ERR_CODE=-1; }
sleep 1
local max_streams=$(cat $sys_path)
- [ "$max_s" -ne "$max_streams" ] && \
- echo "FAIL can't set max_streams '$max_s', get $max_stream"
+ if [ "$max_s" -ne "$max_streams" ]; then
+ echo "FAIL can't set max_streams '$max_s', get $max_streams"
+ ERR_CODE=-1
+ fi
i=$(($i + 1))
echo "$sys_path = '$max_streams'"
@@ -156,7 +158,7 @@ zram_compress_alg()
for alg in $zram_algs; do
local sys_path="/sys/block/zram${i}/comp_algorithm"
echo "$alg" > $sys_path || \
- echo "FAIL can't set '$alg' to $sys_path"
+ { echo "FAIL can't set '$alg' to $sys_path"; ERR_CODE=-1; }
i=$(($i + 1))
echo "$sys_path = '$alg'"
done
@@ -171,7 +173,7 @@ zram_set_disksizes()
for ds in $zram_sizes; do
local sys_path="/sys/block/zram${i}/disksize"
echo "$ds" > $sys_path || \
- echo "FAIL can't set '$ds' to $sys_path"
+ { echo "FAIL can't set '$ds' to $sys_path"; ERR_CODE=-1; }
i=$(($i + 1))
echo "$sys_path = '$ds'"
@@ -188,7 +190,7 @@ zram_set_memlimit()
for ds in $zram_mem_limits; do
local sys_path="/sys/block/zram${i}/mem_limit"
echo "$ds" > $sys_path || \
- echo "FAIL can't set '$ds' to $sys_path"
+ { echo "FAIL can't set '$ds' to $sys_path"; ERR_CODE=-1; }
i=$(($i + 1))
echo "$sys_path = '$ds'"
@@ -205,13 +207,15 @@ zram_makeswap()
mkswap /dev/zram$i > err.log 2>&1
if [ $? -ne 0 ]; then
cat err.log
- echo "FAIL mkswap /dev/zram$1 failed"
+ echo "FAIL mkswap /dev/zram$i failed"
+ ERR_CODE=-1
fi
swapon /dev/zram$i > err.log 2>&1
if [ $? -ne 0 ]; then
cat err.log
- echo "FAIL swapon /dev/zram$1 failed"
+ echo "FAIL swapon /dev/zram$i failed"
+ ERR_CODE=-1
fi
echo "done with /dev/zram$i"
@@ -229,6 +233,7 @@ zram_swapoff()
if [ $? -ne 0 ]; then
cat err.log
echo "FAIL swapoff /dev/zram$i failed"
+ ERR_CODE=-1
fi
done
dev_makeswap=-1
@@ -248,6 +253,7 @@ zram_makefs()
if [ $? -ne 0 ]; then
cat err.log
echo "FAIL failed to make $fs on /dev/zram$i"
+ ERR_CODE=-1
fi
i=$(($i + 1))
echo "zram mkfs.$fs: OK"
@@ -261,7 +267,7 @@ zram_mount()
echo "mount /dev/zram$i"
mkdir zram$i
mount /dev/zram$i zram$i > /dev/null || \
- echo "FAIL mount /dev/zram$i failed"
+ { echo "FAIL mount /dev/zram$i failed"; ERR_CODE=-1; }
dev_mounted=$i
done
--
2.56.0
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 15+ messages in thread* Re: [Devel] [PATCH hci-8.1 v2 4/7] selftests/zram: fail when a step fails
2026-10-27 15:51 ` [Devel] [PATCH hci-8.1 v2 4/7] selftests/zram: fail when a step fails Eva Kurchatova
@ 2026-10-27 15:57 ` no-reply
0 siblings, 0 replies; 15+ messages in thread
From: no-reply @ 2026-10-27 15:57 UTC (permalink / raw)
To: Eva Kurchatova, khorenko; +Cc: devel
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] selftests/zram: unsupported lzo or missing mkfs now fails instead of skipping
--
commit 59f3632881739f08c8d19cb91d8f89fa150024b0
Author: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
selftests/zram: fail when a step fails
This commit makes zram_lib.sh set ERR_CODE when a step prints FAIL. zram01.sh
and zram02.sh now exit 1 on failure. zram.sh now exits with the worst result
of the two tests: a failure over a skip over a pass.
Link: https://virtuozzo.atlassian.net/browse/VSTOR-134205
> diff --git a/tools/testing/selftests/zram/zram01.sh b/tools/testing/selftests/zram/zram01.sh
> --- a/tools/testing/selftests/zram/zram01.sh
> +++ b/tools/testing/selftests/zram/zram01.sh
[ ... ]
> @@ -70,6 +73,7 @@ zram_cleanup
>
> if [ $ERR_CODE -ne 0 ]; then
> echo "$TCID : [FAIL]"
> + exit 1
> else
> echo "$TCID : [PASS]"
> fi
[Severity: Low]
This isn't a bug, but is it intended that this exit 1 also covers failures
caused by a missing capability?
Before this patch the FAIL lines in zram_lib.sh were only printed and the
test still passed. After this patch, a missing capability makes zram01.sh
exit 1, and zram.sh then exits non-zero. The two cases below are examples.
The first is zram_compress_alg(). zram01.sh hard-codes zram_algs="lzo":
> diff --git a/tools/testing/selftests/zram/zram_lib.sh b/tools/testing/selftests/zram/zram_lib.sh
> --- a/tools/testing/selftests/zram/zram_lib.sh
> +++ b/tools/testing/selftests/zram/zram_lib.sh
[ ... ]
> @@ -156,7 +158,7 @@ zram_compress_alg()
> for alg in $zram_algs; do
> local sys_path="/sys/block/zram${i}/comp_algorithm"
> echo "$alg" > $sys_path || \
> - echo "FAIL can't set '$alg' to $sys_path"
> + { echo "FAIL can't set '$alg' to $sys_path"; ERR_CODE=-1; }
If the running kernel does not provide lzo, this write fails and the test
now reports FAIL.
Would a skip (ksft_skip, exit 4) fit better here than a failure?
The second is zram_makefs(), which falls back to ext2 when mkfs.$fs is
not found:
> @@ -248,6 +253,7 @@ zram_makefs()
> if [ $? -ne 0 ]; then
> cat err.log
> echo "FAIL failed to make $fs on /dev/zram$i"
> + ERR_CODE=-1
> fi
On a host with neither mkfs.ext4 nor mkfs.ext2, the mkfs command fails and
the test now fails.
Should this case skip rather than fail?
The only ksft_skip exits I found are in check_prereqs() (not root) and
zram_load() (module or zram-control problems). Nothing skips for an
unsupported algorithm or a missing mkfs tool.
The commit message says only that "A step that reports FAIL now fails its
test". It does not say that missing capabilities should now fail rather
than skip.
The commit message also does not mention the incidental typo fixes in
zram_lib.sh: $1 changed to $i in the mkswap and swapon messages, and
$max_stream changed to $max_streams in zram_max_streams().
--
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261027155236.1226178-1-eva.kurchatova@virtuozzo.com?part=4
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Devel] [PATCH hci-8.1 v2 5/7] ms/selftests/futex: futex_waitv wouldblock test should fail
2026-10-27 15:51 [Devel] [PATCH hci-8.1 v2 0/7] selftests: fix sticky failure in runners Eva Kurchatova
` (3 preceding siblings ...)
2026-10-27 15:51 ` [Devel] [PATCH hci-8.1 v2 4/7] selftests/zram: fail when a step fails Eva Kurchatova
@ 2026-10-27 15:51 ` Eva Kurchatova
2026-10-27 15:56 ` no-reply
2026-10-27 15:51 ` [Devel] [PATCH hci-8.1 v2 6/7] selftests/futex: fail run.sh when a test fails Eva Kurchatova
2026-10-27 15:51 ` [Devel] [PATCH hci-8.1 v2 7/7] selftests/futex: fail futex_waitv when the waiter failed Eva Kurchatova
6 siblings, 1 reply; 15+ messages in thread
From: Eva Kurchatova @ 2026-10-27 15:51 UTC (permalink / raw)
To: khorenko; +Cc: devel
From: Edward Liaw <edliaw@google.com>
Testcase should fail if -EWOULDBLOCK is not returned when expected value
differs from actual value from the waiter.
Link: https://lore.kernel.org/r/20250404221225.1596324-1-edliaw@google.com
Fixes: 9d57f7c79748920636f8293d2f01192d702fe390 ("selftests: futex: Test sys_futex_waitv() wouldblock")
Signed-off-by: Edward Liaw <edliaw@google.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: André Almeida <andrealmeid@igalia.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
(cherry picked from commit 7d50e00fef2832e98d7e06bbfc85c1d66ee110ca)
https://virtuozzo.atlassian.net/browse/VSTOR-134205
Feature: fix selftests
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
.../testing/selftests/futex/functional/futex_wait_wouldblock.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/futex/functional/futex_wait_wouldblock.c b/tools/testing/selftests/futex/functional/futex_wait_wouldblock.c
index 7d7a6a06cdb7..2d8230da9064 100644
--- a/tools/testing/selftests/futex/functional/futex_wait_wouldblock.c
+++ b/tools/testing/selftests/futex/functional/futex_wait_wouldblock.c
@@ -98,7 +98,7 @@ int main(int argc, char *argv[])
info("Calling futex_waitv on f1: %u @ %p with val=%u\n", f1, &f1, f1+1);
res = futex_waitv(&waitv, 1, 0, &to, CLOCK_MONOTONIC);
if (!res || errno != EWOULDBLOCK) {
- ksft_test_result_pass("futex_waitv returned: %d %s\n",
+ ksft_test_result_fail("futex_waitv returned: %d %s\n",
res ? errno : res,
res ? strerror(errno) : "");
ret = RET_FAIL;
--
2.56.0
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 15+ messages in thread* [Devel] [PATCH hci-8.1 v2 6/7] selftests/futex: fail run.sh when a test fails
2026-10-27 15:51 [Devel] [PATCH hci-8.1 v2 0/7] selftests: fix sticky failure in runners Eva Kurchatova
` (4 preceding siblings ...)
2026-10-27 15:51 ` [Devel] [PATCH hci-8.1 v2 5/7] ms/selftests/futex: futex_waitv wouldblock test should fail Eva Kurchatova
@ 2026-10-27 15:51 ` Eva Kurchatova
2026-10-27 15:58 ` no-reply
2026-10-27 15:51 ` [Devel] [PATCH hci-8.1 v2 7/7] selftests/futex: fail futex_waitv when the waiter failed Eva Kurchatova
6 siblings, 1 reply; 15+ messages in thread
From: Eva Kurchatova @ 2026-10-27 15:51 UTC (permalink / raw)
To: khorenko; +Cc: devel
run.sh runs the tests one after the other and exits with the status of
the last one, so a failure in any other was reported as a pass. Exit
with a failure when any test did.
https://virtuozzo.atlassian.net/browse/VSTOR-134205
Feature: fix selftests
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
.../testing/selftests/futex/functional/run.sh | 66 ++++++++++---------
1 file changed, 35 insertions(+), 31 deletions(-)
diff --git a/tools/testing/selftests/futex/functional/run.sh b/tools/testing/selftests/futex/functional/run.sh
index 5470088dc4df..39e71d91bebf 100755
--- a/tools/testing/selftests/futex/functional/run.sh
+++ b/tools/testing/selftests/futex/functional/run.sh
@@ -30,61 +30,65 @@ if [ "$USE_COLOR" -eq 1 ]; then
COLOR="-c"
fi
+ret=0
+
echo
# requeue pi testing
# without timeouts
-./futex_requeue_pi $COLOR
-./futex_requeue_pi $COLOR -b
-./futex_requeue_pi $COLOR -b -l
-./futex_requeue_pi $COLOR -b -o
-./futex_requeue_pi $COLOR -l
-./futex_requeue_pi $COLOR -o
+./futex_requeue_pi $COLOR || ret=1
+./futex_requeue_pi $COLOR -b || ret=1
+./futex_requeue_pi $COLOR -b -l || ret=1
+./futex_requeue_pi $COLOR -b -o || ret=1
+./futex_requeue_pi $COLOR -l || ret=1
+./futex_requeue_pi $COLOR -o || ret=1
# with timeouts
-./futex_requeue_pi $COLOR -b -l -t 5000
-./futex_requeue_pi $COLOR -l -t 5000
-./futex_requeue_pi $COLOR -b -l -t 500000
-./futex_requeue_pi $COLOR -l -t 500000
-./futex_requeue_pi $COLOR -b -t 5000
-./futex_requeue_pi $COLOR -t 5000
-./futex_requeue_pi $COLOR -b -t 500000
-./futex_requeue_pi $COLOR -t 500000
-./futex_requeue_pi $COLOR -b -o -t 5000
-./futex_requeue_pi $COLOR -l -t 5000
-./futex_requeue_pi $COLOR -b -o -t 500000
-./futex_requeue_pi $COLOR -l -t 500000
+./futex_requeue_pi $COLOR -b -l -t 5000 || ret=1
+./futex_requeue_pi $COLOR -l -t 5000 || ret=1
+./futex_requeue_pi $COLOR -b -l -t 500000 || ret=1
+./futex_requeue_pi $COLOR -l -t 500000 || ret=1
+./futex_requeue_pi $COLOR -b -t 5000 || ret=1
+./futex_requeue_pi $COLOR -t 5000 || ret=1
+./futex_requeue_pi $COLOR -b -t 500000 || ret=1
+./futex_requeue_pi $COLOR -t 500000 || ret=1
+./futex_requeue_pi $COLOR -b -o -t 5000 || ret=1
+./futex_requeue_pi $COLOR -l -t 5000 || ret=1
+./futex_requeue_pi $COLOR -b -o -t 500000 || ret=1
+./futex_requeue_pi $COLOR -l -t 500000 || ret=1
# with long timeout
-./futex_requeue_pi $COLOR -b -l -t 2000000000
-./futex_requeue_pi $COLOR -l -t 2000000000
+./futex_requeue_pi $COLOR -b -l -t 2000000000 || ret=1
+./futex_requeue_pi $COLOR -l -t 2000000000 || ret=1
echo
-./futex_requeue_pi_mismatched_ops $COLOR
+./futex_requeue_pi_mismatched_ops $COLOR || ret=1
echo
-./futex_requeue_pi_signal_restart $COLOR
+./futex_requeue_pi_signal_restart $COLOR || ret=1
echo
-./futex_wait_timeout $COLOR
+./futex_wait_timeout $COLOR || ret=1
echo
-./futex_wait_wouldblock $COLOR
+./futex_wait_wouldblock $COLOR || ret=1
echo
-./futex_wait_uninitialized_heap $COLOR
-./futex_wait_private_mapped_file $COLOR
+./futex_wait_uninitialized_heap $COLOR || ret=1
+./futex_wait_private_mapped_file $COLOR || ret=1
echo
-./futex_wait $COLOR
+./futex_wait $COLOR || ret=1
echo
-./futex_requeue $COLOR
+./futex_requeue $COLOR || ret=1
echo
-./futex_waitv $COLOR
+./futex_waitv $COLOR || ret=1
echo
-./futex_priv_hash $COLOR
+./futex_priv_hash $COLOR || ret=1
echo
-./futex_numa_mpol $COLOR
+./futex_numa_mpol $COLOR || ret=1
+
+exit $ret
--
2.56.0
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 15+ messages in thread* [Devel] [PATCH hci-8.1 v2 7/7] selftests/futex: fail futex_waitv when the waiter failed
2026-10-27 15:51 [Devel] [PATCH hci-8.1 v2 0/7] selftests: fix sticky failure in runners Eva Kurchatova
` (5 preceding siblings ...)
2026-10-27 15:51 ` [Devel] [PATCH hci-8.1 v2 6/7] selftests/futex: fail run.sh when a test fails Eva Kurchatova
@ 2026-10-27 15:51 ` Eva Kurchatova
2026-10-27 15:58 ` no-reply
6 siblings, 1 reply; 15+ messages in thread
From: Eva Kurchatova @ 2026-10-27 15:51 UTC (permalink / raw)
To: khorenko; +Cc: devel
The waiter thread records a failed futex_waitv() with
ksft_test_result_fail(), while the main thread reports the same
subtest as passed and exits with the status it collected, so a waiter
that returned the wrong index or an error ended in a pass; and the
main thread never waited for the waiter, so its result could land
after the verdict. Have the waiter return its status instead, join it
after each wake and report one result for the subtest.
https://virtuozzo.atlassian.net/browse/VSTOR-134205
Feature: fix selftests
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
.../selftests/futex/functional/futex_waitv.c | 28 ++++++++++++++++---
1 file changed, 24 insertions(+), 4 deletions(-)
diff --git a/tools/testing/selftests/futex/functional/futex_waitv.c b/tools/testing/selftests/futex/functional/futex_waitv.c
index a94337f677e1..a9de197637ea 100644
--- a/tools/testing/selftests/futex/functional/futex_waitv.c
+++ b/tools/testing/selftests/futex/functional/futex_waitv.c
@@ -47,16 +47,28 @@ void *waiterfn(void *arg)
res = futex_waitv(waitv, NR_FUTEXES, 0, &to, CLOCK_MONOTONIC);
if (res < 0) {
- ksft_test_result_fail("futex_waitv returned: %d %s\n",
- errno, strerror(errno));
+ ksft_print_msg("futex_waitv returned: %d %s\n",
+ errno, strerror(errno));
+ return (void *)1;
} else if (res != NR_FUTEXES - 1) {
- ksft_test_result_fail("futex_waitv returned: %d, expecting %d\n",
- res, NR_FUTEXES - 1);
+ ksft_print_msg("futex_waitv returned: %d, expecting %d\n",
+ res, NR_FUTEXES - 1);
+ return (void *)1;
}
return NULL;
}
+static int join_waiter(pthread_t waiter)
+{
+ void *failed;
+
+ /* A waiter that cannot be joined counts as failed */
+ if (pthread_join(waiter, &failed))
+ return 1;
+ return failed != NULL;
+}
+
int main(int argc, char *argv[])
{
pthread_t waiter;
@@ -104,6 +116,10 @@ int main(int argc, char *argv[])
ksft_test_result_fail("futex_wake private returned: %d %s\n",
res ? errno : res,
res ? strerror(errno) : "");
+ join_waiter(waiter);
+ ret = RET_FAIL;
+ } else if (join_waiter(waiter)) {
+ ksft_test_result_fail("futex_waitv private\n");
ret = RET_FAIL;
} else {
ksft_test_result_pass("futex_waitv private\n");
@@ -137,6 +153,10 @@ int main(int argc, char *argv[])
ksft_test_result_fail("futex_wake shared returned: %d %s\n",
res ? errno : res,
res ? strerror(errno) : "");
+ join_waiter(waiter);
+ ret = RET_FAIL;
+ } else if (join_waiter(waiter)) {
+ ksft_test_result_fail("futex_waitv shared\n");
ret = RET_FAIL;
} else {
ksft_test_result_pass("futex_waitv shared\n");
--
2.56.0
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 15+ messages in thread