mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git
synced 2024-11-28 14:44:36 +08:00
btrfs-progs: tests: do dm target detection by one
Switch the helper to take only one parameter, the target name. This can be used to extend the helper with additional parameters for the target. Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
76ab1fa364
commit
6694fe5de9
17
tests/common
17
tests/common
@ -399,10 +399,13 @@ check_global_prereq()
|
||||
fi
|
||||
}
|
||||
|
||||
# Check if dmsetup and targets passed as arguments are available, and skip the
|
||||
# Check if dmsetup and the target passed as argument is available, and skip the
|
||||
# test if they aren't
|
||||
# $1: the target name, expectind module dm-$1
|
||||
check_dm_target_support()
|
||||
{
|
||||
local target="$1"
|
||||
|
||||
setup_root_helper
|
||||
|
||||
type -p dmsetup &> /dev/null
|
||||
@ -410,13 +413,11 @@ check_dm_target_support()
|
||||
_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"
|
||||
if [ $? -ne 0 ]; then
|
||||
_not_run "This test requires dm-$target support"
|
||||
fi
|
||||
done
|
||||
$SUDO_HELPER modprobe "dm-$target" >/dev/null 2>&1
|
||||
$SUDO_HELPER dmsetup targets 2>&1 | grep -q "^$target"
|
||||
if [ $? -ne 0 ]; then
|
||||
_not_run "This test requires dm-$target support"
|
||||
fi
|
||||
}
|
||||
|
||||
check_image()
|
||||
|
@ -6,7 +6,8 @@ source "$TEST_TOP/common"
|
||||
|
||||
check_prereq mkfs.btrfs
|
||||
check_global_prereq udevadm
|
||||
check_dm_target_support linear thin
|
||||
check_dm_target_support linear
|
||||
check_dm_target_support thin
|
||||
|
||||
setup_root_helper
|
||||
prepare_test_dev
|
||||
|
Loading…
Reference in New Issue
Block a user