tests: do not fail if dm-thin is missing
v3 cover tests: do not fail if dm-thin is missing
From: Marcos Paulo de Souza <[email protected]>
This is the third version, which basically removes the last patch, as suggested by David, and reworks the first one, by keeping the $SUDO_HELPER call and adding the setup_root_helper function call before calling $SUDO_HELPER. The tests 005 and 017 are now skipped when triggered in a kernel without dm-thin.
Please review.
Original message:
these patchset is trying to fix the issue 192[1] by checking if dm-thin exists, and if it's not available, skip the test. In the last patch, the same is done for dmsetup. Feel free to ignore the last patch if you think we should stop the tests if dmsetup isn't available.
Thanks!
[1]: https://github.com/kdave/btrfs-progs/issues/192
Marcos Paulo de Souza (3):
tests: common: Add check_dm_target_support helper
tests: mkfs: 017: Use check_dm_target_support helper
tests: mkfs: 005: Use check_dm_target_support helper
tests/common | 15 +++++++++++++++ .../005-long-device-name-for-ssd/test.sh | 1 + .../test.sh | 1 + 3 files changed, 17 insertions(+)
Signature · 1 line
2.24.0
PATCH v3 1/3 tests: common: Add check_dm_target_support helper
From: Marcos Paulo de Souza <[email protected]>
This function will be used later to test if dm-thin is supported. Inspired by fstests.
--- tests/common | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
tests/common +15 -0
@@ -322,6 +322,21 @@ 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
Signature · 1 line
2.24.0
Re: [btrfs-progs PATCHv3 1/3] tests: common: Add check_dm_target_support helper
Quoted 7 lines · Marcos Paulo de Souza
From: Marcos Paulo de Souza <[email protected]>
This function will be used later to test if dm-thin is supported. Inspired by fstests.
Suggested-by Qu Wenruo <[email protected]>Signed-off-by Marcos Paulo de Souza <[email protected]>
Thanks,
Qu
Quoted 31 lines
--- tests/common | 15 +++++++++++++++ 1 file changed, 15 insertions(+)tests/common +15
-0@@ -322,6 +322,21 @@ 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
PATCH v3 2/3 tests: mkfs: 017: Use check_dm_target_support helper
In reply to Marcos Paulo de SouzaFrom: Marcos Paulo de Souza <[email protected]>
If dm-thin or dm-linear are not supported, let's skip the test altogether instead of throwing an error.
Issue: #192
--- .../017-small-backing-size-thin-provision-device/test.sh | 1 + 1 file changed, 1 insertion(+)
tests/mkfs-tests/017-small-backing-size-thin-provision-device/test.sh +1 -0
@@ -7,6 +7,7 @@ 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 prepare_test_dev
Signature · 1 line
2.24.0
PATCH v3 3/3 tests: mkfs: 005: Use check_dm_target_support helper
In reply to Marcos Paulo de SouzaFrom: Marcos Paulo de Souza <[email protected]>
This way we ensure the linear target is available and skip the test.
--- tests/mkfs-tests/005-long-device-name-for-ssd/test.sh | 1 + 1 file changed, 1 insertion(+)
tests/mkfs-tests/005-long-device-name-for-ssd/test.sh +1 -0
@@ -5,6 +5,7 @@ source "$TEST_TOP/common" check_prereq mkfs.btrfs check_global_prereq dmsetup +check_dm_target_support linear setup_root_helper prepare_test_dev
Signature · 1 line
2.24.0