From: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
To: khorenko@virtuozzo.com
Cc: devel@openvz.org
Subject: [Devel] [PATCH hci-8.1 4/6] selftests/zram: fail when a step fails
Date: Mon, 26 Oct 2026 14:40:13 +0200 [thread overview]
Message-ID: <20261026124139.606106-5-eva.kurchatova@virtuozzo.com> (raw)
In-Reply-To: <20261026124139.606106-1-eva.kurchatova@virtuozzo.com>
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 failed step now fails its test, a failed test fails the
suite.
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
next prev parent reply other threads:[~2026-10-26 12:43 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-26 12:40 [Devel] [PATCH hci-8.1 0/6] selftests: fix sticky failure in runners Eva Kurchatova
2026-10-26 12:40 ` [Devel] [PATCH hci-8.1 1/6] ms/selftests/bpf: Upon failures, exit with code 1 in test_xsk.sh Eva Kurchatova
2026-10-26 12:44 ` no-reply
2026-10-26 12:40 ` [Devel] [PATCH hci-8.1 2/6] selftests/memfd: fail run_hugetlbfs_test.sh when a test fails Eva Kurchatova
2026-10-26 12:44 ` no-reply
2026-10-26 12:40 ` [Devel] [PATCH hci-8.1 3/6] selftests: sigaltstack: report the failures the signal handler records Eva Kurchatova
2026-10-26 12:45 ` no-reply
2026-10-26 12:40 ` Eva Kurchatova [this message]
2026-10-26 12:46 ` [Devel] [PATCH hci-8.1 4/6] selftests/zram: fail when a step fails no-reply
2026-10-26 12:40 ` [Devel] [PATCH hci-8.1 5/6] selftests/futex: fail run.sh when a test fails Eva Kurchatova
2026-10-26 12:47 ` no-reply
2026-10-26 12:40 ` [Devel] [PATCH hci-8.1 6/6] selftests/futex: fail futex_waitv when the waiter failed Eva Kurchatova
2026-10-26 12:47 ` no-reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261026124139.606106-5-eva.kurchatova@virtuozzo.com \
--to=eva.kurchatova@virtuozzo.com \
--cc=devel@openvz.org \
--cc=khorenko@virtuozzo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox