diff mbox series

xfs/207: explicitly test for xflag character

Message ID 3ac76079-7a4f-0ad6-80e9-6175c3c55a68@redhat.com (mailing list archive)
State New, archived
Headers show
Series xfs/207: explicitly test for xflag character | expand

Commit Message

Eric Sandeen Nov. 7, 2019, 3:07 p.m. UTC
With a recent change to xfs_io[1], the fsxattr.xflags output line
has added another flag column, so xfs/207 starts failing.

Rather than testing for an exact set of flags, test whether the
specific flag we are interested in is set or unset.

[1] xfs_io/lsattr: expose FS_XFLAG_HASATTR flag

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

Comments

Amir Goldstein Nov. 7, 2019, 3:47 p.m. UTC | #1
On Thu, Nov 7, 2019 at 5:07 PM Eric Sandeen <sandeen@redhat.com> wrote:
>
> With a recent change to xfs_io[1], the fsxattr.xflags output line
> has added another flag column, so xfs/207 starts failing.
>
> Rather than testing for an exact set of flags, test whether the
> specific flag we are interested in is set or unset.
>
> [1] xfs_io/lsattr: expose FS_XFLAG_HASATTR flag
>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>

And sorry for the fallout...

> ---
>
> diff --git a/tests/xfs/207 b/tests/xfs/207
> index e830534b..ed4e2e52 100755
> --- a/tests/xfs/207
> +++ b/tests/xfs/207
> @@ -37,6 +37,15 @@ _require_cp_reflink
>  _require_xfs_io_command "fiemap"
>  _require_xfs_io_command "cowextsize"
>
> +# Takes the fsxattr.xflags line,
> +# i.e. fsxattr.xflags = 0x0 [--------------C-]
> +# and tests whether a flag character is set
> +test_xflag()
> +{
> +    local flg=$1
> +    grep -q "\[.*${flg}.*\]" && echo "$flg flag set" || echo "$flg flag unset"
> +}
> +
>  rm -f $seqres.full
>
>  echo "Format and mount"
> @@ -73,14 +82,14 @@ echo "Set cowextsize and check flag"
>  $XFS_IO_PROG -c "cowextsize 1048576" $testdir/file3 | _filter_scratch
>  _scratch_cycle_mount
>
> -$XFS_IO_PROG -c "stat" $testdir/file3 | grep 'fsxattr.xflags' | _filter_scratch
> +$XFS_IO_PROG -c "stat" $testdir/file3 | grep 'fsxattr.xflags' | test_xflag "C"
>  $XFS_IO_PROG -c "cowextsize" $testdir/file3 | _filter_scratch
>
>  echo "Unset cowextsize and check flag"
>  $XFS_IO_PROG -c "cowextsize 0" $testdir/file3 | _filter_scratch
>  _scratch_cycle_mount
>
> -$XFS_IO_PROG -c "stat" $testdir/file3 | grep 'fsxattr.xflags' | _filter_scratch
> +$XFS_IO_PROG -c "stat" $testdir/file3 | grep 'fsxattr.xflags' | test_xflag "C"
>  $XFS_IO_PROG -c "cowextsize" $testdir/file3 | _filter_scratch
>
>  status=0
> diff --git a/tests/xfs/207.out b/tests/xfs/207.out
> index f6dc17d1..dd2d0958 100644
> --- a/tests/xfs/207.out
> +++ b/tests/xfs/207.out
> @@ -11,8 +11,8 @@ Check extsz and cowextsz settings on 1Mbyte file
>  [0] SCRATCH_MNT/test-207/file2
>  [1048576] SCRATCH_MNT/test-207/file2
>  Set cowextsize and check flag
> -fsxattr.xflags = 0x10000 [---------------C]
> +C flag set
>  [1048576] SCRATCH_MNT/test-207/file3
>  Unset cowextsize and check flag
> -fsxattr.xflags = 0x0 [----------------]
> +C flag unset
>  [0] SCRATCH_MNT/test-207/file3
>
Bill O'Donnell Nov. 7, 2019, 3:49 p.m. UTC | #2
On Thu, Nov 07, 2019 at 09:07:26AM -0600, Eric Sandeen wrote:
> With a recent change to xfs_io[1], the fsxattr.xflags output line
> has added another flag column, so xfs/207 starts failing.
> 
> Rather than testing for an exact set of flags, test whether the
> specific flag we are interested in is set or unset.
> 
> [1] xfs_io/lsattr: expose FS_XFLAG_HASATTR flag
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>

Looks fine.
Reviewed-by: Bill O'Donnell <billodo@redhat.com>

