在 2024/10/3 00:58, fdmanana@xxxxxxxxxx 写道:
From: Filipe Manana <fdmanana@xxxxxxxx> In btrfs-progs v6.11 the output of the "filesystem show" command changed so that it no longers prints blank lines. This happened with commit 4331bfb011bd ("btrfs-progs: fi show: remove stray newline in filesystem show"). We have some tests that expect the blank lines in their golden output, and therefore they fail with btrfs-progs v6.11. So update the filter _filter_btrfs_filesystem_show to remove blank lines and change the golden output of the tests to not expect the blank lines, making the tests work with btrfs-progs v6.11 and older versions. Signed-off-by: Filipe Manana <fdmanana@xxxxxxxx>
Reviewed-by: Qu Wenruo <wqu@xxxxxxxx> Thanks, Qu
--- common/filter.btrfs | 5 ++++- tests/btrfs/100.out | 2 -- tests/btrfs/218.out | 1 - tests/btrfs/254.out | 1 - 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/common/filter.btrfs b/common/filter.btrfs index 5a944aeb..6c53dffe 100644 --- a/common/filter.btrfs +++ b/common/filter.btrfs @@ -30,11 +30,14 @@ _filter_btrfs_filesystem_show() UUID=$2 fi - # the uniq collapses all device lines into 1 + # Before btrfs-progs v6.11 we had some blank lines in the output, so + # delete them. + # The uniq collapses all device lines into 1. _filter_uuid $UUID | _filter_scratch | _filter_scratch_pool | \ _filter_size | _filter_btrfs_version | _filter_devid | \ _filter_zero_size | \ sed -e "s/\(Total devices\) $NUMDEVS/\1 $NUM_SUBST/g" | \ + sed -e "/^\s*$/d" | \ uniq > $tmp.btrfs_filesystem_show # The first two lines are Label/UUID and total devices diff --git a/tests/btrfs/100.out b/tests/btrfs/100.out index aa492919..1fe3c0de 100644 --- a/tests/btrfs/100.out +++ b/tests/btrfs/100.out @@ -3,9 +3,7 @@ Label: none uuid: <UUID> Total devices <NUM> FS bytes used <SIZE> devid <DEVID> size <SIZE> used <SIZE> path SCRATCH_DEV devid <DEVID> size <SIZE> used <SIZE> path /dev/mapper/error-test - Label: none uuid: <UUID> Total devices <NUM> FS bytes used <SIZE> devid <DEVID> size <SIZE> used <SIZE> path SCRATCH_DEV - === device replace completed diff --git a/tests/btrfs/218.out b/tests/btrfs/218.out index 7ccf13e9..be11074c 100644 --- a/tests/btrfs/218.out +++ b/tests/btrfs/218.out @@ -2,7 +2,6 @@ QA output created by 218 Label: none uuid: <UUID> Total devices <NUM> FS bytes used <SIZE> devid <DEVID> size <SIZE> used <SIZE> path SCRATCH_DEV - [SCRATCH_DEV].write_io_errs 0 [SCRATCH_DEV].read_io_errs 0 [SCRATCH_DEV].flush_io_errs 0 diff --git a/tests/btrfs/254.out b/tests/btrfs/254.out index 20819cf5..86089ee3 100644 --- a/tests/btrfs/254.out +++ b/tests/btrfs/254.out @@ -3,4 +3,3 @@ Label: none uuid: <UUID> Total devices <NUM> FS bytes used <SIZE> devid <DEVID> size <SIZE> used <SIZE> path SCRATCH_DEV *** Some devices missing -