common: exit only if _check_xxx_filesystem called by tests when corruption found
PATCH 1/3 common: exit only if _check_xxx_filesystem called by tests when corruption found
Otherwise these functions cause check to exit if they find corruption and terminate the whole test.
_check_xfs_filesystem already behaves correctly, make _check_generic_filesystem and _check_btrfs_filesystem follow the same behavior.
--- common/rc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
common/rc +6 -2
@@ -1719,7 +1719,9 @@ _check_generic_filesystem() if [ $ok -eq 0 ]; then status=1 - exit 1 + if [ "$iam" != "check" ]; then + exit 1 + fi fi return 0
@@ -1930,7 +1932,9 @@ _check_btrfs_filesystem() if [ $ok -eq 0 ]; then status=1 - exit 1 + if [ "$iam" != "check" ]; then + exit 1 + fi fi return 0
Signature · 1 line
2.1.0
PATCH v2 2/3 common: return failure if _check_xxx_filesystem find corruption
So the callers could know if these functions find corruptions by the return value.
---
v2:
- write new commit message, the old one is not correct
- split out the 'check' check as a separate patch
common/rc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
common/rc +5 -1
@@ -1722,6 +1722,7 @@ _check_generic_filesystem() if [ "$iam" != "check" ]; then exit 1 fi + return 1 fi return 0
@@ -1823,6 +1824,7 @@ _check_xfs_filesystem() if [ "$iam" != "check" ]; then exit 1 fi + return 1 fi return 0
@@ -1867,7 +1869,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()
@@ -1935,6 +1938,7 @@ _check_btrfs_filesystem() if [ "$iam" != "check" ]; then exit 1 fi + return 1 fi return 0
Signature · 1 line
2.1.0
PATCH v2 3/3 check: treat _check_{test,scratch}_fs failures as test failures
In reply to Eryu GuanCurrently if _check_test_fs and/or _check_scratch_fs find corruption, the test itself is still reported as pass, like
[root@hp-dl388eg8-01 xfstests]# ./check xfs/071 xfs/072 FSTYP -- xfs (non-debug) PLATFORM -- Linux/x86_64 hp-dl388eg8-01 3.18.0-rc7+ MKFS_OPTIONS -- -f -bsize=4096 /dev/sda6 MOUNT_OPTIONS -- -o context=system_u:object_r:nfs_t:s0 /dev/sda6 /mnt/testarea/scratch xfs/071 2s _check_xfs_filesystem: filesystem on /dev/sda6 is inconsistent (r) (see /root/xfstests/results//xfs/071.full) xfs/072 1s Ran: xfs/071 xfs/072 Passed all 2 tests [root@hp-dl388eg8-01 xfstests]# echo $? 0
Usually it's not a problem, but it does confuse scripts that depend on return value of check. Update check to treat _check_{test,scratch}_fs failures as test failures too, new test output is like
[root@hp-dl388eg8-01 xfstests]# ./check xfs/071 xfs/072 FSTYP -- xfs (non-debug) PLATFORM -- Linux/x86_64 hp-dl388eg8-01 3.18.0-rc7+ MKFS_OPTIONS -- -f -bsize=4096 /dev/sda6 MOUNT_OPTIONS -- -o context=system_u:object_r:nfs_t:s0 /dev/sda6 /mnt/testarea/scratch xfs/071 2s ... 2s _check_xfs_filesystem: filesystem on /dev/sda6 is inconsistent (r) (see /root/xfstests/results//xfs/071.full) xfs/072 1s ... 1s Ran: xfs/071 xfs/072 Failures: xfs/071 Failed 1 of 2 tests [root@hp-dl388eg8-01 xfstests]# echo $? 1
---
v2:
- introduce new _check_filesystems helper using 8 spaces tabs
Note that the xfs/071 corruption issue is an xfs_repair bug, Eric has sent a patch to fix it, see
http://www.spinics.net/lists/xfs/msg31018.html
check | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-)
check +15 -9
@@ -385,6 +385,18 @@ _summary() rm -f $tmp.* } +_check_filesystems() +{ + if [ -f ${RESULT_DIR}/require_test ]; then + _check_test_fs || err=true + rm -f ${RESULT_DIR}/require_test + fi + if [ -f ${RESULT_DIR}/require_scratch ]; then + _check_scratch_fs || err=true + rm -f ${RESULT_DIR}/require_scratch + fi +} + _prepare_test_list if $OPTIONS_HAVE_SECTIONS; then
@@ -611,6 +623,9 @@ for section in $HOST_OPTIONS_SECTIONS; do err=true fi fi + try="$try $seqnum" + n_try=`expr $n_try + 1` + _check_filesystems fi fi
@@ -623,15 +638,6 @@ for section in $HOST_OPTIONS_SECTIONS; do n_bad=`expr $n_bad + 1` quick=false fi - if [ ! -f $seqres.notrun ] - then - try="$try $seqnum" - n_try=`expr $n_try + 1` - test -f ${RESULT_DIR}/require_test && _check_test_fs - rm -f ${RESULT_DIR}/require_test - test -f ${RESULT_DIR}/require_scratch && _check_scratch_fs - rm -f ${RESULT_DIR}/require_scratch - fi seq="after_$seqnum" done
Signature · 1 line
2.1.0