diff mbox series

check: call _check_dmesg even if the test case failed

Message ID e8b3ba5973d9b24f33cbdbf99dc894f0ca656e02.1670976506.git.wqu@suse.com (mailing list archive)
State New, archived
Headers show
Series check: call _check_dmesg even if the test case failed | expand

Commit Message

Qu Wenruo Dec. 14, 2022, 12:08 a.m. UTC
[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(+)

Comments

David Disseldorp Dec. 14, 2022, 11:33 a.m. UTC | #1
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>
diff mbox series

Patch

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