[PATCH 2/4] selftests: ublk: propagate stress worker failures

From: shao.mingyin

Date: Wed Nov 11 2026 - 10:20:59 EST


From: Shao Mingyin <shao.mingyin@xxxxxxxxxx>

The stress tests update ERR_CODE in background subshells and use a bare
wait in the parent. A worker can therefore fail while the parent still
prints PASS and exits successfully. Calling _show_result() from a worker
also removes backing files shared with other workers.

Generalize the recovery PID collector and use it to wait for every stress
worker in the parent. Return errors from the worker helpers, leave result
reporting and cleanup to the parent, and reset the PID array after each
batch. Keep failures ahead of skips when collecting worker exit statuses.

Fixes: bb2cabf23568 ("selftests: ublk: run stress tests in parallel")
Reported-by: Ming Lei <tom.leiming@xxxxxxxxx>
Link: https://lore.kernel.org/all/avJ0Vn9G7XhZv-XL@fedora-laptop/
Signed-off-by: Shao Mingyin <shao.mingyin@xxxxxxxxxx>
---
This follows "selftests: ublk: propagate recovery worker failures":
https://lore.kernel.org/all/202611092358134332uegNg75loROSwL53Em6A@xxxxxxxxxx/

Tested on next-20261105 with CONFIG_BLK_DEV_UBLK=y in a local QEMU/KVM
VM (4 vCPUs, 4 GiB), using the in-tree kublk and real fio I/O. All nine
stress scripts pass normally before and after the change. A test-only
argument wrapper sets loop ADD_DEV queue counts to zero, making the real
kernel reject them with EINVAL: all nine previously ended with PASS and
exit status 0, and all nine now end with FAIL and exit status 255.

Initial recovery runs exposed failures in recover_01 (remaining QUIESCED)
and recover_03 (remaining LIVE during quiesce). Follow-up experiments
reproduced two independent defects: reused batch SQEs retaining MULTISHOT
and commits arriving after the quiesce cancellation scan.

With separate fixes for those defects applied, the four original
recovery scripts passed twice (eight invocations), without C or driver
diagnostic instrumentation or reduced fio load. This recovery result
includes both separate fixes; the stress A/B results above did not
require them. The original recovery failures are retained in the record.
tools/testing/selftests/ublk/test_common.sh | 14 ++++++-------
tools/testing/selftests/ublk/test_recover_01.sh | 6 +++---
tools/testing/selftests/ublk/test_recover_02.sh | 6 +++---
tools/testing/selftests/ublk/test_recover_03.sh | 6 +++---
tools/testing/selftests/ublk/test_recover_04.sh | 4 ++--
tools/testing/selftests/ublk/test_stress_01.sh | 9 ++++++--
tools/testing/selftests/ublk/test_stress_02.sh | 9 ++++++--
tools/testing/selftests/ublk/test_stress_03.sh | 23 ++++++++++++++++----
tools/testing/selftests/ublk/test_stress_04.sh | 23 ++++++++++++++++----
tools/testing/selftests/ublk/test_stress_05.sh | 28 ++++++++++++++++++-------
tools/testing/selftests/ublk/test_stress_06.sh | 15 ++++++++++---
tools/testing/selftests/ublk/test_stress_07.sh | 15 ++++++++++---
tools/testing/selftests/ublk/test_stress_08.sh | 10 +++++++--
tools/testing/selftests/ublk/test_stress_09.sh | 10 +++++++--
14 files changed, 130 insertions(+), 48 deletions(-)

diff --git a/tools/testing/selftests/ublk/test_common.sh b/tools/testing/selftests/ublk/test_common.sh
index 367df2d..be99f46 100755
--- a/tools/testing/selftests/ublk/test_common.sh
+++ b/tools/testing/selftests/ublk/test_common.sh
@@ -353,13 +353,12 @@ run_io_and_remove()
local dev_id
shift 1

- dev_id=$(_add_ublk_dev "$@")
- _check_add_dev "$TID" $?
+ dev_id=$(_add_ublk_dev "$@") || return $?

[ "$UBLK_TEST_QUIET" -eq 0 ] && echo "run ublk IO vs. remove device(ublk add $*)"
if ! __run_io_and_remove "$dev_id" "${size}" "no"; then
echo "/dev/ublkc$dev_id isn't removed"
- exit 255
+ return 255
fi
}

@@ -369,18 +368,17 @@ run_io_and_kill_daemon()
local dev_id
shift 1

- dev_id=$(_add_ublk_dev "$@")
- _check_add_dev "$TID" $?
+ dev_id=$(_add_ublk_dev "$@") || return $?

[ "$UBLK_TEST_QUIET" -eq 0 ] && echo "run ublk IO vs kill ublk server(ublk add $*)"
if ! __run_io_and_remove "$dev_id" "${size}" "yes"; then
echo "/dev/ublkc$dev_id isn't removed res ${res}"
- exit 255
+ return 255
fi
}

-# Collect recovery workers in the parent before removing shared backing files.
-_wait_recovery_tests()
+# Collect test workers in the parent before removing shared backing files.
+_wait_test_pids()
{
local pid
local ret
diff --git a/tools/testing/selftests/ublk/test_recover_01.sh b/tools/testing/selftests/ublk/test_recover_01.sh
index 950928a..ad5f915 100755
--- a/tools/testing/selftests/ublk/test_recover_01.sh
+++ b/tools/testing/selftests/ublk/test_recover_01.sh
@@ -32,7 +32,7 @@ ublk_run_recover_test -t loop -q 2 -r 1 -b "${UBLK_BACKFILES[0]}" &
pids+=("$!")
ublk_run_recover_test -t stripe -q 2 -r 1 -b "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" &
pids+=("$!")
-_wait_recovery_tests "${pids[@]}"
+_wait_test_pids "${pids[@]}"

pids=()
ublk_run_recover_test -t null -q 2 -r 1 &
@@ -41,7 +41,7 @@ ublk_run_recover_test -t loop -q 2 -r 1 "${UBLK_BACKFILES[0]}" &
pids+=("$!")
ublk_run_recover_test -t stripe -q 2 -r 1 "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" &
pids+=("$!")
-_wait_recovery_tests "${pids[@]}"
+_wait_test_pids "${pids[@]}"

pids=()
ublk_run_recover_test -t null -q 2 -r 1 -i 1 &
@@ -50,7 +50,7 @@ ublk_run_recover_test -t loop -q 2 -r 1 -i 1 "${UBLK_BACKFILES[0]}" &
pids+=("$!")
ublk_run_recover_test -t stripe -q 2 -r 1 -i 1 "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" &
pids+=("$!")
-_wait_recovery_tests "${pids[@]}"
+_wait_test_pids "${pids[@]}"

_cleanup_test
_show_result $TID $ERR_CODE
diff --git a/tools/testing/selftests/ublk/test_recover_02.sh b/tools/testing/selftests/ublk/test_recover_02.sh
index beeeb35..abdc8c1 100755
--- a/tools/testing/selftests/ublk/test_recover_02.sh
+++ b/tools/testing/selftests/ublk/test_recover_02.sh
@@ -36,7 +36,7 @@ ublk_run_recover_test -t loop -q 2 -r 1 -z -b "${UBLK_BACKFILES[0]}" &
pids+=("$!")
ublk_run_recover_test -t stripe -q 2 -r 1 -z -b "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" &
pids+=("$!")
-_wait_recovery_tests "${pids[@]}"
+_wait_test_pids "${pids[@]}"

pids=()
ublk_run_recover_test -t null -q 2 -r 1 -z &
@@ -45,7 +45,7 @@ ublk_run_recover_test -t loop -q 2 -r 1 -z "${UBLK_BACKFILES[0]}" &
pids+=("$!")
ublk_run_recover_test -t stripe -q 2 -r 1 -z "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" &
pids+=("$!")
-_wait_recovery_tests "${pids[@]}"
+_wait_test_pids "${pids[@]}"

pids=()
ublk_run_recover_test -t null -q 2 -r 1 -z -i 1 &
@@ -54,7 +54,7 @@ ublk_run_recover_test -t loop -q 2 -r 1 -z -i 1 "${UBLK_BACKFILES[0]}" &
pids+=("$!")
ublk_run_recover_test -t stripe -q 2 -r 1 -z -i 1 "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" &
pids+=("$!")
-_wait_recovery_tests "${pids[@]}"
+_wait_test_pids "${pids[@]}"

_cleanup_test
_show_result $TID $ERR_CODE
diff --git a/tools/testing/selftests/ublk/test_recover_03.sh b/tools/testing/selftests/ublk/test_recover_03.sh
index 0c6b312..aa84354 100755
--- a/tools/testing/selftests/ublk/test_recover_03.sh
+++ b/tools/testing/selftests/ublk/test_recover_03.sh
@@ -36,7 +36,7 @@ ublk_run_quiesce_recover -t loop -q 2 -r 1 -b "${UBLK_BACKFILES[0]}" &
pids+=("$!")
ublk_run_quiesce_recover -t stripe -q 2 -r 1 -b "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" &
pids+=("$!")
-_wait_recovery_tests "${pids[@]}"
+_wait_test_pids "${pids[@]}"

pids=()
ublk_run_quiesce_recover -t null -q 2 -r 1 &
@@ -45,7 +45,7 @@ ublk_run_quiesce_recover -t loop -q 2 -r 1 "${UBLK_BACKFILES[0]}" &
pids+=("$!")
ublk_run_quiesce_recover -t stripe -q 2 -r 1 "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" &
pids+=("$!")
-_wait_recovery_tests "${pids[@]}"
+_wait_test_pids "${pids[@]}"

pids=()
ublk_run_quiesce_recover -t null -q 2 -r 1 -i 1 &
@@ -54,7 +54,7 @@ ublk_run_quiesce_recover -t loop -q 2 -r 1 -i 1 "${UBLK_BACKFILES[0]}" &
pids+=("$!")
ublk_run_quiesce_recover -t stripe -q 2 -r 1 -i 1 "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" &
pids+=("$!")
-_wait_recovery_tests "${pids[@]}"
+_wait_test_pids "${pids[@]}"

_cleanup_test
_show_result $TID $ERR_CODE
diff --git a/tools/testing/selftests/ublk/test_recover_04.sh b/tools/testing/selftests/ublk/test_recover_04.sh
index 232ae7d..ed508b8 100755
--- a/tools/testing/selftests/ublk/test_recover_04.sh
+++ b/tools/testing/selftests/ublk/test_recover_04.sh
@@ -32,7 +32,7 @@ ublk_run_recover_test -t loop -q 2 -r 1 -u "${UBLK_BACKFILES[0]}" &
pids+=("$!")
ublk_run_recover_test -t stripe -q 2 -r 1 -u "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" &
pids+=("$!")
-_wait_recovery_tests "${pids[@]}"
+_wait_test_pids "${pids[@]}"

pids=()
ublk_run_recover_test -t null -q 2 -r 1 -u -i 1 &
@@ -41,7 +41,7 @@ ublk_run_recover_test -t loop -q 2 -r 1 -u -i 1 "${UBLK_BACKFILES[0]}" &
pids+=("$!")
ublk_run_recover_test -t stripe -q 2 -r 1 -u -i 1 "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" &
pids+=("$!")
-_wait_recovery_tests "${pids[@]}"
+_wait_test_pids "${pids[@]}"

_cleanup_test
_show_result $TID $ERR_CODE
diff --git a/tools/testing/selftests/ublk/test_stress_01.sh b/tools/testing/selftests/ublk/test_stress_01.sh
index f91783f..bff70c2 100755
--- a/tools/testing/selftests/ublk/test_stress_01.sh
+++ b/tools/testing/selftests/ublk/test_stress_01.sh
@@ -3,6 +3,7 @@

. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
ERR_CODE=0
+pids=()

ublk_io_and_remove()
{
@@ -10,8 +11,8 @@ ublk_io_and_remove()
ERR_CODE=$?
if [ ${ERR_CODE} -ne 0 ]; then
echo "$TID failure: $*"
- _show_result $TID $ERR_CODE
fi
+ return "$ERR_CODE"
}

if ! _have_program fio; then
@@ -25,9 +26,13 @@ _create_backfile 1 128M
_create_backfile 2 128M

ublk_io_and_remove 8G -t null -q 4 &
+pids+=("$!")
ublk_io_and_remove 256M -t loop -q 4 "${UBLK_BACKFILES[0]}" &
+pids+=("$!")
ublk_io_and_remove 256M -t stripe -q 4 "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" &
-wait
+pids+=("$!")
+_wait_test_pids "${pids[@]}"
+pids=()

_cleanup_test
_show_result $TID $ERR_CODE
diff --git a/tools/testing/selftests/ublk/test_stress_02.sh b/tools/testing/selftests/ublk/test_stress_02.sh
index b128d11..ef3a36f 100755
--- a/tools/testing/selftests/ublk/test_stress_02.sh
+++ b/tools/testing/selftests/ublk/test_stress_02.sh
@@ -3,6 +3,7 @@

. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
ERR_CODE=0
+pids=()

if ! _have_program fio; then
exit "$UBLK_SKIP_CODE"
@@ -14,8 +15,8 @@ ublk_io_and_kill_daemon()
ERR_CODE=$?
if [ ${ERR_CODE} -ne 0 ]; then
echo "$TID failure: $*"
- _show_result $TID $ERR_CODE
fi
+ return "$ERR_CODE"
}

