public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: Eryu Guan <eguan@redhat.com>
To: fstests@vger.kernel.org
Cc: Fengguang Wu <fengguang.wu@intel.com>, Eryu Guan <eguan@redhat.com>
Subject: [PATCH] common/rc: insert a line to dmesg on intentional WARNINGs
Date: Tue, 31 Oct 2017 16:29:20 +0800	[thread overview]
Message-ID: <20171031082920.31182-1-eguan@redhat.com> (raw)

We already filtered out intentional WARNINGs from dmesg in
_check_dmesg(), but 3rd party dmesg parsers, e.g. LKP 0day test
robot, don't know that it's not a test failure in such cases.

So per Fengguang's request, insert a message to dmesg to indicate
that the WARNINGs in this test are intentional, external dmesg
parsers could take proper actions based on this message.

Signed-off-by: Eryu Guan <eguan@redhat.com>
---
 common/rc | 26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/common/rc b/common/rc
index e2a8229f08bc..80fb47c74028 100644
--- a/common/rc
+++ b/common/rc
@@ -3295,12 +3295,21 @@ _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}
+	local filter=${1:-cat}
+	local changed=false
 
 	# 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 | $filter >$seqres.dmesg
+		tac >$seqres.dmesg.orig
+
+	# check if $filter filtered out intentional warnings
+	cat $seqres.dmesg.orig  | $filter > $seqres.dmesg
+	if ! diff $seqres.dmesg.orig $seqres.dmesg >/dev/null 2>&1; then
+		changed=true
+	fi
+	rm -f $seqres.dmesg.orig
+
 	egrep -q -e "kernel BUG at" \
 	     -e "WARNING:" \
 	     -e "BUG:" \
@@ -3311,13 +3320,20 @@ _check_dmesg()
 	     -e "INFO: possible circular locking dependency detected" \
 	     -e "general protection fault:" \
 	     $seqres.dmesg
+
 	if [ $? -eq 0 ]; then
 		_dump_err "_check_dmesg: something found in dmesg (see $seqres.dmesg)"
 		return 1
-	else
-		rm -f $seqres.dmesg
-		return 0
 	fi
+
+	# test passed dmesg check, then insert a PLEASE IGNORE message to dmesg
+	# if $changed is true, to let 3rd party dmesg parser, e.g. 0day test
+	# robot, know that it's not a test failure
+	if $changed; then
+		echo "fstests $seqnum: INTENTIONAL WARNINGS, PLEASE IGNORE" > /dev/kmsg
+	fi
+	rm -f $seqres.dmesg
+	return 0
 }
 
 # don't check dmesg log after test
-- 
2.13.6


                 reply	other threads:[~2017-10-31  8:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171031082920.31182-1-eguan@redhat.com \
    --to=eguan@redhat.com \
    --cc=fengguang.wu@intel.com \
    --cc=fstests@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox