Tests like xfs/179 depend on the return value of _check_scratch_fs to
detect fs corruption, but _check_$FSTYP_filesystem always returns 0.

Make _check_$FSTYP_filesystem return failure on corruption.

Also don't exit if these functions called by 'check', like what
_check_xfs_filesystem() does.

Signed-off-by: Eryu Guan <[email protected]>
---
 common/rc | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/common/rc b/common/rc
index 692d45c..87d2928 100644
--- a/common/rc
+++ b/common/rc
@@ -1717,7 +1717,10 @@ _check_generic_filesystem()
 
     if [ $ok -eq 0 ]; then
        status=1
-       exit 1
+       if [ "$iam" != "check" ]; then
+               exit 1
+       fi
+       return 1
     fi
 
     return 0
@@ -1819,6 +1822,7 @@ _check_xfs_filesystem()
        if [ "$iam" != "check" ]; then
                exit 1
        fi
+       return 1
     fi
 
     return 0
@@ -1863,7 +1867,8 @@ _check_udf_filesystem()
     $here/src/udf_test $OPT_ARG $device | tee $seqres.checkfs | egrep 
"Error|Warning" | \
        _udf_test_known_error_filter | \
        egrep -iv "Error count:.*[0-9]+.*total occurrences:.*[0-9]+|Warning 
count:.*[0-9]+.*total occurrences:.*[0-9]+" && \
-        echo "Warning UDF Verifier reported errors see $seqres.checkfs."
+        echo "Warning UDF Verifier reported errors see $seqres.checkfs." && 
return 1
+    return 0
 }
 
 _check_xfs_test_fs()
@@ -1928,7 +1933,10 @@ _check_btrfs_filesystem()
 
     if [ $ok -eq 0 ]; then
        status=1
-       exit 1
+       if [ "$iam" != "check" ]; then
+               exit 1
+       fi
+       return 1
     fi
 
     return 0
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to