OpenVZ / Virtuozzo kernel development (devel@openvz.org)
 help / color / mirror / Atom feed
* [Devel] [PATCH hci-8.1 v3 0/7] selftests: fix sticky failure in runners
@ 2026-10-27 17:34 Eva Kurchatova
  2026-10-27 17:34 ` [Devel] [PATCH hci-8.1 v3 1/7] ms/selftests/bpf: Upon failures, exit with code 1 in test_xsk.sh Eva Kurchatova
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Eva Kurchatova @ 2026-10-27 17:34 UTC (permalink / raw)
  To: khorenko; +Cc: devel

Patchset for task https://virtuozzo.atlassian.net/browse/VSTOR-134205

Blocked on https://virtuozzo.atlassian.net/browse/VSTOR-150731

Changes in v3:
- zram: a compression algorithm the kernel is built without skips zram01
  (SKIP line, exit 4) instead of failing it. An unreadable list of
  algorithms fails it.
- zram: a missing mkfs.ext2, mkswap, swapon or swapoff skips the tests.

Link to v2: http://lore.virtuozzo.com/kernel/20261027155236.1226178-1-eva.kurchatova@virtuozzo.com/T/#t

Changes in v2:
- Pick 7d50e00fef28 ("selftests/futex: futex_waitv wouldblock test
  should fail") before the run.sh patch, so that run.sh failing on
  futex_wait_wouldblock comes with a "not ok" line.
- futex_waitv: the waiter returns its status and the main thread reports
  one result per subtest, instead of the waiter adding a second one; a
  waiter that cannot be joined counts as failed; the ksft_get_fail_cnt()
  check is gone.
- zram: the message says it is the steps that report FAIL which fail the
  test, and that the suite takes the worst result of its two tests.

Link to v1: http://lore.virtuozzo.com/kernel/20261026124139.606106-1-eva.kurchatova@virtuozzo.com/T/#t

Edward Liaw (1):
  ms/selftests/futex: futex_waitv wouldblock test should fail

Eva Kurchatova (6):
  ms/selftests/bpf: Upon failures, exit with code 1 in test_xsk.sh
  selftests/memfd: fail run_hugetlbfs_test.sh when a test fails
  selftests: sigaltstack: report the failures the signal handler records
  selftests/zram: fail when a step fails
  selftests/futex: fail run.sh when a test fails
  selftests/futex: fail futex_waitv when the waiter failed

 tools/testing/selftests/bpf/test_xsk.sh       |  2 +
 .../futex/functional/futex_wait_wouldblock.c  |  2 +-
 .../selftests/futex/functional/futex_waitv.c  | 28 ++++++--
 .../testing/selftests/futex/functional/run.sh | 66 ++++++++++---------
 .../selftests/memfd/run_hugetlbfs_test.sh     |  7 +-
 tools/testing/selftests/sigaltstack/sas.c     |  3 +-
 tools/testing/selftests/zram/zram.sh          | 11 +++-
 tools/testing/selftests/zram/zram01.sh        |  8 +++
 tools/testing/selftests/zram/zram02.sh        |  1 +
 tools/testing/selftests/zram/zram_lib.sh      | 45 ++++++++++---
 10 files changed, 122 insertions(+), 51 deletions(-)

-- 
2.56.0

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Devel] [PATCH hci-8.1 v3 1/7] ms/selftests/bpf: Upon failures, exit with code 1 in test_xsk.sh
  2026-10-27 17:34 [Devel] [PATCH hci-8.1 v3 0/7] selftests: fix sticky failure in runners Eva Kurchatova
@ 2026-10-27 17:34 ` Eva Kurchatova
  2026-10-27 17:34 ` [Devel] [PATCH hci-8.1 v3 2/7] selftests/memfd: fail run_hugetlbfs_test.sh when a test fails Eva Kurchatova
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Eva Kurchatova @ 2026-10-27 17:34 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] 10+ messages in thread

* [Devel] [PATCH hci-8.1 v3 2/7] selftests/memfd: fail run_hugetlbfs_test.sh when a test fails
  2026-10-27 17:34 [Devel] [PATCH hci-8.1 v3 0/7] selftests: fix sticky failure in runners Eva Kurchatova
  2026-10-27 17:34 ` [Devel] [PATCH hci-8.1 v3 1/7] ms/selftests/bpf: Upon failures, exit with code 1 in test_xsk.sh Eva Kurchatova
