fstests: _fail test by default when _scratch_mount fails

Previously _scratch_mount didn't check the mount status and most
tests continue to run even if the mount failed (unless test checks
for the mount status explicitly). This would result in running tests
on the underlying filesystem (usually rootfs) and implicit test
failures, and such failures can be annoying and are usually hard to
debug.

Now _fail test by default if _scratch_mount failed and introduce
_try_scratch_mount for tests that need to check mount results
themselves.

Suggested-by: Andreas Gruenbacher <agruenba@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
This commit is contained in:
Eryu Guan
2018-02-07 17:31:36 +08:00
parent 729381bda4
commit 69eb6281a9
109 changed files with 184 additions and 192 deletions
+2 -2
View File
@@ -70,7 +70,7 @@ _test_uuid()
| _filter_uuid $EXPECTED_UUID
NEW_UUID=`_scratch_xfs_db -c "uuid" | awk '{print $NF}'`
_check_scratch_fs
_scratch_mount || _fail "Mount failed after UUID $ACTION"
_try_scratch_mount || _fail "Mount failed after UUID $ACTION"
_scratch_unmount
}
@@ -127,7 +127,7 @@ $XFS_COPY_PROG $SCRATCH_DEV $IMGFILE 2>&1 >> $seqres.full || \
_check_xfs_filesystem $IMGFILE none none || _fail "Copy looks corrupted"
# The copy should have META_UUID feature set
_fs_has_META_UUID $IMGFILE || _fail "META_UUID feature not set on copy"
_scratch_mount || _fail "Mount failed after UUID rewrite"
_try_scratch_mount || _fail "Mount failed after UUID rewrite"
_scratch_unmount
rm -f $IMGFILE