linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: fstests@vger.kernel.org, linux-btrfs@vger.kernel.org
Subject: [PATCH] fstests: common: Allow user to keep $seqres.dmesg for all tests
Date: Fri, 29 Nov 2019 12:57:43 +0800	[thread overview]
Message-ID: <20191129045743.47105-1-wqu@suse.com> (raw)

Currently fstests will remove $seqres.dmesg if nothing wrong happened.
It saves some space, but sometimes it may not provide good enough
history for developers to check.
E.g. some unexpected dmesg from fs, but not serious enough to be caught
by current filter.

So instead of deleting the ordinary $seqres.dmesg, provide a new config:
KEEP_DMESG, to allow user to choose whether to keep the dmesg.

The default value for it is 0, which keeps the existing behavior by
deleting ordinary dmesg.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 common/config | 4 ++++
 common/rc     | 4 +++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/common/config b/common/config
index 1b75777f..b409f32c 100644
--- a/common/config
+++ b/common/config
@@ -22,6 +22,9 @@
 # RMT_IRIXTAPE_DEV- the IRIX remote tape device for the xfsdump tests
 # RMT_TAPE_USER -   remote user for tape device
 # SELINUX_MOUNT_OPTIONS - Options to use when SELinux is enabled.
+# KEEP_DMESG -      whether to keep all dmesg for each test case.
+#                   1: keep all dmesg
+#                   0: only keep dmesg with error/warning (default)
 #
 # - These can be added to $HOST_CONFIG_DIR (witch default to ./config)
 #   below or a separate local configuration file can be used (using
@@ -757,6 +760,7 @@ if [ -z "$CONFIG_INCLUDED" ]; then
 	[ -z "$TEST_FS_MOUNT_OPTS" ] && _test_mount_opts
 	[ -z "$MKFS_OPTIONS" ] && _mkfs_opts
 	[ -z "$FSCK_OPTIONS" ] && _fsck_opts
+	[ -z "$KEEP_DMESG" ] && export KEEP_DMESG=0
 else
 	# We get here for the non multi section case, on every test that sources
 	# common/rc after re-sourcing the HOST_OPTIONS config file.
diff --git a/common/rc b/common/rc
index e5535279..a1386f61 100644
--- a/common/rc
+++ b/common/rc
@@ -3634,7 +3634,9 @@ _check_dmesg()
 		_dump_err "_check_dmesg: something found in dmesg (see $seqres.dmesg)"
 		return 1
 	else
-		rm -f $seqres.dmesg
+		if [ "$KEEP_DMESG" != 1 ]; then
+			rm -f $seqres.dmesg
+		fi
 		return 0
 	fi
 }
-- 
2.23.0


             reply	other threads:[~2019-11-29  4:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-29  4:57 Qu Wenruo [this message]
2019-12-01 16:26 ` [PATCH] fstests: common: Allow user to keep $seqres.dmesg for all tests Eryu Guan
2019-12-11  2:22 [PATCH] fstests: btrfs/157 btrfs/158: Prevent stripe offset to pollute golden output Qu Wenruo
2019-12-11  2:22 ` [PATCH] fstests: common: Allow user to keep $seqres.dmesg for all tests Qu Wenruo

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=20191129045743.47105-1-wqu@suse.com \
    --to=wqu@suse.com \
    --cc=fstests@vger.kernel.org \
    --cc=linux-btrfs@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;
as well as URLs for NNTP newsgroup(s).