diff mbox series

[v1.1,3/3] xfs/533: fix false negatives for this test

Message ID YuvzSdINZZ3PV20q@magnolia (mailing list archive)
State New, archived
Headers show
Series None | expand

Commit Message

Darrick J. Wong Aug. 4, 2022, 4:26 p.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

xfsprogs 5.19 will change the error message that gets printed when the
primary superblock validation fails.  Filter the _get_metadata_field
output so that the new message looks like the old message.

While we're at it, _notrun this test on V4 filesystems because the
validation messages are in the V5 superblock validation functions.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 tests/xfs/533 |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

Yang Xu (Fujitsu) Aug. 5, 2022, 1:38 a.m. UTC | #1
on 2022/08/05 0:26, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> xfsprogs 5.19 will change the error message that gets printed when the
> primary superblock validation fails.  Filter the _get_metadata_field
> output so that the new message looks like the old message.
> 
> While we're at it, _notrun this test on V4 filesystems because the
> validation messages are in the V5 superblock validation functions.

LGTM,
Reviewed-by: Yang Xu <xuyang2018.jy@fujitsu.com>

Best Regards
Yang Xu
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
>   tests/xfs/533 |   10 ++++++++--
>   1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/xfs/533 b/tests/xfs/533
> index afbdadac..31858cc9 100755
> --- a/tests/xfs/533
> +++ b/tests/xfs/533
> @@ -21,13 +21,19 @@ _fixed_by_git_commit xfsprogs f4afdcb0ad11 \
>   #skip fs check because invalid superblock 1
>   _require_scratch_nocheck
>   
> +# The error messages in the golden output come from the V5 superblock verifier
> +# routines, so ignore V4 filesystems.
> +_require_scratch_xfs_crc
> +
>   _scratch_mkfs_xfs >>$seqres.full 2>&1
>   
>   # write the bad magicnum field value(0) to the superblock 1
>   _scratch_xfs_set_metadata_field "magicnum" "0" "sb 1"
>   
> -#Even magicnum field has been corrupted, we still can read this field value
> -_scratch_xfs_get_metadata_field "magicnum" "sb 1"
> +# Even magicnum field has been corrupted, we still can read this field value.
> +# The error message changed in xfsprogs 5.19.
> +_scratch_xfs_get_metadata_field "magicnum" "sb 1" 2>&1 | \
> +	sed -e 's/Superblock has bad magic number 0x0. Not an XFS filesystem?/bad magic number/g'
>   
>   # success, all done
>   status=0
diff mbox series

Patch

diff --git a/tests/xfs/533 b/tests/xfs/533
index afbdadac..31858cc9 100755
--- a/tests/xfs/533
+++ b/tests/xfs/533
@@ -21,13 +21,19 @@  _fixed_by_git_commit xfsprogs f4afdcb0ad11 \
 #skip fs check because invalid superblock 1
 _require_scratch_nocheck
 
+# The error messages in the golden output come from the V5 superblock verifier
+# routines, so ignore V4 filesystems.
+_require_scratch_xfs_crc
+
 _scratch_mkfs_xfs >>$seqres.full 2>&1
 
 # write the bad magicnum field value(0) to the superblock 1
 _scratch_xfs_set_metadata_field "magicnum" "0" "sb 1"
 
-#Even magicnum field has been corrupted, we still can read this field value
-_scratch_xfs_get_metadata_field "magicnum" "sb 1"
+# Even magicnum field has been corrupted, we still can read this field value.
+# The error message changed in xfsprogs 5.19.
+_scratch_xfs_get_metadata_field "magicnum" "sb 1" 2>&1 | \
+	sed -e 's/Superblock has bad magic number 0x0. Not an XFS filesystem?/bad magic number/g'
 
 # success, all done
 status=0