_prep_test "stress" "run IO and kill ublk server"
@@ -26,9 +27,13 @@ _create_backfile 2 128M

for nr_queue in 1 4; do
ublk_io_and_kill_daemon 8G -t null -q "$nr_queue" &
+ pids+=("$!")
ublk_io_and_kill_daemon 256M -t loop -q "$nr_queue" "${UBLK_BACKFILES[0]}" &
+ pids+=("$!")
ublk_io_and_kill_daemon 256M -t stripe -q "$nr_queue" "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" &
- wait
+ pids+=("$!")
+ _wait_test_pids "${pids[@]}"
+ pids=()
done

_cleanup_test
diff --git a/tools/testing/selftests/ublk/test_stress_03.sh b/tools/testing/selftests/ublk/test_stress_03.sh
index a0f0aba..9af68c3 100755
--- a/tools/testing/selftests/ublk/test_stress_03.sh
+++ b/tools/testing/selftests/ublk/test_stress_03.sh
@@ -3,6 +3,7 @@

. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
ERR_CODE=0
+pids=()

ublk_io_and_remove()
{
@@ -10,8 +11,8 @@ ublk_io_and_remove()
ERR_CODE=$?
if [ ${ERR_CODE} -ne 0 ]; then
echo "$TID failure: $*"
- _show_result $TID $ERR_CODE
fi
+ return "$ERR_CODE"
}

if ! _have_program fio; then
@@ -29,24 +30,38 @@ _create_backfile 1 128M
_create_backfile 2 128M

ublk_io_and_remove 8G -t null -q 4 -z &
+pids+=("$!")
ublk_io_and_remove 256M -t loop -q 4 -z "${UBLK_BACKFILES[0]}" &
+pids+=("$!")
ublk_io_and_remove 256M -t stripe -q 4 -z "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" &
-wait
+pids+=("$!")
+_wait_test_pids "${pids[@]}"
+pids=()

if _have_feature "AUTO_BUF_REG"; then
ublk_io_and_remove 8G -t null -q 4 --auto_zc &
+ pids+=("$!")
ublk_io_and_remove 256M -t loop -q 4 --auto_zc "${UBLK_BACKFILES[0]}" &
+ pids+=("$!")
ublk_io_and_remove 256M -t stripe -q 4 --auto_zc "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" &
+ pids+=("$!")
ublk_io_and_remove 8G -t null -q 4 -z --auto_zc --auto_zc_fallback &
- wait
+ pids+=("$!")
+ _wait_test_pids "${pids[@]}"
+ pids=()
fi

if _have_feature "PER_IO_DAEMON"; then
ublk_io_and_remove 8G -t null -q 4 --auto_zc --nthreads 8 --per_io_tasks &
+ pids+=("$!")
ublk_io_and_remove 256M -t loop -q 4 --auto_zc --nthreads 8 --per_io_tasks "${UBLK_BACKFILES[0]}" &
+ pids+=("$!")
ublk_io_and_remove 256M -t stripe -q 4 --auto_zc --nthreads 8 --per_io_tasks "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" &
+ pids+=("$!")
ublk_io_and_remove 8G -t null -q 4 -z --auto_zc --auto_zc_fallback --nthreads 8 --per_io_tasks &
- wait
+ pids+=("$!")
+ _wait_test_pids "${pids[@]}"
+ pids=()
fi

_cleanup_test
diff --git a/tools/testing/selftests/ublk/test_stress_04.sh b/tools/testing/selftests/ublk/test_stress_04.sh
index 896eae6..85aaba7 100755
--- a/tools/testing/selftests/ublk/test_stress_04.sh
+++ b/tools/testing/selftests/ublk/test_stress_04.sh
@@ -3,6 +3,7 @@

. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
ERR_CODE=0
+pids=()

ublk_io_and_kill_daemon()
{
@@ -10,8 +11,8 @@ ublk_io_and_kill_daemon()
ERR_CODE=$?
if [ ${ERR_CODE} -ne 0 ]; then
echo "$TID failure: $*"
- _show_result $TID $ERR_CODE
fi
+ return "$ERR_CODE"
}

if ! _have_program fio; then
@@ -28,24 +29,38 @@ _create_backfile 1 128M
_create_backfile 2 128M

ublk_io_and_kill_daemon 8G -t null -q 4 -z --no_ublk_fixed_fd &
+pids+=("$!")
ublk_io_and_kill_daemon 256M -t loop -q 4 -z --no_ublk_fixed_fd "${UBLK_BACKFILES[0]}" &
+pids+=("$!")
ublk_io_and_kill_daemon 256M -t stripe -q 4 -z "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" &
-wait
+pids+=("$!")
+_wait_test_pids "${pids[@]}"
+pids=()

if _have_feature "AUTO_BUF_REG"; then
ublk_io_and_kill_daemon 8G -t null -q 4 --auto_zc &
+ pids+=("$!")
ublk_io_and_kill_daemon 256M -t loop -q 4 --auto_zc "${UBLK_BACKFILES[0]}" &
+ pids+=("$!")
ublk_io_and_kill_daemon 256M -t stripe -q 4 --auto_zc --no_ublk_fixed_fd "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" &
+ pids+=("$!")
ublk_io_and_kill_daemon 8G -t null -q 4 -z --auto_zc --auto_zc_fallback &
- wait
+ pids+=("$!")
+ _wait_test_pids "${pids[@]}"
+ pids=()
fi

if _have_feature "PER_IO_DAEMON"; then
ublk_io_and_kill_daemon 8G -t null -q 4 --auto_zc --nthreads 8 --per_io_tasks &
+ pids+=("$!")
ublk_io_and_kill_daemon 256M -t loop -q 4 --auto_zc --nthreads 8 --per_io_tasks "${UBLK_BACKFILES[0]}" &
+ pids+=("$!")
ublk_io_and_kill_daemon 256M -t stripe -q 4 --auto_zc --nthreads 8 --per_io_tasks "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" &
+ pids+=("$!")
ublk_io_and_kill_daemon 8G -t null -q 4 -z --auto_zc --auto_zc_fallback --nthreads 8 --per_io_tasks &
- wait
+ pids+=("$!")
+ _wait_test_pids "${pids[@]}"
+ pids=()
fi

_cleanup_test
diff --git a/tools/testing/selftests/ublk/test_stress_05.sh b/tools/testing/selftests/ublk/test_stress_05.sh
index d6c00c7..baf8e0c 100755
--- a/tools/testing/selftests/ublk/test_stress_05.sh
+++ b/tools/testing/selftests/ublk/test_stress_05.sh
@@ -3,6 +3,7 @@

. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
ERR_CODE=0
+pids=()

if ! _have_program fio; then
exit "$UBLK_SKIP_CODE"
@@ -15,8 +16,7 @@ run_io_and_remove()
local dev_pid
shift 1

- dev_id=$(_add_ublk_dev "$@")
- _check_add_dev $TID $?
+ dev_id=$(_add_ublk_dev "$@") || return $?

[ "$UBLK_TEST_QUIET" -eq 0 ] && echo "run ublk IO vs. remove device(ublk add $*)"

@@ -40,8 +40,8 @@ ublk_io_and_remove()
ERR_CODE=$?
if [ ${ERR_CODE} -ne 0 ]; then
echo "$TID failure: $*"
- _show_result $TID $ERR_CODE
fi
+ return "$ERR_CODE"
}

_prep_test "stress" "run IO and remove device with recovery enabled"
@@ -51,33 +51,47 @@ _create_backfile 1 256M

for reissue in $(seq 0 1); do
ublk_io_and_remove 8G -t null -q 4 -g -r 1 -i "$reissue" &
+ pids+=("$!")
ublk_io_and_remove 256M -t loop -q 4 -g -r 1 -i "$reissue" "${UBLK_BACKFILES[0]}" &
- wait
+ pids+=("$!")
+ _wait_test_pids "${pids[@]}"
+ pids=()
done

