All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org, fstests@vger.kernel.org
Subject: [PATCH] fstests: btrfs/253: fix false alert due to _set_fs_sysfs_attr changes
Date: Sun, 20 Apr 2025 18:08:17 +0930	[thread overview]
Message-ID: <20250420083817.231610-1-wqu@suse.com> (raw)

[FALSE FAILURE]
Test btrfs/253 now fails like the following:

btrfs/253 2s ... - output mismatch (see ~/xfstests/results//btrfs/253.out.bad)
    --- tests/btrfs/253.out	2022-05-11 11:25:30.753333331 +0930
    +++ ~/xfstests/results//btrfs/253.out.bad	2025-04-20 17:28:39.139180394 +0930
    @@ -5,6 +5,7 @@
     Calculate request size so last memory allocation cannot be completely fullfilled.
     Third allocation.
     Force allocation of system block type must fail.
    +./common/rc: line 5213: echo: write error: No space left on device
     Verify first allocation.
     Verify second allocation.
     Verify third allocation.
    ...
    (Run 'diff -u ~/xfstests/tests/btrfs/253.out ~/xfstests/results//btrfs/253.out.bad'  to see the entire diff)

[CAUSE]
Since commit 0a9011ae6a36 ("fstests: common/rc: set_fs_sysfs_attr:
redirect errors to stdout") the function _set_fs_sysfs_attr() always
output everything into stdout, thus the stderr redirection makes no
sense anymore.

And the expected failure will cause output difference and fail the test.

[FIX]
Instead of the useless re-direct of stderr, save the stdout and check if
it contains the word "error" to determine if it failed.

Fixes: 0a9011ae6a36 ("fstests: common/rc: set_fs_sysfs_attr: redirect errors to stdout")
Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 tests/btrfs/253 | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tests/btrfs/253 b/tests/btrfs/253
index adbc6bfb..ad69dfe1 100755
--- a/tests/btrfs/253
+++ b/tests/btrfs/253
@@ -228,7 +228,12 @@ alloc_size "Data" FOURTH_DATA_SIZE_MB
 # Force chunk allocation of system block type must fail.
 #
 echo "Force allocation of system block type must fail."
-_set_fs_sysfs_attr ${SCRATCH_BDEV} allocation/system/force_chunk_alloc 1 2>/dev/null
+output=$(_set_fs_sysfs_attr ${SCRATCH_BDEV} allocation/system/force_chunk_alloc 1)
+
+if ! echo "$output" | grep -q "error" ; then
+	echo "Force allocation succeeded unexpectedly."
+	echo "$output" >> $seqres.full
+fi
 
 #
 # Verification of initial allocation.
-- 
2.47.1


             reply	other threads:[~2025-04-20  8:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-20  8:38 Qu Wenruo [this message]
2025-04-21  7:00 ` [PATCH] fstests: btrfs/253: fix false alert due to _set_fs_sysfs_attr changes Naohiro Aota
2025-04-21  7:57   ` Qu Wenruo

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=20250420083817.231610-1-wqu@suse.com \
    --to=wqu@suse.com \
    --cc=fstests@vger.kernel.org \
    --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.