btrfs-progs: tests: umount TEST_MNT in clean-tests.sh
authorZhao Lei <zhaolei@cn.fujitsu.com>
Mon, 31 Aug 2015 05:04:38 +0000 (13:04 +0800)
committerDavid Sterba <dsterba@suse.com>
Tue, 1 Sep 2015 12:02:48 +0000 (14:02 +0200)
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>
tests/clean-tests.sh

index c1dc56af98d54cfecde3f7cdb047fd8c89185800..f7fefdda366e2e1c700ff903b1451035506b9301 100755 (executable)
@@ -1,12 +1,17 @@
 #!/bin/sh
 # remove all intermediate files from tests
 
+SCRIPT_DIR=$(dirname $(readlink -f $0))
+TOP=$(readlink -f $SCRIPT_DIR/../)
+source $TOP/tests/common
+
+setup_root_helper
+
 if [ "$BUILD_VERBOSE" = 1 ]; then
        verbose=-print
 fi
 
-SCRIPT_DIR=$(dirname $(readlink -f $0))
-TOP=$(readlink -f $SCRIPT_DIR/../)
+$SUDO_HELPER umount "$TEST_MNT" &>/dev/null
 
 if ! cd $TOP/tests; then
        echo "ERROR: cannot cd to $TOP/tests"