Re: [PATCH 2/3] btrfs/053: fix test failure when running with btrfs-progs v6.0+

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



On Wed, Nov 09, 2022 at 11:43:35AM +0000, fdmanana@xxxxxxxxxx wrote:
> From: Filipe Manana <fdmanana@xxxxxxxx>
> 
> In btrfs-progs v6.0 the --leafsize (-l) command line option was removed,
> so btrfs/053 always fails with v6.0+.
> 
> The change was introduced by the following btrfs-progs commit:
> 
>   f7a768d62498 ("btrfs-progs: mkfs: remove support for option --leafsize")
> 
> Change the test to use --nodesize (-n) instead, since it exists in both
> old and new btrfs-progs versions.
> 
> Signed-off-by: Filipe Manana <fdmanana@xxxxxxxx>
> ---
>  tests/btrfs/053 | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/btrfs/053 b/tests/btrfs/053
> index fbd2e7d9..c0446257 100755
> --- a/tests/btrfs/053
> +++ b/tests/btrfs/053
> @@ -44,7 +44,7 @@ send_files_dir=$TEST_DIR/btrfs-test-$seq
>  rm -fr $send_files_dir
>  mkdir $send_files_dir
>  
> -_scratch_mkfs "-l $leaf_size" >/dev/null 2>&1
> +_scratch_mkfs "--nodesize $leaf_size" >/dev/null 2>&1

We you said this case starts to fail on btrfs-progs v6.0, I'm wondering how it
fail (I don't doubt it fails), at least not fails at here right?

Actually I recommend mkfs output to .full file at here, especially when you use
specified mkfs options to _scratch_mkfs helper. That really might fail, and
the case might keep running (with old fs on SCRATCH_DEV), and we hard to notice
that if no message output and no return value checking.

The _scratch_mkfs doesn't _fail if it fails, it just return nonzero and output
error message. So generally I recommend writting likes this (or other proper way
which can detect mkfs failure):

  _scratch_mkfs "--nodesize $leaf_size" >>$seqres.full 2>&1 || _fail "mkfs failed"

especially if there's specified mkfs options.

Thanks,
Zorro

>  _scratch_mount
>  
>  echo "hello world" > $SCRATCH_MNT/foobar
> @@ -72,7 +72,7 @@ _run_btrfs_util_prog send -p $SCRATCH_MNT/mysnap1 -f $send_files_dir/2.snap \
>  _scratch_unmount
>  _check_scratch_fs
>  
> -_scratch_mkfs "-l $leaf_size" >/dev/null 2>&1
> +_scratch_mkfs "--nodesize $leaf_size" >/dev/null 2>&1
>  _scratch_mount
>  
>  _run_btrfs_util_prog receive -f $send_files_dir/1.snap $SCRATCH_MNT
> -- 
> 2.35.1
> 




[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux