From: Vincent Fu Date: Tue, 19 May 2020 18:55:56 +0000 (-0400) Subject: t/zbd: improve error handling for test scripts X-Git-Tag: fio-3.20~8^2 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=ee5e07bf494cbc26072c5aa21926b8cb4797728a;p=fio.git t/zbd: improve error handling for test scripts Use exit instead of return to abort the scripts if modprobe null_blk fails. With return, the script continues to run after printing an error message. Also abort if the null block device setup fails for the regular null block device test script. Reviewed-by: Damien Le Moal Signed-off-by: Vincent Fu --- diff --git a/t/zbd/run-tests-against-regular-nullb b/t/zbd/run-tests-against-regular-nullb index 0f6e4b66..5b7b4009 100755 --- a/t/zbd/run-tests-against-regular-nullb +++ b/t/zbd/run-tests-against-regular-nullb @@ -8,7 +8,7 @@ scriptdir="$(cd "$(dirname "$0")" && pwd)" for d in /sys/kernel/config/nullb/*; do [ -d "$d" ] && rmdir "$d"; done modprobe -r null_blk -modprobe null_blk nr_devices=0 || return $? +modprobe null_blk nr_devices=0 || exit $? for d in /sys/kernel/config/nullb/*; do [ -d "$d" ] && rmdir "$d" done @@ -22,6 +22,6 @@ modprobe null_blk nr_devices=0 && echo 4096 > blocksize && echo 1024 > size && echo 1 > memory_backed && - echo 1 > power + echo 1 > power || exit $? "${scriptdir}"/test-zbd-support "$@" /dev/nullb0 diff --git a/t/zbd/run-tests-against-zoned-nullb b/t/zbd/run-tests-against-zoned-nullb index 0952011c..53aee3e8 100755 --- a/t/zbd/run-tests-against-zoned-nullb +++ b/t/zbd/run-tests-against-zoned-nullb @@ -8,7 +8,7 @@ scriptdir="$(cd "$(dirname "$0")" && pwd)" for d in /sys/kernel/config/nullb/*; do [ -d "$d" ] && rmdir "$d"; done modprobe -r null_blk -modprobe null_blk nr_devices=0 || return $? +modprobe null_blk nr_devices=0 || exit $? for d in /sys/kernel/config/nullb/*; do [ -d "$d" ] && rmdir "$d" done