Skip to contentSkip to conversation

fstests: check dmesg after test

RFC PATCH New Eryu Guan 1 participant 4 messages Jan 15, 2015

lore
Share & tools
lore

Eryu Guan

author
#0 lore raw

cover fstests: check dmesg after test

This patchset adds dmesg check after each test.

The first patch is a backlog patch from Eric Sandeen, which adds log message of running to dmesg.

And the second patch takes use of this log to search for dmesg log of last test, without clearing dmesg buffer nor dumping all dmesg to a file, which can potentially eat all free space on testing host.

The third patch adds a function to disable this dmesg check, which can be called by tests that generate WARNINGs/etc. on purpose, so the tests won't fail _dmesg_check. But so far I haven't found any tests that need this function. (Some xfs tests like xfs/111 inject corruptions on purpose and log errors to dmesg, but _dmesg_check is unable to detect these xfs-specific failures now.)

Right now with 3.19.0-rc4+ kernel, xfs/279 and btrfs/017 fail this check, and btrfs/017 is a known issue, xfs/279 exposes an scsi bug

http://permalink.gmane.org/gmane.linux.scsi/98063

Thanks,
Eryu

Eric Sandeen (1):
check: log running test to dmesg

Eryu Guan (2):
check: check dmesg log after each test
common: add _disable_dmesg_check function

 check     | 33 +++++++++++++++++++++++++++++++++
 common/rc |  6 ++++++
 2 files changed, 39 insertions(+)
Signature · 1 line
2.1.0
author
#1 lore raw

PATCH 1/3 check: log running test to dmesg

From: Eric Sandeen <[email protected]>

We already log the running test to system logs via "logger" but viro pointed out that we can use /dev/kmsg to insert it into dmesg as well. When looking at the serial console that could be pretty useful.

Thanks to viro for the test -w suggestion too.

[Eryu Guan adds timestamp to dmesg too]

---
 check | 4 ++++
 1 file changed, 4 insertions(+)
check +4 -0
index 10f4a18..3d42a8b 100755
@@ -561,6 +561,10 @@ for section in $HOST_OPTIONS_SECTIONS; do
 		$timestamp && echo -n "	["`date "+%T"`"]"
 		[ ! -x $seq ] && chmod u+x $seq # ensure we can run it
 		$LOGGER_PROG "run xfstest $seqnum"
+		if [ -w /dev/kmsg ]; then
+			date_time=`date +"%F %T"`
+			echo "run fstests $seqnum at $date_time" > /dev/kmsg
+		fi
 		./$seq >$tmp.rawout 2>&1
 		sts=$?
 		$timestamp && _timestamp
Signature · 1 line
2.1.0
author
#2 lore raw

PATCH 2/3 check: check dmesg log after each test

In reply to Eryu Guan

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.

---
 check | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
check +29 -0
index 3d42a8b..0830e0c 100755
@@ -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
Signature · 1 line
2.1.0
author
#3 lore raw

PATCH 3/3 common: add _disable_dmesg_check function

In reply to Eryu Guan

Introduce _disable_dmesg_check function, which can be called by tests that generate WARNINGs etc. on purpose, so the tests won't fail _dmesg_check.

---
 common/rc | 6 ++++++
 1 file changed, 6 insertions(+)
common/rc +6 -0
index 5ce3322..edd22bf 100644
@@ -2805,6 +2805,12 @@ _get_device_size()
 	grep `_short_dev $1` /proc/partitions | awk '{print $3}'
 }
 
+# don't check dmesg log after test
+_disable_dmesg_check()
+{
+	rm -f ${RESULT_DIR}/check_dmesg
+}
+
 init_rc()
 {
 	if [ "$iam" == new ]
Signature · 1 line
2.1.0