btrfs-progs: tests: wait for dm device in test mkfs/005

When the test environment is in 'docker', there's some delay before the
device mapper nodes appear in /dev/mapper. Add a delay before the test
continues, usually 1 second was enough but give it more just in case.
Add ad fallback to skip the test if the device node does not show up,
this is a problem in the running environment and the testsuite should
continue.

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2021-02-05 22:12:31 +01:00
parent a3aa4c0717
commit 1804dcaa4b

View File

@ -25,6 +25,12 @@ run_check truncate -s2g img
loopdev=`run_check_stdout $SUDO_HELPER losetup --find --show img`
run_check $SUDO_HELPER dmsetup create "$dmname" --table "0 1048576 linear $loopdev 0"
# Setting up the device may need some time to appear
sleep 5
if ! [ -b "$dmdev" ]; then
_not_run "dm device created but not visible in /dev/mapper"
fi
dmbase=`readlink -f "$dmdev"`
base=`basename "$dmbase"`
rot="/sys/class/block/$base/queue/rotational"