fstests: Allow user to keep $seqres.dmesg for all tests
authorQu Wenruo <wqu@suse.com>
Fri, 29 Nov 2019 04:57:43 +0000 (12:57 +0800)
committerEryu Guan <guaneryu@gmail.com>
Sun, 1 Dec 2019 15:13:03 +0000 (23:13 +0800)
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.

For example, 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 keep the dmesg by setting it to
"yes".

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

[Eryu: change it to a "yes"/"no" switch.]

Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
README
common/config
common/rc

diff --git a/README b/README
index 6e9aa34d9cfb0a0ab0406d2ddaec9482521986e1..593c105291fc5d7ce0e5dec5800055864cd754ea 100644 (file)
--- a/README
+++ b/README
@@ -101,6 +101,7 @@ Preparing system for tests:
                using nvme drives.
              - set USE_KMEMLEAK=yes to scan for memory leaks in the kernel
                after every test, if the kernel supports kmemleak.
+             - set KEEP_DMESG=yes to keep dmesg log after test
 
         - or add a case to the switch in common/config assigning
           these variables based on the hostname of your test
index 1b75777f39b6a34990992667a6feb7f6995887bb..9a9c77602b5405a220be52a9be0babf6a9704000 100644 (file)
@@ -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.
+#                   yes: keep all dmesg
+#                   no: 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
index e55352790a7b4d30859710d6cad85af77a5bb6a1..4688f2368ee0a5cecb3fcf272ae5f94b1299ece9 100644 (file)
--- 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" != "yes" ]; then
+                       rm -f $seqres.dmesg
+               fi
                return 0
        fi
 }