@ 2026-10-27 17:34 ` Eva Kurchatova
  2026-10-27 17:34 ` [Devel] [PATCH hci-8.1 v3 3/7] selftests: sigaltstack: report the failures the signal handler records Eva Kurchatova
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Eva Kurchatova @ 2026-10-27 17:34 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] 10+ messages in thread

* [Devel] [PATCH hci-8.1 v3 3/7] selftests: sigaltstack: report the failures the signal handler records
  2026-10-27 17:34 [Devel] [PATCH hci-8.1 v3 0/7] selftests: fix sticky failure in runners Eva Kurchatova
  2026-10-27 17:34 ` [Devel] [PATCH hci-8.1 v3 1/7] ms/selftests/bpf: Upon failures, exit with code 1 in test_xsk.sh Eva Kurchatova
  2026-10-27 17:34 ` [Devel] [PATCH hci-8.1 v3 2/7] selftests/memfd: fail run_hugetlbfs_test.sh when a test fails Eva Kurchatova
@ 2026-10-27 17:34 ` Eva Kurchatova
  2026-10-27 17:34 ` [Devel] [PATCH hci-8.1 v3 4/7] selftests/zram: fail when a step fails Eva Kurchatova
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Eva Kurchatova @ 2026-10-27 17:34 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] 10+ messages in thread

* [Devel] [PATCH hci-8.1 v3 4/7] selftests/zram: fail when a step fails
  2026-10-27 17:34 [Devel] [PATCH hci-8.1 v3 0/7] selftests: fix sticky failure in runners Eva Kurchatova
                   ` (2 preceding siblings ...)
  2026-10-27 17:34 ` [Devel] [PATCH hci-8.1 v3 3/7] selftests: sigaltstack: report the failures the signal handler records Eva Kurchatova
@ 2026-10-27 17:34 ` Eva Kurchatova
  2026-10-27 17:34 ` [Devel] [PATCH hci-8.1 v3 5/7] ms/selftests/futex: futex_waitv wouldblock test should fail Eva Kurchatova
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Eva Kurchatova @ 2026-10-27 17:34 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. A compression algorithm the kernel is built without, or a tool
the tests need that is not installed, skips them instead of failing.

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   |  8 +++++
 tools/testing/selftests/zram/zram02.sh   |  1 +
 tools/testing/selftests/zram/zram_lib.sh | 45 +++++++++++++++++++-----
 4 files changed, 54 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..8f337e6adf8b 100755
--- a/tools/testing/selftests/zram/zram01.sh
+++ b/tools/testing/selftests/zram/zram01.sh
@@ -10,6 +10,7 @@
 
 TCID="zram01"
 ERR_CODE=0
+SKIP_CODE=0
 
 . ./zram_lib.sh
 
@@ -33,6 +34,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 +74,10 @@ zram_cleanup
 
 if [ $ERR_CODE -ne 0 ]; then
 	echo "$TCID : [FAIL]"
+	exit 1
+elif [ $SKIP_CODE -ne 0 ]; then
+	echo "$TCID : [SKIP]"
+	exit $SKIP_CODE
 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..6d71022296e5 100755
--- a/tools/testing/selftests/zram/zram_lib.sh
+++ b/tools/testing/selftests/zram/zram_lib.sh
@@ -28,6 +28,13 @@ check_prereqs()
 		echo $msg must be run as root >&2
 		exit $ksft_skip
 	fi