> ---
> 
> diff --git a/tests/xfs/207 b/tests/xfs/207
> index e830534b..ed4e2e52 100755
> --- a/tests/xfs/207
> +++ b/tests/xfs/207
> @@ -37,6 +37,15 @@ _require_cp_reflink
>  _require_xfs_io_command "fiemap"
>  _require_xfs_io_command "cowextsize"
>  
> +# Takes the fsxattr.xflags line,
> +# i.e. fsxattr.xflags = 0x0 [--------------C-]
> +# and tests whether a flag character is set
> +test_xflag()
> +{
> +    local flg=$1
> +    grep -q "\[.*${flg}.*\]" && echo "$flg flag set" || echo "$flg flag unset"
> +}
> +
>  rm -f $seqres.full
>  
>  echo "Format and mount"
> @@ -73,14 +82,14 @@ echo "Set cowextsize and check flag"
>  $XFS_IO_PROG -c "cowextsize 1048576" $testdir/file3 | _filter_scratch
>  _scratch_cycle_mount
>  
> -$XFS_IO_PROG -c "stat" $testdir/file3 | grep 'fsxattr.xflags' | _filter_scratch
> +$XFS_IO_PROG -c "stat" $testdir/file3 | grep 'fsxattr.xflags' | test_xflag "C"
>  $XFS_IO_PROG -c "cowextsize" $testdir/file3 | _filter_scratch
>  
>  echo "Unset cowextsize and check flag"
>  $XFS_IO_PROG -c "cowextsize 0" $testdir/file3 | _filter_scratch
>  _scratch_cycle_mount
>  
> -$XFS_IO_PROG -c "stat" $testdir/file3 | grep 'fsxattr.xflags' | _filter_scratch
> +$XFS_IO_PROG -c "stat" $testdir/file3 | grep 'fsxattr.xflags' | test_xflag "C"
>  $XFS_IO_PROG -c "cowextsize" $testdir/file3 | _filter_scratch
>  
>  status=0
> diff --git a/tests/xfs/207.out b/tests/xfs/207.out
> index f6dc17d1..dd2d0958 100644
> --- a/tests/xfs/207.out
> +++ b/tests/xfs/207.out
> @@ -11,8 +11,8 @@ Check extsz and cowextsz settings on 1Mbyte file
>  [0] SCRATCH_MNT/test-207/file2
>  [1048576] SCRATCH_MNT/test-207/file2
>  Set cowextsize and check flag
> -fsxattr.xflags = 0x10000 [---------------C]
> +C flag set
>  [1048576] SCRATCH_MNT/test-207/file3
>  Unset cowextsize and check flag
> -fsxattr.xflags = 0x0 [----------------]
> +C flag unset
>  [0] SCRATCH_MNT/test-207/file3
>
diff mbox series

Patch

diff --git a/tests/xfs/207 b/tests/xfs/207
index e830534b..ed4e2e52 100755
--- a/tests/xfs/207
+++ b/tests/xfs/207
@@ -37,6 +37,15 @@  _require_cp_reflink
 _require_xfs_io_command "fiemap"
 _require_xfs_io_command "cowextsize"
 
+# Takes the fsxattr.xflags line,
+# i.e. fsxattr.xflags = 0x0 [--------------C-]
+# and tests whether a flag character is set
+test_xflag()
+{
+    local flg=$1
+    grep -q "\[.*${flg}.*\]" && echo "$flg flag set" || echo "$flg flag unset"
+}
+
 rm -f $seqres.full
 
 echo "Format and mount"
@@ -73,14 +82,14 @@  echo "Set cowextsize and check flag"
 $XFS_IO_PROG -c "cowextsize 1048576" $testdir/file3 | _filter_scratch
 _scratch_cycle_mount
 
-$XFS_IO_PROG -c "stat" $testdir/file3 | grep 'fsxattr.xflags' | _filter_scratch
+$XFS_IO_PROG -c "stat" $testdir/file3 | grep 'fsxattr.xflags' | test_xflag "C"
 $XFS_IO_PROG -c "cowextsize" $testdir/file3 | _filter_scratch
 
 echo "Unset cowextsize and check flag"
 $XFS_IO_PROG -c "cowextsize 0" $testdir/file3 | _filter_scratch
 _scratch_cycle_mount
 
-$XFS_IO_PROG -c "stat" $testdir/file3 | grep 'fsxattr.xflags' | _filter_scratch
+$XFS_IO_PROG -c "stat" $testdir/file3 | grep 'fsxattr.xflags' | test_xflag "C"
 $XFS_IO_PROG -c "cowextsize" $testdir/file3 | _filter_scratch
 
 status=0
diff --git a/tests/xfs/207.out b/tests/xfs/207.out
index f6dc17d1..dd2d0958 100644
--- a/tests/xfs/207.out
+++ b/tests/xfs/207.out
@@ -11,8 +11,8 @@  Check extsz and cowextsz settings on 1Mbyte file
 [0] SCRATCH_MNT/test-207/file2
 [1048576] SCRATCH_MNT/test-207/file2
 Set cowextsize and check flag
-fsxattr.xflags = 0x10000 [---------------C]
+C flag set
 [1048576] SCRATCH_MNT/test-207/file3
 Unset cowextsize and check flag
-fsxattr.xflags = 0x0 [----------------]
+C flag unset
 [0] SCRATCH_MNT/test-207/file3