diff mbox series

[v2,1/3] btrfs/003: fix failure on new btrfs-progs versions

Message ID 62ef22111c9cb654e6e5e50f7337105b9ef804d7.1668011769.git.fdmanana@suse.com (mailing list archive)
State New, archived
Headers show
Series btrfs: fix some test failures with btrfs-progs 5.19 and 6.0 | expand

Commit Message

Filipe Manana Nov. 9, 2022, 4:44 p.m. UTC
From: Filipe Manana <fdmanana@suse.com>

Starting with btrfs-progs version 5.19, the output of 'filesystem show'
command changed when we have a missing device. The old output was like the
following:

    Label: none  uuid: 139ef309-021f-4b98-a3a8-ce230a83b1e2
            Total devices 2 FS bytes used 128.00KiB
            devid    1 size 5.00GiB used 1.26GiB path /dev/loop0
            *** Some devices missing

While the new output (btrfs-progs 5.19+) is like the following:

    Label: none  uuid: 4a85a40b-9b79-4bde-8e52-c65a550a176b
            Total devices 2 FS bytes used 128.00KiB
            devid    1 size 5.00GiB used 1.26GiB path /dev/loop0
            devid    2 size 0 used 0 path /dev/loop1 MISSING

More specifically it happened in the following btrfs-progs commit:

    957a79c9b016 ("btrfs-progs: fi show: print missing device for a mounted file system")

This is making btrfs/003 fail with btrfs-progs 5.19+. Update the grep
filter in btrfs/003 so that it works with both output formats.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 tests/btrfs/003 | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Qu Wenruo Nov. 14, 2022, 11:19 a.m. UTC | #1
On 2022/11/10 00:44, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
> 
> Starting with btrfs-progs version 5.19, the output of 'filesystem show'
> command changed when we have a missing device. The old output was like the
> following:
> 
>      Label: none  uuid: 139ef309-021f-4b98-a3a8-ce230a83b1e2
>              Total devices 2 FS bytes used 128.00KiB
>              devid    1 size 5.00GiB used 1.26GiB path /dev/loop0
>              *** Some devices missing
> 
> While the new output (btrfs-progs 5.19+) is like the following:
> 
>      Label: none  uuid: 4a85a40b-9b79-4bde-8e52-c65a550a176b
>              Total devices 2 FS bytes used 128.00KiB
>              devid    1 size 5.00GiB used 1.26GiB path /dev/loop0
>              devid    2 size 0 used 0 path /dev/loop1 MISSING
> 
> More specifically it happened in the following btrfs-progs commit:
> 
>      957a79c9b016 ("btrfs-progs: fi show: print missing device for a mounted file system")
> 
> This is making btrfs/003 fail with btrfs-progs 5.19+. Update the grep
> filter in btrfs/003 so that it works with both output formats.
> 
> Signed-off-by: Filipe Manana <fdmanana@suse.com>

Reviewed-by: Qu Wenruo <wqu@suse.com>

After more digging, it shows that the test case itself will skip 
non-deletable disks, thus it doesn't cover my LVM based test environment 
at all.

Thanks,
Qu

> ---
>   tests/btrfs/003 | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/btrfs/003 b/tests/btrfs/003
> index cf605730..fae6d9d1 100755
> --- a/tests/btrfs/003
> +++ b/tests/btrfs/003
> @@ -141,8 +141,9 @@ _test_replace()
>   	_devmgt_remove ${removed_dev_htl} $ds
>   	dev_removed=1
>   
> -	$BTRFS_UTIL_PROG filesystem show $SCRATCH_DEV | grep "Some devices missing" >> $seqres.full || _fail \
> -							"btrfs did not report device missing"
> +	$BTRFS_UTIL_PROG filesystem show $SCRATCH_DEV | \
> +		grep -ie '\bmissing\b' >> $seqres.full || \
> +		_fail "btrfs did not report device missing"
>   
>   	# add a new disk to btrfs
>   	ds=${devs[@]:$(($n)):1}
diff mbox series

Patch

diff --git a/tests/btrfs/003 b/tests/btrfs/003
index cf605730..fae6d9d1 100755
--- a/tests/btrfs/003
+++ b/tests/btrfs/003
@@ -141,8 +141,9 @@  _test_replace()
 	_devmgt_remove ${removed_dev_htl} $ds
 	dev_removed=1
 
-	$BTRFS_UTIL_PROG filesystem show $SCRATCH_DEV | grep "Some devices missing" >> $seqres.full || _fail \
-							"btrfs did not report device missing"
+	$BTRFS_UTIL_PROG filesystem show $SCRATCH_DEV | \
+		grep -ie '\bmissing\b' >> $seqres.full || \
+		_fail "btrfs did not report device missing"
 
 	# add a new disk to btrfs
 	ds=${devs[@]:$(($n)):1}