fstests.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xfs/516: Use scratch_xfs_get/set_sb_field api
@ 2020-06-30  6:23 Yang Xu
  2020-06-30 15:48 ` Darrick J. Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Yang Xu @ 2020-06-30  6:23 UTC (permalink / raw)
  To: fstests; +Cc: Yang Xu

When using old xfsprogs, this case fails as below:
    +write: invalid option -- 'd'

xfs_db write command support -d options since xfsprogs commit
86769b32d01 ("xfs_db: allow recalculating CRCs on invalid metadata").
For avoid invalid error, use scratch_xfs_set_sb_field api instead.

Also add missing "rm -f $seqres.full" at the beginning of the test.

Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
---
 tests/xfs/516 | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/tests/xfs/516 b/tests/xfs/516
index ca8c0412..3a7afd0e 100755
--- a/tests/xfs/516
+++ b/tests/xfs/516
@@ -22,6 +22,8 @@ _cleanup()
 	cd /
 }
 
+rm -f $seqres.full
+
 # get standard environment, filters and checks
 . ./common/rc
 . ./common/fuzzy
@@ -60,7 +62,8 @@ __test_mount_opts()
 	else
 		echo "mount failed" >> $seqres.full
 	fi
-	_scratch_xfs_db -c 'sb 0' -c 'p unit width' >> $seqres.full
+	_scratch_xfs_get_sb_field unit >> $seqres.full
+	_scratch_xfs_get_sb_field width  >> $seqres.full
 
 	# Run xfs_repair in repair mode to see if it can be baited into nuking
 	# the root filesystem on account of the sunit update.
@@ -119,9 +122,12 @@ test_repair_detection()
 	fi
 
 	# Update the superblock like the kernel used to do.
-	_scratch_xfs_db -c 'sb 0' -c 'p unit width' >> $seqres.full
-	_scratch_xfs_db -x -c 'sb 0' -c 'write -d unit 256' -c 'write -d width 1024' >> $seqres.full
-	_scratch_xfs_db -c 'sb 0' -c 'p unit width' >> $seqres.full
+	_scratch_xfs_get_sb_field unit >> $seqres.full
+	_scratch_xfs_get_sb_field width >> $seqres.full
+	_scratch_xfs_set_sb_field unit 256 >> $seqres.full
+	_scratch_xfs_set_sb_field width 1024 >> $seqres.full
+	_scratch_xfs_get_sb_field unit >> $seqres.full
+	_scratch_xfs_get_sb_field width >> $seqres.full
 
 	# Run xfs_repair in repair mode to see if it can be baited into nuking
 	# the root filesystem on account of the sunit update.
-- 
2.23.0




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] xfs/516: Use scratch_xfs_get/set_sb_field api
  2020-06-30  6:23 [PATCH] xfs/516: Use scratch_xfs_get/set_sb_field api Yang Xu
@ 2020-06-30 15:48 ` Darrick J. Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Darrick J. Wong @ 2020-06-30 15:48 UTC (permalink / raw)
  To: Yang Xu; +Cc: fstests

On Tue, Jun 30, 2020 at 02:23:07PM +0800, Yang Xu wrote:
> When using old xfsprogs, this case fails as below:
>     +write: invalid option -- 'd'
> 
> xfs_db write command support -d options since xfsprogs commit
> 86769b32d01 ("xfs_db: allow recalculating CRCs on invalid metadata").
> For avoid invalid error, use scratch_xfs_set_sb_field api instead.
> 
> Also add missing "rm -f $seqres.full" at the beginning of the test.
> 
> Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>

Looks good to me,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
>  tests/xfs/516 | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/xfs/516 b/tests/xfs/516
> index ca8c0412..3a7afd0e 100755
> --- a/tests/xfs/516
> +++ b/tests/xfs/516
> @@ -22,6 +22,8 @@ _cleanup()
>  	cd /
>  }
>  
> +rm -f $seqres.full
> +
>  # get standard environment, filters and checks
>  . ./common/rc
>  . ./common/fuzzy
> @@ -60,7 +62,8 @@ __test_mount_opts()
>  	else
>  		echo "mount failed" >> $seqres.full
>  	fi
> -	_scratch_xfs_db -c 'sb 0' -c 'p unit width' >> $seqres.full
> +	_scratch_xfs_get_sb_field unit >> $seqres.full
> +	_scratch_xfs_get_sb_field width  >> $seqres.full
>  
>  	# Run xfs_repair in repair mode to see if it can be baited into nuking
>  	# the root filesystem on account of the sunit update.
> @@ -119,9 +122,12 @@ test_repair_detection()
>  	fi
>  
>  	# Update the superblock like the kernel used to do.
> -	_scratch_xfs_db -c 'sb 0' -c 'p unit width' >> $seqres.full
> -	_scratch_xfs_db -x -c 'sb 0' -c 'write -d unit 256' -c 'write -d width 1024' >> $seqres.full
> -	_scratch_xfs_db -c 'sb 0' -c 'p unit width' >> $seqres.full
> +	_scratch_xfs_get_sb_field unit >> $seqres.full
> +	_scratch_xfs_get_sb_field width >> $seqres.full
> +	_scratch_xfs_set_sb_field unit 256 >> $seqres.full
> +	_scratch_xfs_set_sb_field width 1024 >> $seqres.full
> +	_scratch_xfs_get_sb_field unit >> $seqres.full
> +	_scratch_xfs_get_sb_field width >> $seqres.full
>  
>  	# Run xfs_repair in repair mode to see if it can be baited into nuking
>  	# the root filesystem on account of the sunit update.
> -- 
> 2.23.0
> 
> 
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-06-30 15:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-30  6:23 [PATCH] xfs/516: Use scratch_xfs_get/set_sb_field api Yang Xu
2020-06-30 15:48 ` Darrick J. Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).