From 27bbef0cb264b7d66a5f93424d6fc6ff973e22a2 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Wed, 14 Aug 2019 13:10:07 -0700 Subject: [PATCH] zbd: Improve robustness of unit tests Give up if creation of the null_blk instance fails. Signed-off-by: Bart Van Assche Signed-off-by: Jens Axboe --- t/zbd/run-tests-against-zoned-nullb | 2 +- t/zbd/test-zbd-support | 4 ++-- 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 9336716d..0952011c 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 6fb48ef0..ed54a0aa 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 -- 2.25.1