linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fstests: common: Allow user to keep $seqres.dmesg for all tests
@ 2019-11-29  4:57 Qu Wenruo
  2019-12-01 16:26 ` Eryu Guan
  0 siblings, 1 reply; 3+ messages in thread
From: Qu Wenruo @ 2019-11-29  4:57 UTC (permalink / raw)
  To: fstests, linux-btrfs

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread
* [PATCH] fstests: btrfs/157 btrfs/158: Prevent stripe offset to pollute golden output
@ 2019-12-11  2:22 Qu Wenruo
  2019-12-11  2:22 ` [PATCH] fstests: common: Allow user to keep $seqres.dmesg for all tests Qu Wenruo
  0 siblings, 1 reply; 3+ messages in thread
From: Qu Wenruo @ 2019-12-11  2:22 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Filipe Manana

Test btrfs/157 and btrfs/158 are verifying the repair functionality of
supported RAID profile, thus it needs to corrupt the fs data manually using
physical offset of data.

However that physical offset of data is dependent on chunk layout, which
is further dependent on mkfs, so such physical offset is never reliable.

And btrfs-progs commit c501c9e3b816 ("btrfs-progs: mkfs: match devid
order to the stripe index") changed the mkfs stripe layout, the golden
output no longer matches the output.

This patch will remove the physical offset from golden output,
especially since we already have those offsets output in seqres.full.

Reported-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 tests/btrfs/157     | 5 +++--
 tests/btrfs/157.out | 4 ----
 tests/btrfs/158     | 4 ++--
 tests/btrfs/158.out | 4 ----
 4 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/tests/btrfs/157 b/tests/btrfs/157
index 7f75c407..9895f1fd 100755
--- a/tests/btrfs/157
+++ b/tests/btrfs/157
@@ -90,8 +90,9 @@ dev3=`echo $SCRATCH_DEV_POOL | awk '{print $3}'`
 # step 2: corrupt the 1st and 2nd stripe (stripe 0 and 1)
 echo "step 2......simulate bitrot at offset $stripe_0 of device_4($dev4) and offset $stripe_1 of device_3($dev3)" >>$seqres.full
 
-$XFS_IO_PROG -f -d -c "pwrite -S 0xbb $stripe_0 64K" $dev4 | _filter_xfs_io
-$XFS_IO_PROG -f -d -c "pwrite -S 0xbb $stripe_1 64K" $dev3 | _filter_xfs_io
+# These stripe offset is mkfs dependent, don't pollute golden output
+$XFS_IO_PROG -f -d -c "pwrite -S 0xbb $stripe_0 64K" $dev4 > /dev/null
+$XFS_IO_PROG -f -d -c "pwrite -S 0xbb $stripe_1 64K" $dev3 > /dev/null
 
 # step 3: read foobar to repair the bitrot
 echo "step 3......repair the bitrot" >> $seqres.full
diff --git a/tests/btrfs/157.out b/tests/btrfs/157.out
index 08d592c4..d69c0f1d 100644
--- a/tests/btrfs/157.out
+++ b/tests/btrfs/157.out
@@ -1,10 +1,6 @@
 QA output created by 157
 wrote 131072/131072 bytes at offset 0
 XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-wrote 65536/65536 bytes at offset 9437184
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-wrote 65536/65536 bytes at offset 9437184
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 0200000 aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa
 *
 0400000
diff --git a/tests/btrfs/158 b/tests/btrfs/158
index 603e8bea..99ee7fb7 100755
--- a/tests/btrfs/158
+++ b/tests/btrfs/158
@@ -82,8 +82,8 @@ dev3=`echo $SCRATCH_DEV_POOL | awk '{print $3}'`
 # step 2: corrupt the 1st and 2nd stripe (stripe 0 and 1)
 echo "step 2......simulate bitrot at offset $stripe_0 of device_4($dev4) and offset $stripe_1 of device_3($dev3)" >>$seqres.full
 
-$XFS_IO_PROG -f -d -c "pwrite -S 0xbb $stripe_0 64K" $dev4 | _filter_xfs_io
-$XFS_IO_PROG -f -d -c "pwrite -S 0xbb $stripe_1 64K" $dev3 | _filter_xfs_io
+$XFS_IO_PROG -f -d -c "pwrite -S 0xbb $stripe_0 64K" $dev4 > /dev/null
+$XFS_IO_PROG -f -d -c "pwrite -S 0xbb $stripe_1 64K" $dev3 > /dev/null
 
 # step 3: scrub filesystem to repair the bitrot
 echo "step 3......repair the bitrot" >> $seqres.full
diff --git a/tests/btrfs/158.out b/tests/btrfs/158.out
index 1f5ad3f7..95562f49 100644
--- a/tests/btrfs/158.out
+++ b/tests/btrfs/158.out
@@ -1,10 +1,6 @@
 QA output created by 158
 wrote 131072/131072 bytes at offset 0
 XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-wrote 65536/65536 bytes at offset 9437184
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-wrote 65536/65536 bytes at offset 9437184
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 0000000 aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa
 *
 0400000
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-12-11  2:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-29  4:57 [PATCH] fstests: common: Allow user to keep $seqres.dmesg for all tests Qu Wenruo
2019-12-01 16:26 ` 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

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).