btrfs-progs: tests: Add check for dm targets

This function will be used later to test if dm-thin is supported.

Suggested-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Marcos Paulo de Souza 2019-12-17 17:31:52 -03:00 committed by David Sterba
parent d028b3998e
commit 4e02678c29
1 changed files with 14 additions and 0 deletions

View File

@ -328,6 +328,20 @@ check_global_prereq()
fi
}
# Check if the targets passed as arguments are available, and if not just skip
# the test
check_dm_target_support()
{
setup_root_helper
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
}
check_image()
{
local image