xfstests: fail test if it causes a kernel taint
RFC PATCH 1/1 xfstests: fail test if it causes a kernel taint
This should, in theory, 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.
---
check +18 -0
@@ -446,6 +445,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
@@ -507,6 +511,19 @@ do "entire diff)" err=true fi + + # See if this run tainted the kernel due to oops, etc + 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." + echo " See dmesg for details." + err=true + fi + fi fi fi
common/config +9 -0
@@ -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
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 6 lines · Eric Sandeen
This should, in theory, 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 <[email protected]>
I like the idea - it should catch lockdep failures and other such problems.
Quoted 24 lines
---
check +7
-0@@ -446,6 +445,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@@ -507,6 +511,19 @@ do "entire diff)" err=true fi + + # See if this run tainted the kernel due to oops, etc
check do · line 525
Quoted 10 lines
check +10
-0+ 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." + echo " See dmesg for details." + err=true + fi
Should we dump the last 100 lines of dmesg into the output file here? And then rely on the golden image match failing to fail the test?
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Quoted 41 lines · Dave Chinner
Quoted 6 lines · Eric Sandeen
This should, in theory, 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 <[email protected]>I like the idea - it should catch lockdep failures and other such problems.
Quoted 30 lines
---
check +13
-0@@ -446,6 +445,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@@ -507,6 +511,19 @@ do "entire diff)" err=true fi + + # See if this run tainted the kernel due to oops, etc + if [ "$HOSTOS" == "Linux" ] + then + tainted2=`sysctl -n kernel.tainted` + let "tainted2 &= $TAINT_FAIL" + if [ "$tainted" != "$tainted2" ] + then
Quoted 8 lines
check do · line 525
Quoted 4 lines
check +4
-0+ echo " Kernel taint changed from $tainted to $tainted2." + echo " See dmesg for details." + err=true + fiShould we dump the last 100 lines of dmesg into the output file here? And then rely on the golden image match failing to fail the test?
Or into $seq.full . . I dunno. It's hard to know how much dmesg you'd need to get the right bits.
Dumping all of it into $seq.full might be best; it only trips when it's a new taint, so won't fire for every test.
-Eric
Quoted 4 lines
Cheers,
Dave.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 51 lines · Eric Sandeen
Quoted 41 lines · Dave Chinner
Quoted 6 lines · Eric Sandeen
This should, in theory, 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 <[email protected]>I like the idea - it should catch lockdep failures and other such problems.
Quoted 30 lines
---
check +13
-0@@ -446,6 +445,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@@ -507,6 +511,19 @@ do "entire diff)" err=true fi + + # See if this run tainted the kernel due to oops, etc + if [ "$HOSTOS" == "Linux" ] + then + tainted2=`sysctl -n kernel.tainted` + let "tainted2 &= $TAINT_FAIL" + if [ "$tainted" != "$tainted2" ] + thenQuoted 8 lines
check do · line 525
Quoted 4 lines
check +4
-0+ echo " Kernel taint changed from $tainted to $tainted2." + echo " See dmesg for details." + err=true + fiShould we dump the last 100 lines of dmesg into the output file here? And then rely on the golden image match failing to fail the test?
Quoted 4 lines
Or into $seq.full . . I dunno. It's hard to know how much dmesg you'd need to get the right bits.
Dumping all of it into $seq.full might be best; it only trips when it's a new taint, so won't fire for every test.
Only problem with $seqres.full is that it is internal to the test and so many tests will not remove one that is there before the test starts. Hence you'll get growing files the never get removed from repeated failures. Even just dumping the above error message into the output file would be sufficient, I think, as the 10 line diff output will state it pretty clearly as the first difference....
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Quoted 54 lines · Dave Chinner
Quoted 53 lines · Eric Sandeen
Quoted 41 lines · Dave Chinner
Quoted 6 lines · Eric Sandeen
This should, in theory, 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 <[email protected]>I like the idea - it should catch lockdep failures and other such problems.
Quoted 30 lines
---
check +13
-0@@ -446,6 +445,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@@ -507,6 +511,19 @@ do "entire diff)" err=true fi + + # See if this run tainted the kernel due to oops, etc + if [ "$HOSTOS" == "Linux" ] + then + tainted2=`sysctl -n kernel.tainted` + let "tainted2 &= $TAINT_FAIL" + if [ "$tainted" != "$tainted2" ] + thenQuoted 8 lines
check do · line 525
Quoted 4 lines
check +4
-0+ echo " Kernel taint changed from $tainted to $tainted2." + echo " See dmesg for details." + err=true + fiShould we dump the last 100 lines of dmesg into the output file here? And then rely on the golden image match failing to fail the test?
Or into $seq.full . . I dunno. It's hard to know how much dmesg you'd need to get the right bits.
Quoted 7 lines
Quoted 2 lines
Dumping all of it into $seq.full might be best; it only trips when it's a new taint, so won't fire for every test.
Only problem with $seqres.full is that it is internal to the test and so many tests will not remove one that is there before the test starts. Hence you'll get growing files the never get removed from repeated failures.
Oh, I see what you mean, yeah.
Quoted 3 lines
Even just dumping the above error message into
the output file would be sufficient, I think, as the 10 line diff output will state it pretty clearly as the first difference....
*shrug* I don't see the advantage of failing the test explicitly vs. breaking it via output, but if you like that better I don't really mind, I can change it to do that.
-Eric
Quoted 4 lines
Cheers,
Dave.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH v2 1/1 xfstests: fail test if it causes a kernel taint
In reply to Eric SandeenThis 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.
---
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.
check +18 -0
@@ -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]"
common/config +9 -0
@@ -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
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 5 lines · Eric Sandeen
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.
Quoted 8 lines
Signed-off-by Eric Sandeen <[email protected]>---
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.
Ping, needs re-review for V2 I guess.
Thanks,
-Eric
Quoted 57 lines
check +18
-0@@ -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]"common/config +9
-0@@ -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() {
Quoted 5 lines
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
This one got lost in the mists of time, seems like maybe still a good idea?
Quoted 76 lines · Eric Sandeen
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 <[email protected]>---
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.
check +18
-0@@ -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]"common/config +9
-0@@ -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
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Hi Eric,
Quoted 1 line · Eric Sandeen
This one got lost in the mists of time, seems like maybe still a good idea?
I took a look and tried this patch (with some tweaks to make it apply), then realized that _check_dmesg could do most of the work now, please see below. Please correct me if I missed anything :)
Quoted 60 lines · Eric Sandeen
Quoted 58 lines
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 <[email protected]>---
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.
check +18
-0@@ -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]"common/config +0
-0@@ -82,6 +82,15 @@ export PWD=`pwd` export MALLOCLIB=${MALLOCLIB:=/usr/lib/libefence.a} export LOCAL_CONFIGURE_OPTIONS=${LOCAL_CONFIGURE_OPTIONS:=--enable-readline=yes}
Quoted 2 lines
common/config export PWD=`pwd` · line 86
Quoted 2 lines
common/config +2
-0+# kernel taint values on Linux (from kernel.taint sysctl) +TAINT_MACHINE_CHECK=16
_check_dmesg couldn't detect machine check exception now, but I think this can be done easily by adding "Machine Check Exception" to _check_dmesg check list.
Quoted 1 line
common/config export PWD=`pwd` · line 87
Quoted 1 line
common/config +1
-0+TAINT_BAD_PAGE=32
Bad page message goes with a "BUG:" prefix, so _check_dmesg could find this error.
Quoted 1 line
common/config export PWD=`pwd` · line 88
Quoted 1 line
common/config +1
-0+TAINT_DIED=128
'D' means "if the kernel has died recently, i.e. there was an OOPS or BUG.", _check_dmesg could find these messages too.
Quoted 1 line
common/config export PWD=`pwd` · line 89
Quoted 1 line
common/config +1
-0+TAINT_WARNING=512
_check_dmesg could detect WARNING too, also it has the advantage that test won't fail if the warning is expected or filtered out intentionally, e.g. the warnings triggered by generic/095 on XFS because of mixed direct and buffered I/O.
Thanks,
Eryu
Quoted 17 lines
Quoted 8 lines
common/config +4
-0+# 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() {Quoted 5 lines
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs--
To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html