All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 1/3] btrfs-progs: tests: also check subpage warning for type 2 test cases
Date: Wed, 18 Aug 2021 14:44:18 +0800	[thread overview]
Message-ID: <20210818064420.866803-2-wqu@suse.com> (raw)
In-Reply-To: <20210818064420.866803-1-wqu@suse.com>

There are two types of test cases:

- Type 1 (without test.sh)
- Type 2 (test.sh, mostly will override check_image())

For Type 2 tests, we check subpage related warnings of btrfs-check, but
didn't check it for Type 1 test cases.

In fact, Type 1 test cases are more important, as they involve repair,
which can generate new tree blocks, and we want to make sure such new
tree blocks won't cause subpage related warnings.

This patch will add the extra check for Type 1 test cases.

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"
 }
 
 # Extract a usable image from packed formats
-- 
2.32.0


  reply	other threads:[~2021-08-18  6:44 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 ` Qu Wenruo [this message]
2021-08-18 18:12   ` [PATCH 1/3] btrfs-progs: tests: also check subpage warning for type 2 test cases David Sterba
2021-08-20 12:42   ` David Sterba
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=20210818064420.866803-2-wqu@suse.com \
    --to=wqu@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.