diff mbox

[v3] common/xfs: Add require_xfs_db_write_array function

Message ID 1523945500-10819-1-git-send-email-xuyang.jy@cn.fujitsu.com (mailing list archive)
State New, archived
Headers show

Commit Message

yang xu April 17, 2018, 6:11 a.m. UTC
xfsprogs commit 4222d00("db: write via array indexing doesn't
work") fixes a bug that xfs_db write can't support array indexing.
This function will check whether the bug is fixed on the current
xfsprogs.

xfs/444 applies the function, and skips if this bug exists.

Signed-off-by: yang xu <xuyang.jy@cn.fujitsu.com>
---
 common/xfs    | 17 +++++++++++++++++
 tests/xfs/444 |  1 +
 2 files changed, 18 insertions(+)

Comments

Darrick J. Wong April 17, 2018, 5:59 p.m. UTC | #1
On Tue, Apr 17, 2018 at 02:11:40PM +0800, yang xu wrote:
> xfsprogs commit 4222d00("db: write via array indexing doesn't
> work") fixes a bug that xfs_db write can't support array indexing.
> This function will check whether the bug is fixed on the current
> xfsprogs.
> 
> xfs/444 applies the function, and skips if this bug exists.
> 
> Signed-off-by: yang xu <xuyang.jy@cn.fujitsu.com>
> ---
>  common/xfs    | 17 +++++++++++++++++
>  tests/xfs/444 |  1 +
>  2 files changed, 18 insertions(+)
> 
> diff --git a/common/xfs b/common/xfs
> index 3169f87..0b59994 100644
> --- a/common/xfs
> +++ b/common/xfs
> @@ -701,3 +701,20 @@ _scratch_xfs_set_sb_field()
>  {
>  	_scratch_xfs_set_metadata_field "$1" "$2" "sb 0"
>  }
> +
> +#Before xfsprogs commit 4222d000ed("db: write via array indexing doesn't work"),
> +##xfs_db command to write a specific AGFL index doesn't work.
> +_require_xfs_db_write_array()
> +{
> +	local supported=0
> +
> +	_require_test
> +	touch $TEST_DIR/$seq.img
> +	$MKFS_XFS_PROG -d file,name=$TEST_DIR/$seq.img,size=512m >/dev/null 2>&1
> +	$XFS_DB_PROG -x -c "agfl 0" -c "write bno[32] 78" $TEST_DIR/$seq.img \
> +		>/dev/null 2>&1
> +	$XFS_DB_PROG -x -c "agfl 0" -c "print bno[32]" $TEST_DIR/$seq.img \
> +		| grep -q "bno\[32\] = 78" && supported=1
> +	rm -f $TEST_DIR/$seq.img
> +	[ $supported -eq 0 ] && _notrun "xfs_db write can't support array"
> +}
> diff --git a/tests/xfs/444 b/tests/xfs/444
> index 141be52..9700422 100755
> --- a/tests/xfs/444
> +++ b/tests/xfs/444
> @@ -54,6 +54,7 @@ _supported_os Linux
>  _require_check_dmesg
>  _require_scratch
>  _require_test_program "punch-alternating"
> +_require_xfs_db_write_array

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

--D

>  
>  # This is only a v5 filesystem problem
>  _require_scratch_xfs_crc
> -- 
> 1.8.3.1
> 
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eryu Guan April 18, 2018, 4:29 a.m. UTC | #2
On Tue, Apr 17, 2018 at 10:59:17AM -0700, Darrick J. Wong wrote:
> On Tue, Apr 17, 2018 at 02:11:40PM +0800, yang xu wrote:
> > xfsprogs commit 4222d00("db: write via array indexing doesn't
> > work") fixes a bug that xfs_db write can't support array indexing.
> > This function will check whether the bug is fixed on the current
> > xfsprogs.
> > 
> > xfs/444 applies the function, and skips if this bug exists.
> > 
> > Signed-off-by: yang xu <xuyang.jy@cn.fujitsu.com>
> > ---
> >  common/xfs    | 17 +++++++++++++++++
> >  tests/xfs/444 |  1 +
> >  2 files changed, 18 insertions(+)
> > 
> > diff --git a/common/xfs b/common/xfs
> > index 3169f87..0b59994 100644
> > --- a/common/xfs
> > +++ b/common/xfs
> > @@ -701,3 +701,20 @@ _scratch_xfs_set_sb_field()
> >  {
> >  	_scratch_xfs_set_metadata_field "$1" "$2" "sb 0"
> >  }
> > +
> > +#Before xfsprogs commit 4222d000ed("db: write via array indexing doesn't work"),
> > +##xfs_db command to write a specific AGFL index doesn't work.

I'll add more comments here to explain why we require a bug fix instead
of exposing the bug to users, e.g.

"It's a bug in a diagnostic tool that is only used by XFS developers as
a test infrastructure, so we can treat it as a infrastructure dependency
as all other _require rules."

> > +_require_xfs_db_write_array()
> > +{
> > +	local supported=0
> > +
> > +	_require_test
> > +	touch $TEST_DIR/$seq.img
> > +	$MKFS_XFS_PROG -d file,name=$TEST_DIR/$seq.img,size=512m >/dev/null 2>&1
> > +	$XFS_DB_PROG -x -c "agfl 0" -c "write bno[32] 78" $TEST_DIR/$seq.img \
> > +		>/dev/null 2>&1
> > +	$XFS_DB_PROG -x -c "agfl 0" -c "print bno[32]" $TEST_DIR/$seq.img \
> > +		| grep -q "bno\[32\] = 78" && supported=1
> > +	rm -f $TEST_DIR/$seq.img
> > +	[ $supported -eq 0 ] && _notrun "xfs_db write can't support array"
> > +}
> > diff --git a/tests/xfs/444 b/tests/xfs/444
> > index 141be52..9700422 100755
> > --- a/tests/xfs/444
> > +++ b/tests/xfs/444
> > @@ -54,6 +54,7 @@ _supported_os Linux
> >  _require_check_dmesg
> >  _require_scratch
> >  _require_test_program "punch-alternating"
> > +_require_xfs_db_write_array
> 
> Looks ok,
> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

Thanks for the review!

Eryu

> 
> --D
> 
> >  
> >  # This is only a v5 filesystem problem
> >  _require_scratch_xfs_crc
> > -- 
> > 1.8.3.1
> > 
> > 
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe fstests" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/common/xfs b/common/xfs
index 3169f87..0b59994 100644
--- a/common/xfs
+++ b/common/xfs
@@ -701,3 +701,20 @@  _scratch_xfs_set_sb_field()
 {
 	_scratch_xfs_set_metadata_field "$1" "$2" "sb 0"
 }
+
+#Before xfsprogs commit 4222d000ed("db: write via array indexing doesn't work"),
+##xfs_db command to write a specific AGFL index doesn't work.
+_require_xfs_db_write_array()
+{
+	local supported=0
+
+	_require_test
+	touch $TEST_DIR/$seq.img
+	$MKFS_XFS_PROG -d file,name=$TEST_DIR/$seq.img,size=512m >/dev/null 2>&1
+	$XFS_DB_PROG -x -c "agfl 0" -c "write bno[32] 78" $TEST_DIR/$seq.img \
+		>/dev/null 2>&1
+	$XFS_DB_PROG -x -c "agfl 0" -c "print bno[32]" $TEST_DIR/$seq.img \
+		| grep -q "bno\[32\] = 78" && supported=1
+	rm -f $TEST_DIR/$seq.img
+	[ $supported -eq 0 ] && _notrun "xfs_db write can't support array"
+}
diff --git a/tests/xfs/444 b/tests/xfs/444
index 141be52..9700422 100755
--- a/tests/xfs/444
+++ b/tests/xfs/444
@@ -54,6 +54,7 @@  _supported_os Linux
 _require_check_dmesg
 _require_scratch
 _require_test_program "punch-alternating"
+_require_xfs_db_write_array
 
 # This is only a v5 filesystem problem
 _require_scratch_xfs_crc