[PATCH 3/4] btrfs-progs: test clean start after failures

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



After a failure it fails for a different reason

=== START TEST
/btrfs-progs/tests/misc-tests/029-send-p-different-mountpoints
$TEST_DEV not given, using /btrfs-progs/tests/test.img as fallback
====== RUN MAYFAIL mkdir -p
/btrfs-progs/tests/misc-tests/029-send-p-different-mountpoints/subvol_mnt
====== RUN CHECK /btrfs-progs/mkfs.btrfs -f /btrfs-progs/tests/test.img
ERROR: /btrfs-progs/tests/test.img is mounted <====

Add clean_start() helper to unmount.

Signed-off-by: Anand Jain <anand.jain@xxxxxxxxxx>
---
 tests/common        | 6 ++++++
 tests/misc-tests.sh | 1 +
 2 files changed, 7 insertions(+)

diff --git a/tests/common b/tests/common
index 71661e950db0..bf55500e94ec 100644
--- a/tests/common
+++ b/tests/common
@@ -788,6 +788,12 @@ cleanup_loopdevs()
 	run_check $SUDO_HELPER losetup --all
 }
 
+# add all the cleanups here
+clean_start()
+{
+	grep -q $TEST_MNT /proc/self/mounts && umount $TEST_MNT
+}
+
 init_env()
 {
 	TEST_MNT="${TEST_MNT:-$TEST_TOP/mnt}"
diff --git a/tests/misc-tests.sh b/tests/misc-tests.sh
index 3b49ab012e78..3dc96f258540 100755
--- a/tests/misc-tests.sh
+++ b/tests/misc-tests.sh
@@ -40,6 +40,7 @@ export IMAGE
 export TEST_DEV
 
 rm -f "$RESULTS"
+clean_start
 
 # test rely on corrupting blocks tool
 check_prereq btrfs-corrupt-block
-- 
1.8.3.1




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux