Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: Naohiro Aota <naohiro.aota@wdc.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 1/3] btrfs-progs: tests: check nullb index for the error case
Date: Tue, 2 Sep 2025 18:41:25 +0930	[thread overview]
Message-ID: <ace116f9-3395-4d40-a8a0-d22ad6756191@suse.com> (raw)
In-Reply-To: <20250902042920.4039355-2-naohiro.aota@wdc.com>



在 2025/9/2 13:59, Naohiro Aota 写道:
> "_find_free_index" can return "ERROR: ...". Check the return value for the
> case and fail the test.
> 
> Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
> ---
>   tests/nullb | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/tests/nullb b/tests/nullb
> index 457ae0d8354a..bfc5640c4470 100755
> --- a/tests/nullb
> +++ b/tests/nullb
> @@ -146,6 +146,9 @@ fi
>   if [ "$CMD" = 'create' ]; then
>   	_check_setup
>   	index=$(_find_free_index)
> +	if [[ "$index" = ERROR* ]]; then
> +		_error "$index"
> +	fi

I think the bigger problem is that:

- _error() output into stdout instead of stderr

- the "exit 1" doesn't help in this case
   It will only kill the child bash, not the calling one.

So I'd prefer to make _error() to output the warning to stderr, so that 
index will be empty on error.

Thanks,
Qu

>   	name="nullb$index"
>   	# size in MB
>   	size=$(_parse_device_size "$@")


  reply	other threads:[~2025-09-02  9:11 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-02  4:29 [PATCH 0/3] btrfs-progs: tests: add new mkfs test for zoned device Naohiro Aota
2025-09-02  4:29 ` [PATCH 1/3] btrfs-progs: tests: check nullb index for the error case Naohiro Aota
2025-09-02  9:11   ` Qu Wenruo [this message]
2025-09-03  7:56     ` Naohiro Aota
2025-09-02  4:29 ` [PATCH 2/3] btrfs-progs: tests: add {,cond_}wait_for_nullbdevs Naohiro Aota
2025-09-02  9:15   ` Qu Wenruo
2025-09-03  7:42     ` Naohiro Aota
2025-09-02  4:29 ` [PATCH 3/3] btrfs-progs: tests: add new mkfs test for zoned device Naohiro Aota
2025-09-02  9:22   ` Qu Wenruo
2025-09-02  9:59   ` Johannes Thumshirn
2025-09-02 18:57     ` David Sterba
2025-09-03  7:45       ` Naohiro Aota

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=ace116f9-3395-4d40-a8a0-d22ad6756191@suse.com \
    --to=wqu@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=naohiro.aota@wdc.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