]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
common: add filter to _check_dmesg
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)
Introduce a parameter to _check_dmesg which allows callers to provide a
customized filter function to filter out intentional dmesg logs. The
default filter is a simple 'cat' command.

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

index c7190131591c4c5bce810c0923cba4add737baf8..00d59796ac31eeffb805dd903df5c2b421cc9139 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -2981,10 +2981,15 @@ _check_dmesg()
        fi
        rm -f ${RESULT_DIR}/check_dmesg
 
+       # default filter is a simple cat command, caller could provide a
+       # customized filter and pass the name through the first argument, to
+       # filter out intentional WARNINGs or Oopses
+       filter=${1:-cat}
+
        # 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
+               tac | $filter >$seqres.dmesg
        grep -q -e "kernel BUG at" \
             -e "WARNING:" \
             -e "BUG:" \