diff mbox series

fstests: btrfs/053: use "-n" to replace the deprecated "-l" mkfs option

Message ID 20221113015323.38789-1-wqu@suse.com (mailing list archive)
State New, archived
Headers show
Series fstests: btrfs/053: use "-n" to replace the deprecated "-l" mkfs option | expand

Commit Message

Qu Wenruo Nov. 13, 2022, 1:53 a.m. UTC
[BUG]
Test case btrfs/053 will fail if using newer btrfs-progs with the extra
error output:

    mount: /mnt/scratch: wrong fs type, bad option, bad superblock on /dev/mapper/test-scratch1, missing codepage or helper program, or other error.
           dmesg(1) may have more information after failed mount system call.
    mount /dev/mapper/test-scratch1 /mnt/scratch failed

[CAUSE]
The option "-l"/"--leafsize" is already marked deprecated since
btrfs-progs v4.0, and finally in btrfs-progs v6.0 we removes the support
for such deprecated option completely.

But unfortunately the test case is still using the old option.

[FIX]
Fix and improve the test case by:

- Use "-n" to replace the "-l" option

- Rename "leaf_size" variable to "node_size"

- Save the output of _scratch_mkfs to $seqres.full
  This would save quite some time if it later failed due to some other
  reasons in mkfs.btrfs.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 tests/btrfs/053 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Filipe Manana Nov. 14, 2022, 10:33 a.m. UTC | #1
On Sun, Nov 13, 2022 at 2:11 AM Qu Wenruo <wqu@suse.com> wrote:
>
> [BUG]
> Test case btrfs/053 will fail if using newer btrfs-progs with the extra
> error output:
>
>     mount: /mnt/scratch: wrong fs type, bad option, bad superblock on /dev/mapper/test-scratch1, missing codepage or helper program, or other error.
>            dmesg(1) may have more information after failed mount system call.
>     mount /dev/mapper/test-scratch1 /mnt/scratch failed
>
> [CAUSE]
> The option "-l"/"--leafsize" is already marked deprecated since
> btrfs-progs v4.0, and finally in btrfs-progs v6.0 we removes the support
> for such deprecated option completely.
>
> But unfortunately the test case is still using the old option.
>
> [FIX]
> Fix and improve the test case by:
>
> - Use "-n" to replace the "-l" option
>
> - Rename "leaf_size" variable to "node_size"
>
> - Save the output of _scratch_mkfs to $seqres.full
>   This would save quite some time if it later failed due to some other
>   reasons in mkfs.btrfs.
>
> Signed-off-by: Qu Wenruo <wqu@suse.com>
> ---
>  tests/btrfs/053 | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

I had already sent a fix for this last week:

https://lore.kernel.org/fstests/793a063833727ea80a1d0c6f13f531cff9581a1a.1668011940.git.fdmanana@suse.com/

Thanks.

>
> diff --git a/tests/btrfs/053 b/tests/btrfs/053
> index fbd2e7d9..006ea0e6 100755
> --- a/tests/btrfs/053
> +++ b/tests/btrfs/053
> @@ -37,14 +37,14 @@ _require_attrs
>  # max(16384, PAGE_SIZE) is the default leaf/node size on btrfs-progs v3.12+.
>  # Older versions just use max(4096, PAGE_SIZE).
>  # mkfs.btrfs can't create an fs with a leaf/node size smaller than PAGE_SIZE.
> -leaf_size=$(echo -e "16384\n`getconf PAGE_SIZE`" | sort -nr | head -1)
> +node_size=$(echo -e "16384\n`getconf PAGE_SIZE`" | sort -nr | head -1)
>
>  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 "-n $node_size" >> $seqres.full 2>&1
>  _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 "-n $node_size" >> $seqres.full 2>&1
>  _scratch_mount
>
>  _run_btrfs_util_prog receive -f $send_files_dir/1.snap $SCRATCH_MNT
> --
> 2.38.0
>
diff mbox series

Patch

diff --git a/tests/btrfs/053 b/tests/btrfs/053
index fbd2e7d9..006ea0e6 100755
--- a/tests/btrfs/053
+++ b/tests/btrfs/053
@@ -37,14 +37,14 @@  _require_attrs
 # max(16384, PAGE_SIZE) is the default leaf/node size on btrfs-progs v3.12+.
 # Older versions just use max(4096, PAGE_SIZE).
 # mkfs.btrfs can't create an fs with a leaf/node size smaller than PAGE_SIZE.
-leaf_size=$(echo -e "16384\n`getconf PAGE_SIZE`" | sort -nr | head -1)
+node_size=$(echo -e "16384\n`getconf PAGE_SIZE`" | sort -nr | head -1)
 
 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 "-n $node_size" >> $seqres.full 2>&1
 _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 "-n $node_size" >> $seqres.full 2>&1
 _scratch_mount
 
 _run_btrfs_util_prog receive -f $send_files_dir/1.snap $SCRATCH_MNT