]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
check: treat _check_{test,scratch}_fs failures as test failures
authorEryu Guan <eguan@redhat.com>
Wed, 24 Dec 2014 03:51:50 +0000 (14:51 +1100)
committerDave Chinner <david@fromorbit.com>
Wed, 24 Dec 2014 03:51:50 +0000 (14:51 +1100)
Currently 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

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
check

diff --git a/check b/check
index 42a1ac2726fa2815c20a6f8640c94bd89bb60b24..10f4a18b080c7b395d013672e2cbc634f86312e4 100755 (executable)
--- a/check
+++ b/check
@@ -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