public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@sandeen.net>
To: Eric Sandeen <sandeen@redhat.com>
Cc: xfs-oss <xfs@oss.sgi.com>
Subject: [PATCH, V2] xfstests: fail test if it causes a kernel taint
Date: Thu, 23 May 2013 10:47:44 -0500	[thread overview]
Message-ID: <519E3A20.7060102@sandeen.net> (raw)
In-Reply-To: <51916146.80308@redhat.com>

This modification will fail a test if it introduces one of
a handful of "serious" kernel taints.  I mask on a few taint
values because using an out of tree module or a non-GPL module
should never fail a test, for example.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

Tested by modifying tests/generic/001 to modprobe a "staging"
driver, and adding the staging taint bit (1024) to the mask.

V2: fail test by modifying the test output so the golden
output check will fail, per dchinner's suggestion.

diff --git a/check b/check
index a79747e..7ba6696 100755
--- a/check
+++ b/check
@@ -446,6 +446,11 @@ do
 	fi
 	rm -f core $seqres.notrun
 
+	if [ "$HOSTOS" == "Linux" ]; then
+		tainted=`sysctl -n kernel.tainted`
+		let "tainted &= $TAINT_FAIL"
+	fi
+
 	start=`_wallclock`
 	$timestamp && echo -n "	["`date "+%T"`"]"
 	[ ! -x $seq ] && chmod u+x $seq # ensure we can run it
@@ -458,6 +463,19 @@ do
 	_fix_malloc <$tmp.rawout >$tmp.out
 	rm -f $tmp.rawout
 
+	# See if this run tainted the kernel due to oops, etc
+	# If so, break the test via the golden output file
+	if [ "$HOSTOS" == "Linux" ]
+	then
+		tainted2=`sysctl -n kernel.tainted`
+		let "tainted2 &= $TAINT_FAIL"
+		if [ "$tainted" != "$tainted2" ]
+		then
+			echo " Kernel taint changed from $tainted to $tainted2." >> $tmp.out
+			echo " See dmesg for details." >> $tmp.out
+		fi
+	fi
+
 	if [ -f core ]
 	then
 	    echo -n " [dumped core]"
diff --git a/common/config b/common/config
index 67c1498..6483ded 100644
--- a/common/config
+++ b/common/config
@@ -82,6 +82,15 @@ export PWD=`pwd`
 export MALLOCLIB=${MALLOCLIB:=/usr/lib/libefence.a}
 export LOCAL_CONFIGURE_OPTIONS=${LOCAL_CONFIGURE_OPTIONS:=--enable-readline=yes}
 
+# kernel taint values on Linux (from kernel.taint sysctl)
+TAINT_MACHINE_CHECK=16
+TAINT_BAD_PAGE=32
+TAINT_DIED=128
+TAINT_WARNING=512
+# If a test introduces one of these taints we consider it to have failed
+let "TAINT_FAIL=( $TAINT_MACHINE_CHECK | $TAINT_BAD_PAGE | $TAINT_DIED | $TAINT_WARNING )"
+export TAINT_FAIL
+
 # $1 = prog to look for, $2* = default pathnames if not found in $PATH
 set_prog_path()
 {

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  parent reply	other threads:[~2013-05-23 15:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-13 21:55 [PATCH, RFC] xfstests: fail test if it causes a kernel taint Eric Sandeen
2013-05-14  1:15 ` Dave Chinner
2013-05-14  2:00   ` Eric Sandeen
2013-05-14  3:15     ` Dave Chinner
2013-05-14  3:38       ` Eric Sandeen
2013-05-23 15:47 ` Eric Sandeen [this message]
2013-10-10  3:16   ` [PATCH, V2] " Eric Sandeen

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=519E3A20.7060102@sandeen.net \
    --to=sandeen@sandeen.net \
    --cc=sandeen@redhat.com \
    --cc=xfs@oss.sgi.com \
    /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