linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 1/3] btrfs-progs: tests: also check subpage warning for type 2 test cases
Date: Fri, 20 Aug 2021 14:42:25 +0200	[thread overview]
Message-ID: <20210820124225.GQ5047@twin.jikos.cz> (raw)
In-Reply-To: <20210818064420.866803-2-wqu@suse.com>

On Wed, Aug 18, 2021 at 02:44:18PM +0800, Qu Wenruo wrote:
> 
> And it will make sure the subpage related warnings are really from this
> test case, to prevent false alerts.
> 
> Signed-off-by: Qu Wenruo <wqu@suse.com>
> ---
>  tests/common | 14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/common b/tests/common
> index 805a447c84ce..a6f75c7ce237 100644
> --- a/tests/common
> +++ b/tests/common
> @@ -423,13 +423,23 @@ check_image()
>  {
>  	local image
>  
> +	tmp_output=$(mktemp --tmpdir btrfs-progs-test-check-image.XXXXXX)
> +
>  	image=$1
>  	echo "testing image $(basename $image)" >> "$RESULTS"
> -	"$TOP/btrfs" check "$image" >> "$RESULTS" 2>&1
> +	"$TOP/btrfs" check "$image" &> "$tmp_output"
>  	[ $? -eq 0 ] && _fail "btrfs check should have detected corruption"
>  
> +	cat "$tmp_output" >> "$RESULTS"
> +	# Also make sure no subpage related warnings
> +	check_test_results "$tmp_output" "$testname"
> +
>  	run_check "$TOP/btrfs" check --repair --force "$image"
> -	run_check "$TOP/btrfs" check "$image"
> +	run_check_stdout "$TOP/btrfs" check "$image" &> "$tmp_output"
> +
> +	# Also make sure no subpage related warnings for the repaired image
> +	check_test_results "$tmp_output" "$testname"
> +	rm -f "$tmp_output"
>  }

Applied with the following fixup

--- a/tests/common
+++ b/tests/common
@@ -422,15 +422,17 @@ check_dm_target_support()
 check_image()
 {
        local image
+       local tmp_output
 
        tmp_output=$(mktemp --tmpdir btrfs-progs-test-check-image.XXXXXX)
 
        image=$1
        echo "testing image $(basename $image)" >> "$RESULTS"
        "$TOP/btrfs" check "$image" &> "$tmp_output"
-       [ $? -eq 0 ] && _fail "btrfs check should have detected corruption"
-
+       ret=$?
        cat "$tmp_output" >> "$RESULTS"
+       [ "$ret" -eq 0 ] && _fail "btrfs check should have detected corruption"
+
        # Also make sure no subpage related warnings
        check_test_results "$tmp_output" "$testname"
 
@@ -439,7 +441,7 @@ check_image()
 
        # Also make sure no subpage related warnings for the repaired image
        check_test_results "$tmp_output" "$testname"
-       rm -f "$tmp_output"
+       rm -f -- "$tmp_output"
 }
 
 # Extract a usable image from packed formats

  parent reply	other threads:[~2021-08-20 12:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-18  6:44 [PATCH 0/3] btrfs-progs: make subpage warnings more strict Qu Wenruo
2021-08-18  6:44 ` [PATCH 1/3] btrfs-progs: tests: also check subpage warning for type 2 test cases Qu Wenruo
2021-08-18 18:12   ` David Sterba
2021-08-20 12:42   ` David Sterba [this message]
2021-08-18  6:44 ` [PATCH 2/3] btrfs-progs: tests: don't check subpage related warnings for fsck type 1 tests Qu Wenruo
2021-08-18  6:44 ` [PATCH 3/3] btrfs-progs: require full nodesize alignement for subpage support Qu Wenruo
2021-08-20 12:46 ` [PATCH 0/3] btrfs-progs: make subpage warnings more strict David Sterba

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=20210820124225.GQ5047@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=wqu@suse.com \
    /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).