aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryang xu <xuyang.jy@cn.fujitsu.com>2018-04-17 14:11:40 +0800
committerEryu Guan <guaneryu@gmail.com>2018-04-22 18:44:17 +0800
commit7ed53b9342ae89d0a9edb0105d6723840d7f40a5 (patch)
tree97a1d4c83420ea6c591e24849a515b76d17db7c4
parent792514c38480f4617ee0b677d8076b60a41be71b (diff)
downloadxfstests-dev-7ed53b9342ae89d0a9edb0105d6723840d7f40a5.tar.gz
common/xfs: Add require_xfs_db_write_array function
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> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
-rw-r--r--common/xfs20
-rwxr-xr-xtests/xfs/4441
2 files changed, 21 insertions, 0 deletions
diff --git a/common/xfs b/common/xfs
index 3169f8710d..e0bc3f43d3 100644
--- a/common/xfs
+++ b/common/xfs
@@ -701,3 +701,23 @@ _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. It's a
+# bug in a diagnostic tool that is only used by XFS developers as a test
+# infrastructure, so it's fine to 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 141be523f8..9700422be6 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