if _have_feature "ZERO_COPY"; then
for reissue in $(seq 0 1); do
ublk_io_and_remove 8G -t null -q 4 -z -r 1 -i "$reissue" &
+ pids+=("$!")
ublk_io_and_remove 256M -t loop -q 4 -z -r 1 -i "$reissue" "${UBLK_BACKFILES[1]}" &
- wait
+ pids+=("$!")
+ _wait_test_pids "${pids[@]}"
+ pids=()
done
fi

if _have_feature "AUTO_BUF_REG"; then
for reissue in $(seq 0 1); do
ublk_io_and_remove 8G -t null -q 4 --auto_zc -r 1 -i "$reissue" &
+ pids+=("$!")
ublk_io_and_remove 256M -t loop -q 4 --auto_zc -r 1 -i "$reissue" "${UBLK_BACKFILES[1]}" &
+ pids+=("$!")
ublk_io_and_remove 8G -t null -q 4 -z --auto_zc --auto_zc_fallback -r 1 -i "$reissue" &
- wait
+ pids+=("$!")
+ _wait_test_pids "${pids[@]}"
+ pids=()
done
fi

if _have_feature "PER_IO_DAEMON"; then
ublk_io_and_remove 8G -t null -q 4 --nthreads 8 --per_io_tasks -r 1 -i "$reissue" &
+ pids+=("$!")
ublk_io_and_remove 256M -t loop -q 4 --nthreads 8 --per_io_tasks -r 1 -i "$reissue" "${UBLK_BACKFILES[0]}" &
+ pids+=("$!")
ublk_io_and_remove 8G -t null -q 4 --nthreads 8 --per_io_tasks -r 1 -i "$reissue" &
+ pids+=("$!")
fi
-wait
+_wait_test_pids "${pids[@]}"
+pids=()

_cleanup_test
_show_result $TID $ERR_CODE
diff --git a/tools/testing/selftests/ublk/test_stress_06.sh b/tools/testing/selftests/ublk/test_stress_06.sh
index 9481a27..c6dea85 100755
--- a/tools/testing/selftests/ublk/test_stress_06.sh
+++ b/tools/testing/selftests/ublk/test_stress_06.sh
@@ -3,6 +3,7 @@

. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
ERR_CODE=0
+pids=()

ublk_io_and_remove()
{
@@ -10,8 +11,8 @@ ublk_io_and_remove()
ERR_CODE=$?
if [ ${ERR_CODE} -ne 0 ]; then
echo "$TID failure: $*"
- _show_result $TID $ERR_CODE
fi
+ return "$ERR_CODE"
}

if ! _have_program fio; then
@@ -25,14 +26,22 @@ _create_backfile 1 128M
_create_backfile 2 128M

ublk_io_and_remove 8G -t null -q 4 -u &
+pids+=("$!")
ublk_io_and_remove 256M -t loop -q 4 -u "${UBLK_BACKFILES[0]}" &
+pids+=("$!")
ublk_io_and_remove 256M -t stripe -q 4 -u "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" &
-wait
+pids+=("$!")
+_wait_test_pids "${pids[@]}"
+pids=()

ublk_io_and_remove 8G -t null -q 4 -u --nthreads 8 --per_io_tasks &
+pids+=("$!")
ublk_io_and_remove 256M -t loop -q 4 -u --nthreads 8 --per_io_tasks "${UBLK_BACKFILES[0]}" &
+pids+=("$!")
ublk_io_and_remove 256M -t stripe -q 4 -u --nthreads 8 --per_io_tasks "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" &
-wait
+pids+=("$!")
+_wait_test_pids "${pids[@]}"
+pids=()

_cleanup_test
_show_result $TID $ERR_CODE
diff --git a/tools/testing/selftests/ublk/test_stress_07.sh b/tools/testing/selftests/ublk/test_stress_07.sh
index 3e01c03..d42df5d 100755
--- a/tools/testing/selftests/ublk/test_stress_07.sh
+++ b/tools/testing/selftests/ublk/test_stress_07.sh
@@ -3,6 +3,7 @@

. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
ERR_CODE=0
+pids=()

ublk_io_and_kill_daemon()
{
@@ -10,8 +11,8 @@ ublk_io_and_kill_daemon()
ERR_CODE=$?
if [ ${ERR_CODE} -ne 0 ]; then
echo "$TID failure: $*"
- _show_result $TID $ERR_CODE
fi
+ return "$ERR_CODE"
}