+
+	for cmd in mkfs.ext2 mkswap swapon swapoff; do
+		if ! command -v $cmd > /dev/null 2>&1; then
+			echo $msg $cmd is not installed >&2
+			exit $ksft_skip
+		fi
+	done
 }
 
 kernel_gte()
@@ -131,12 +138,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'"
@@ -152,11 +161,25 @@ zram_compress_alg()
 	local i=$dev_start
 	local algs=$(cat /sys/block/zram${i}/comp_algorithm)
 	echo "supported algs: $algs"
+	if [ -z "$algs" ]; then
+		echo "FAIL can't read /sys/block/zram${i}/comp_algorithm"
+		ERR_CODE=-1
+	fi
 
 	for alg in $zram_algs; do
 		local sys_path="/sys/block/zram${i}/comp_algorithm"
+		# A kernel built without the algorithm is not a zram failure
+		case " $(echo "$algs" | tr -d '[]') " in
+		*" $alg "*) ;;
+		*)
+			echo "SKIP '$alg' is not supported by this kernel"
+			SKIP_CODE=$ksft_skip
+			i=$(($i + 1))
+			continue
+			;;
+		esac
 		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 +194,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 +211,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 +228,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 +254,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 +274,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 +288,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] 10+ messages in thread

* [Devel] [PATCH hci-8.1 v3 5/7] ms/selftests/futex: futex_waitv wouldblock test should fail
  2026-10-27 17:34 [Devel] [PATCH hci-8.1 v3 0/7] selftests: fix sticky failure in runners Eva Kurchatova
                   ` (3 preceding siblings ...)
  2026-10-27 17:34 ` [Devel] [PATCH hci-8.1 v3 4/7] selftests/zram: fail when a step fails Eva Kurchatova
@ 2026-10-27 17:34 ` Eva Kurchatova
  2026-10-27 17:34 ` [Devel] [PATCH hci-8.1 v3 6/7] selftests/futex: fail run.sh when a test fails Eva Kurchatova
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Eva Kurchatova @ 2026-10-27 17:34 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] 10+ messages in thread

* [Devel] [PATCH hci-8.1 v3 6/7] selftests/futex: fail run.sh when a test fails
  2026-10-27 17:34 [Devel] [PATCH hci-8.1 v3 0/7] selftests: fix sticky failure in runners Eva Kurchatova
                   ` (4 preceding siblings ...)
  2026-10-27 17:34 ` [Devel] [PATCH hci-8.1 v3 5/7] ms/selftests/futex: futex_waitv wouldblock test should fail Eva Kurchatova
@ 2026-10-27 17:34 ` Eva Kurchatova
  2026-10-27 17:34 ` [Devel] [PATCH hci-8.1 v3 7/7] selftests/futex: fail futex_waitv when the waiter failed Eva Kurchatova
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Eva Kurchatova @ 2026-10-27 17:34 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] 10+ messages in thread

* [Devel] [PATCH hci-8.1 v3 7/7] selftests/futex: fail futex_waitv when the waiter failed
  2026-10-27 17:34 [Devel] [PATCH hci-8.1 v3 0/7] selftests: fix sticky failure in runners Eva Kurchatova
                   ` (5 preceding siblings ...)
  2026-10-27 17:34 ` [Devel] [PATCH hci-8.1 v3 6/7] selftests/futex: fail run.sh when a test fails Eva Kurchatova
