]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
check: check dmesg log after each test
authorEryu Guan <eguan@redhat.com>
Wed, 21 Jan 2015 05:19:33 +0000 (16:19 +1100)
committerDave Chinner <david@fromorbit.com>
Wed, 21 Jan 2015 05:19:33 +0000 (16:19 +1100)
Check kernel BUG, WARNING etc. in dmesg log after each test and fail the
test if something is found. dmesg log can be found at result dir.

This check now depends on the logging of running tests in dmesg, so this
check can be done without clearing dmesg buffer nor dumping all dmesg to
a file, which can potentially eat all free space on testing host.

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 3d42a8ba37cc5c44bdabd2012a239b719ac68423..0830e0c3051c8b82b9b5d91338983ed5dec93461 100755 (executable)
--- a/check
+++ b/check
@@ -397,6 +397,32 @@ _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
@@ -564,6 +590,8 @@ for section in $HOST_OPTIONS_SECTIONS; do
                if [ -w /dev/kmsg ]; then
                        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
                fi
                ./$seq >$tmp.rawout 2>&1
                sts=$?
@@ -630,6 +658,7 @@ for section in $HOST_OPTIONS_SECTIONS; do
                    try="$try $seqnum"
                    n_try=`expr $n_try + 1`
                    _check_filesystems
+                   _check_dmesg
                fi
 
            fi