linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] check: call _check_dmesg even if the test case failed
@ 2022-12-14  0:08 Qu Wenruo
  2022-12-14 11:33 ` David Disseldorp
  0 siblings, 1 reply; 2+ messages in thread
From: Qu Wenruo @ 2022-12-14  0:08 UTC (permalink / raw)
  To: linux-btrfs, fstests

[BUG]
When KEEP_DMESG=yes is specified, passed test cases will also keep their
$seqres.dmesg files.

However for failed test cases (caused by _fail calls), their dmesg files
are not saved at all:

 # rm -rf results/btrfs/219*
 # ./check btrfs/219
 # ls result/btrfs/219*
 results/btrfs/219.full  results/btrfs/219.out.bad

[CAUSE]
$seqres.dmesg is created (and later deleted depending on config) by
_check_dmesg() function.

But if a test case failed by calling _fail, then we no longer call
_check_dmesg(), thus no dmesg will be saved no matter whatever the
config is.

[FIX]
If the test case itself failed, then still call _check_dmesg() to either
save the dmesg unconditionally (KEEP_DMESG=yes case), or save the dmesg
if there is something wrong (default).

The dmesg can be pretty handy debug clue for both cases.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 check | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/check b/check
index d2e5129620bd..487da43537ad 100755
--- a/check
+++ b/check
@@ -950,6 +950,9 @@ function run_section()
 			_scratch_unmount 2> /dev/null
 			rm -f ${RESULT_DIR}/require_test*
 			rm -f ${RESULT_DIR}/require_scratch*
+			# Even we failed, there may be something interesting in
+			# dmesg which can help debugging.
+			_check_dmesg
 			tc_status="fail"
 		else
 			# The test apparently passed, so check for corruption
-- 
2.38.1


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

* Re: [PATCH] check: call _check_dmesg even if the test case failed
  2022-12-14  0:08 [PATCH] check: call _check_dmesg even if the test case failed Qu Wenruo
@ 2022-12-14 11:33 ` David Disseldorp
  0 siblings, 0 replies; 2+ messages in thread
From: David Disseldorp @ 2022-12-14 11:33 UTC (permalink / raw)
  To: Qu Wenruo; +Cc: linux-btrfs, fstests

Hi Qu,

On Wed, 14 Dec 2022 08:08:31 +0800, Qu Wenruo wrote:

...
> index d2e5129620bd..487da43537ad 100755
> --- a/check
> +++ b/check
> @@ -950,6 +950,9 @@ function run_section()
>  			_scratch_unmount 2> /dev/null
>  			rm -f ${RESULT_DIR}/require_test*
>  			rm -f ${RESULT_DIR}/require_scratch*
> +			# Even we failed, there may be something interesting in
> +			# dmesg which can help debugging.

Nit: "Even though we ...", although the comment is probably unnecessary.

> +			_check_dmesg
>  			tc_status="fail"
>  		else
>  			# The test apparently passed, so check for corruption

Makes sense.
Reviewed-by: David Disseldorp <ddiss@suse.de>

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

end of thread, other threads:[~2022-12-14 11:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-14  0:08 [PATCH] check: call _check_dmesg even if the test case failed Qu Wenruo
2022-12-14 11:33 ` David Disseldorp

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