summaryrefslogtreecommitdiff
path: root/tests/common
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2018-01-30 18:51:25 +0100
committerDavid Sterba <dsterba@suse.com>2018-01-31 15:14:03 +0100
commit7de5fafc646514c3b72e9baacf2de9180e7f392e (patch)
tree562d7f4fd023db5b87c84aceb384919221060f33 /tests/common
parentcda595afa3cfabae2be30af9b8b08f2af3c31437 (diff)
btrfs-progs: tests: enhance common umount helper to take optional paths
The run_check_umount_test_dev umounts the TEST_DEV and also optionally uses the arguments but this would not work as expected if the TEST_DEV is not a vald path for umount (eg. a restored image). Update the helper so it tries to umount all paths, or fallback to TEST_DEV to keep the current behaviour. Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'tests/common')
-rw-r--r--tests/common6
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/common b/tests/common
index 2fac202a..8e5d0cde 100644
--- a/tests/common
+++ b/tests/common
@@ -477,10 +477,14 @@ run_check_mount_test_dev()
run_check $SUDO_HELPER mount -t btrfs $loop_opt "$@" "$TEST_DEV" "$TEST_MNT"
}
+# $1-$n: optional paths to unmount, otherwise fallback to TEST_DEV
run_check_umount_test_dev()
{
setup_root_helper
- run_check $SUDO_HELPER umount "$@" "$TEST_DEV"
+ if [ "$#" = 0 ]; then
+ set -- "$TEST_DEV"
+ fi
+ run_check $SUDO_HELPER umount "$@"
}
check_kernel_support()