if ! _have_program fio; then
@@ -25,14 +26,22 @@ _create_backfile 1 128M
_create_backfile 2 128M

ublk_io_and_kill_daemon 8G -t null -q 4 -u --no_ublk_fixed_fd &
+pids+=("$!")
ublk_io_and_kill_daemon 256M -t loop -q 4 -u --no_ublk_fixed_fd "${UBLK_BACKFILES[0]}" &
+pids+=("$!")
ublk_io_and_kill_daemon 256M -t stripe -q 4 -u "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" &
-wait
+pids+=("$!")
+_wait_test_pids "${pids[@]}"
+pids=()

ublk_io_and_kill_daemon 8G -t null -q 4 -u --nthreads 8 --per_io_tasks &
+pids+=("$!")
ublk_io_and_kill_daemon 256M -t loop -q 4 -u --nthreads 8 --per_io_tasks "${UBLK_BACKFILES[0]}" &
+pids+=("$!")
ublk_io_and_kill_daemon 256M -t stripe -q 4 -u --nthreads 8 --per_io_tasks "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" &
-wait
+pids+=("$!")
+_wait_test_pids "${pids[@]}"
+pids=()

_cleanup_test
_show_result $TID $ERR_CODE
diff --git a/tools/testing/selftests/ublk/test_stress_08.sh b/tools/testing/selftests/ublk/test_stress_08.sh
index 5f32424..16dde23 100755
--- a/tools/testing/selftests/ublk/test_stress_08.sh
+++ b/tools/testing/selftests/ublk/test_stress_08.sh
@@ -3,6 +3,7 @@

. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
ERR_CODE=0
+pids=()

ublk_io_and_remove()
{
@@ -10,8 +11,8 @@ ublk_io_and_remove()
ERR_CODE=$?
if [ ${ERR_CODE} -ne 0 ]; then
echo "$TID failure: $*"
- _show_result $TID $ERR_CODE
fi
+ return "$ERR_CODE"
}

if ! _have_program fio; then
@@ -35,10 +36,15 @@ _create_backfile 1 128M
_create_backfile 2 128M

ublk_io_and_remove 8G -t null -q 4 -b &
+pids+=("$!")
ublk_io_and_remove 256M -t loop -q 4 --auto_zc -b "${UBLK_BACKFILES[0]}" &
+pids+=("$!")
ublk_io_and_remove 256M -t stripe -q 4 --auto_zc -b "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" &
+pids+=("$!")
ublk_io_and_remove 8G -t null -q 4 -z --auto_zc --auto_zc_fallback -b &
-wait
+pids+=("$!")
+_wait_test_pids "${pids[@]}"
+pids=()

_cleanup_test
_show_result $TID $ERR_CODE
diff --git a/tools/testing/selftests/ublk/test_stress_09.sh b/tools/testing/selftests/ublk/test_stress_09.sh
index 64cb8d9..9dd7625 100755
--- a/tools/testing/selftests/ublk/test_stress_09.sh
+++ b/tools/testing/selftests/ublk/test_stress_09.sh
@@ -3,6 +3,7 @@

. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
ERR_CODE=0
+pids=()

ublk_io_and_kill_daemon()
{
@@ -10,8 +11,8 @@ ublk_io_and_kill_daemon()
ERR_CODE=$?
if [ ${ERR_CODE} -ne 0 ]; then
echo "$TID failure: $*"
- _show_result $TID $ERR_CODE
fi
+ return "$ERR_CODE"
}

if ! _have_program fio; then
@@ -34,10 +35,15 @@ _create_backfile 1 128M
_create_backfile 2 128M

ublk_io_and_kill_daemon 8G -t null -q 4 -z -b &
+pids+=("$!")
ublk_io_and_kill_daemon 256M -t loop -q 4 --auto_zc -b "${UBLK_BACKFILES[0]}" &
+pids+=("$!")
ublk_io_and_kill_daemon 256M -t stripe -q 4 -b "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" &
+pids+=("$!")
ublk_io_and_kill_daemon 8G -t null -q 4 -z --auto_zc --auto_zc_fallback -b &
-wait
+pids+=("$!")
+_wait_test_pids "${pids[@]}"
+pids=()

_cleanup_test
_show_result $TID $ERR_CODE