@ 2026-10-27 17:34 ` Eva Kurchatova
  2026-10-30 18:45 ` [Devel] [PATCH hci-8.1 v3 0/7] selftests: fix sticky failure in runners Konstantin Khorenko
  2026-10-30 18:57 ` Konstantin Khorenko
  8 siblings, 0 replies; 10+ messages in thread
From: Eva Kurchatova @ 2026-10-27 17:34 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] 10+ messages in thread

* Re: [Devel] [PATCH hci-8.1 v3 0/7] selftests: fix sticky failure in runners
  2026-10-27 17:34 [Devel] [PATCH hci-8.1 v3 0/7] selftests: fix sticky failure in runners Eva Kurchatova
                   ` (6 preceding siblings ...)
  2026-10-27 17:34 ` [Devel] [PATCH hci-8.1 v3 7/7] selftests/futex: fail futex_waitv when the waiter failed Eva Kurchatova
@ 2026-10-30 18:45 ` Konstantin Khorenko
  2026-10-30 18:57 ` Konstantin Khorenko
  8 siblings, 0 replies; 10+ messages in thread
From: Konstantin Khorenko @ 2026-10-30 18:45 UTC (permalink / raw)
  To: Eva Kurchatova; +Cc: devel

Hi Eva,

thank you for the series, I'm taking it, but with the following changes.

Code:

- [2/7] selftests/memfd: in a container /proc/meminfo has no
  HugePages_Free line by default. freepgs stays empty, the
  "[ $freepgs -lt $hpages_test ]" check fails with a syntax error, the
  skip is not taken and memfd_test aborts. Before the series that abort
  was a false "ok", with the patch it would be a false "not ok". Added
  a skip for that case:

  +if [ -z "$freepgs" ]; then
  +	echo "No HugePages_Free in /proc/meminfo"
  +	exit $ksft_skip
  +fi

- [4/7] selftests/zram: when comp_algorithm cannot be read, $algs is
  empty, so after the FAIL line the loop printed "SKIP 'lzo' is not
  supported by this kernel" as well. Return right after the FAIL:

   		echo "FAIL can't read /sys/block/zram${i}/comp_algorithm"
   		ERR_CODE=-1
  +		return
   	fi

- [7/7] selftests/futex: error() from logging.h only prints, so after
  a failed pthread_create() join_waiter() would call pthread_join() on
  an uninitialized pthread_t (private case) or on an already joined
  one (shared case). That is undefined behaviour and can crash the
  test before it prints its result. Fail the test right there instead:

  -		error("pthread_create failed\n", errno);
  +		ksft_exit_fail_msg("pthread_create failed\n");

Authorship:

- [1/7] ms/selftests/bpf: the author is Ricardo B. Marlière
  <rbm@suse.com>, as in upstream 2a912258c90e, not you. Please keep
  the original author when you cherry-pick, as you did in 5/7.

Commit messages:

- [2/7] Dropped "The hugetlbfs F_SEAL_EXEC bug went unnoticed that way
  until the abort was seen by eye." How a bug was found does not
  belong in the message. Added a paragraph about the container skip.
- [4/7] The first sentence chained three facts with commas, turned it
  into a list.
- [7/7] Split the sentence joined with ";" into two paragraphs, added
  a sentence about the pthread_create() failure.

Cover letter:

- Added a paragraph saying what the series does and why.
- Replaced "Blocked on VSTOR-150731" with what it means: 1/7 makes
  test_xsk.sh fail on the xsk subtest failures fixed there, and those
  fixes are already in the base.
- Fixed the author list and the diffstat.

Two issues found during review are not part of this series, I have
filed tasks for them:

- VSTOR-152656: zram_load() derives the device ids from the number of
  /dev/zram* nodes, while hot_add takes the lowest free id. With a gap
  in the ids the test works on and resets a zram device it did not
  create. The same code is in mainline; VSTOR-152657 tracks sending
  the fix there.
- VSTOR-152660: the five negative checks in futex_waitv.c compare
  res == EINVAL, which is never true, so they always pass. Upstream
  fixed this in a894f6f403320; it needs a port, see the task.

--
Best regards,
Konstantin Khorenko

-- 
Konstantin Khorenko,
Virtuozzo Linux Kernel Team

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Devel] [PATCH hci-8.1 v3 0/7] selftests: fix sticky failure in runners
  2026-10-27 17:34 [Devel] [PATCH hci-8.1 v3 0/7] selftests: fix sticky failure in runners Eva Kurchatova
                   ` (7 preceding siblings ...)
  2026-10-30 18:45 ` [Devel] [PATCH hci-8.1 v3 0/7] selftests: fix sticky failure in runners Konstantin Khorenko
@ 2026-10-30 18:57 ` Konstantin Khorenko
  8 siblings, 0 replies; 10+ messages in thread
