summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBart Van Assche <bvanassche@acm.org>2019-08-14 13:10:07 -0700
committerJens Axboe <axboe@kernel.dk>2019-08-14 15:01:29 -0600
commit27bbef0cb264b7d66a5f93424d6fc6ff973e22a2 (patch)
tree5edfad02deda24dbfdeccc24c95bdf0d3d5fd2fa
parent379e5f09a16f789f3d15ff5541a42e1e74d2b383 (diff)
zbd: Improve robustness of unit tests
Give up if creation of the null_blk instance fails. Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rwxr-xr-xt/zbd/run-tests-against-zoned-nullb2
-rwxr-xr-xt/zbd/test-zbd-support4
2 files changed, 3 insertions, 3 deletions
diff --git a/t/zbd/run-tests-against-zoned-nullb b/t/zbd/run-tests-against-zoned-nullb
index 9336716..0952011 100755
--- a/t/zbd/run-tests-against-zoned-nullb
+++ b/t/zbd/run-tests-against-zoned-nullb
@@ -24,6 +24,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/test-zbd-support b/t/zbd/test-zbd-support
index 6fb48ef..ed54a0a 100755
--- a/t/zbd/test-zbd-support
+++ b/t/zbd/test-zbd-support
@@ -772,8 +772,8 @@ source "$(dirname "$0")/functions" || exit $?
dev=$1
realdev=$(readlink -f "$dev")
basename=$(basename "$realdev")
-major=$((0x$(stat -L -c '%t' "$realdev")))
-minor=$((0x$(stat -L -c '%T' "$realdev")))
+major=$((0x$(stat -L -c '%t' "$realdev"))) || exit $?
+minor=$((0x$(stat -L -c '%T' "$realdev"))) || exit $?
disk_size=$(($(<"/sys/dev/block/$major:$minor/size")*512))
# When the target is a partition device, get basename of its holder device to
# access sysfs path of the holder device