In some environments the which utility might not be available and the
shell builtin 'type -p' is readily available.
Signed-off-by: David Sterba <dsterba@suse.com>
Enhance the clean-tests.sh script to detach all loop devices created by
tests, lookup is based on the path prefix. Now 'make test-clean' is
supposed to prepare the environment for next test round.
Signed-off-by: David Sterba <dsterba@suse.com>
As the TEST_TOP is often only a base path, the slash gets doubled. This
is not a problem as the slashes are in the middle of the path and cannot
be confused with the initial "//" that gets interpreted as a network
path. Update all the test drivers.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
[ update changelog ]
Signed-off-by: David Sterba <dsterba@suse.com>
'make clean' followed by 'make test-clean' will fail due to the sanity
check for 'btrfs' binary. We don't need that for cleaning the test, so
turn the error into a warning.
Signed-off-by: David Sterba <dsterba@suse.com>
The test misc-tests/035-receive-common-mount-point-prefix does another
mount inside TEST_MNT but current 'make test-clean' will not properly
undo the nested mount and this will break subsequent tests. The
recursive unmount can handle that.
Signed-off-by: David Sterba <dsterba@suse.com>
Make the TOP variable more configurable, allow to set it to any path
where to find binaries when the testsuite is exported, or fallback to
system binaries.
There's now more code duplication, the logic is now more complex so it's
left open coded for clarity. Further cleanups are possible.
Signed-off-by: David Sterba <dsterba@suse.com>
If a testcase failed, we can't run it(or other tests needs mount) again,
# ./misc-tests.sh 007
[TEST] 007-subvolume-sync
failed: fail
test failed for case 007-subvolume-sync
# ./misc-tests.sh 007
[TEST] 007-subvolume-sync
failed: mount /root/btrfs-progs/tests/test.img /root/btrfs-progs/tests/mnt
test failed for case 007-subvolume-sync
This patch add "umount $TEST_MNT" to clean-tests.sh, to let user
clean mountpoint easily.
After patch:
# ./misc-tests.sh 007
[TEST] 007-subvolume-sync
failed: fail
test failed for case 007-subvolume-sync
#
# clean-tests.sh
#
# ./misc-tests.sh 007
[TEST] 007-subvolume-sync
failed: fail
test failed for case 007-subvolume-sync
Suggested-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
[added sudo helper to umount]
Signed-off-by: David Sterba <dsterba@suse.com>