]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
common: move _check_dmesg to common/rc
authorEryu Guan <eguan@redhat.com>
Tue, 4 Aug 2015 04:10:48 +0000 (14:10 +1000)
committerDave Chinner <david@fromorbit.com>
Tue, 4 Aug 2015 04:10:48 +0000 (14:10 +1000)
Move _check_dmesg to common/rc so that tests could call it directly.

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

diff --git a/check b/check
index a3001309e7a081e41e2592da6dcff03e56349a3d..866b7066e17aa77934245275012980c6f1d6a51f 100755 (executable)
--- a/check
+++ b/check
@@ -396,32 +396,6 @@ _check_filesystems()
        fi
 }
 
-_check_dmesg()
-{
-       if [ ! -f ${RESULT_DIR}/check_dmesg ]; then
-               return
-       fi
-       rm -f ${RESULT_DIR}/check_dmesg
-
-       # search the dmesg log of last run of $seqnum for possible failures
-       # use sed \cregexpc address type, since $seqnum contains "/"
-       dmesg | tac | sed -ne "0,\#run fstests $seqnum at $date_time#p" | \
-               tac >$seqres.dmesg
-       grep -q -e "kernel BUG at" \
-            -e "WARNING:" \
-            -e "BUG:" \
-            -e "Oops:" \
-            -e "possible recursive locking detected" \
-            $seqres.dmesg
-       if [ $? -eq 0 ]; then
-               echo "_check_dmesg: something found in dmesg (see $seqres.dmesg)"
-               err=true
-       else
-               rm -f $seqres.dmesg
-       fi
-}
-
-
 _prepare_test_list
 
 if $OPTIONS_HAVE_SECTIONS; then
@@ -542,7 +516,7 @@ for section in $HOST_OPTIONS_SECTIONS; do
 
            # the filename for the test and the name output are different.
            # we don't include the tests/ directory in the name output.
-           seqnum=`echo $seq | sed -e "s;$SRC_DIR/;;"`
+           export seqnum=`echo $seq | sed -e "s;$SRC_DIR/;;"`
 
            # Similarly, the result directory needs to replace the tests/
            # part of the test location.
@@ -593,7 +567,7 @@ for section in $HOST_OPTIONS_SECTIONS; do
                [ ! -x $seq ] && chmod u+x $seq # ensure we can run it
                $LOGGER_PROG "run xfstest $seqnum"
                if [ -w /dev/kmsg ]; then
-                       date_time=`date +"%F %T"`
+                       export date_time=`date +"%F %T"`
                        echo "run fstests $seqnum at $date_time" > /dev/kmsg
                        # _check_dmesg depends on this log in dmesg
                        touch ${RESULT_DIR}/check_dmesg
@@ -663,7 +637,7 @@ for section in $HOST_OPTIONS_SECTIONS; do
                    try="$try $seqnum"
                    n_try=`expr $n_try + 1`
                    _check_filesystems
-                   _check_dmesg
+                   _check_dmesg || err=true
                fi
 
            fi
index 0562360134393739026dd40cf212b5a9ac3bf127..c7190131591c4c5bce810c0923cba4add737baf8 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -2973,6 +2973,33 @@ _get_device_size()
        grep `_short_dev $1` /proc/partitions | awk '{print $3}'
 }
 
+# check dmesg log for WARNING/Oops/etc.
+_check_dmesg()
+{
+       if [ ! -f ${RESULT_DIR}/check_dmesg ]; then
+               return 0
+       fi
+       rm -f ${RESULT_DIR}/check_dmesg
+
+       # search the dmesg log of last run of $seqnum for possible failures
+       # use sed \cregexpc address type, since $seqnum contains "/"
+       dmesg | tac | sed -ne "0,\#run fstests $seqnum at $date_time#p" | \
+               tac >$seqres.dmesg
+       grep -q -e "kernel BUG at" \
+            -e "WARNING:" \
+            -e "BUG:" \
+            -e "Oops:" \
+            -e "possible recursive locking detected" \
+            $seqres.dmesg
+       if [ $? -eq 0 ]; then
+               echo "_check_dmesg: something found in dmesg (see $seqres.dmesg)"
+               return 1
+       else
+               rm -f $seqres.dmesg
+               return 0
+       fi
+}
+
 # don't check dmesg log after test
 _disable_dmesg_check()
 {