btrfs-progs: tests: skip tests if dmsetup is not available
Move the check of dmsetup to check_dm_target_support, and adapt the only two places checking if dmsetup is present in the system. Now we skip the tests if dmsetup isn't available, instead of marking the test as failed. Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
47c1630898
commit
656e7a839f
10
tests/common
10
tests/common
|
@ -328,11 +328,17 @@ check_global_prereq()
|
|||
fi
|
||||
}
|
||||
|
||||
# Check if the targets passed as arguments are available, and if not just skip
|
||||
# the test
|
||||
# Check if dmsetup and targets passed as arguments are available, and skip the
|
||||
# test if they aren't
|
||||
check_dm_target_support()
|
||||
{
|
||||
setup_root_helper
|
||||
|
||||
which dmsetup &> /dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
_not_run "This test requires dmsetup tool";
|
||||
fi
|
||||
|
||||
for target in "$@"; do
|
||||
$SUDO_HELPER modprobe "dm-$target" >/dev/null 2>&1
|
||||
$SUDO_HELPER dmsetup targets 2>&1 | grep -q "^$target"
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
source "$TEST_TOP/common"
|
||||
|
||||
check_prereq mkfs.btrfs
|
||||
check_global_prereq dmsetup
|
||||
check_dm_target_support linear
|
||||
|
||||
setup_root_helper
|
||||
|
|
|
@ -6,7 +6,6 @@ source "$TEST_TOP/common"
|
|||
|
||||
check_prereq mkfs.btrfs
|
||||
check_global_prereq udevadm
|
||||
check_global_prereq dmsetup
|
||||
check_dm_target_support linear thin
|
||||
|
||||
setup_root_helper
|
||||
|
|
Loading…
Reference in New Issue