From: Konstantin Khorenko @ 2026-10-30 18:57 UTC (permalink / raw)
  To: Eva Kurchatova; +Cc: devel

On Tue, 27 Oct 2026 19:34:16 +0200, Eva Kurchatova wrote:
> selftests: fix sticky failure in runners
> 
> Patchset for task https://virtuozzo.atlassian.net/browse/VSTOR-134205
> 
> Several selftests report "ok" when a check inside them failed:
> - a shell runner ends with the status of its last command, not of the
>   tests it ran (test_xsk.sh, run_hugetlbfs_test.sh, zram, futex run.sh)
> - a C test reports a failed check as a pass (sigaltstack, futex_waitv,
>   futex_wait_wouldblock)
> 
> [...]

Applied to branch-rh10-6.12.0-211.52.1.22.x.vz10-ovz, will be released in rh10-6.12.0-211.52.1.22.13.vz10, thanks!

[1/7] ms/selftests/bpf: Upon failures, exit with code 1 in test_xsk.sh
      https://bitbucket.org/virtuozzocore/vzkernel.vzs/commits/d5e5642b10a0
[2/7] selftests/memfd: fail run_hugetlbfs_test.sh when a test fails
      https://bitbucket.org/virtuozzocore/vzkernel.vzs/commits/29577a0ef957
[3/7] selftests: sigaltstack: report the failures the signal handler records
      https://bitbucket.org/virtuozzocore/vzkernel.vzs/commits/21eb3e460690
[4/7] selftests/zram: fail when a step fails
      https://bitbucket.org/virtuozzocore/vzkernel.vzs/commits/2604d3a4efa5
[5/7] ms/selftests/futex: futex_waitv wouldblock test should fail
      https://bitbucket.org/virtuozzocore/vzkernel.vzs/commits/ee8fba174b3f
[6/7] selftests/futex: fail run.sh when a test fails
      https://bitbucket.org/virtuozzocore/vzkernel.vzs/commits/1eee0b827336
[7/7] selftests/futex: fail futex_waitv when the waiter failed
      https://bitbucket.org/virtuozzocore/vzkernel.vzs/commits/c388a3b453e1

-- 
Konstantin Khorenko,
Virtuozzo Linux Kernel Team


_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-10-30 18:58 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-27 17:34 [Devel] [PATCH hci-8.1 v3 0/7] selftests: fix sticky failure in runners Eva Kurchatova
2026-10-27 17:34 ` [Devel] [PATCH hci-8.1 v3 1/7] ms/selftests/bpf: Upon failures, exit with code 1 in test_xsk.sh Eva Kurchatova
2026-10-27 17:34 ` [Devel] [PATCH hci-8.1 v3 2/7] selftests/memfd: fail run_hugetlbfs_test.sh when a test fails Eva Kurchatova
2026-10-27 17:34 ` [Devel] [PATCH hci-8.1 v3 3/7] selftests: sigaltstack: report the failures the signal handler records Eva Kurchatova
2026-10-27 17:34 ` [Devel] [PATCH hci-8.1 v3 4/7] selftests/zram: fail when a step fails Eva Kurchatova
2026-10-27 17:34 ` [Devel] [PATCH hci-8.1 v3 5/7] ms/selftests/futex: futex_waitv wouldblock test should fail Eva Kurchatova
2026-10-27 17:34 ` [Devel] [PATCH hci-8.1 v3 6/7] selftests/futex: fail run.sh when a test fails Eva Kurchatova
2026-10-27 17:34 ` [Devel] [PATCH hci-8.1 v3 7/7] selftests/futex: fail futex_waitv when the waiter failed Eva Kurchatova
2026-10-30 18:45 ` [Devel] [PATCH hci-8.1 v3 0/7] selftests: fix sticky failure in runners Konstantin Khorenko
2026-10-30 18:57 ` Konstantin Khorenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox