All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] fstests: fixes and new tests
@ 2018-06-05 16:42 Darrick J. Wong
  2018-06-05 16:42 ` [PATCH 1/6] xfs/439: don't check filesystem afterwards Darrick J. Wong
                   ` (5 more replies)
  0 siblings, 6 replies; 15+ messages in thread
From: Darrick J. Wong @ 2018-06-05 16:42 UTC (permalink / raw)
  To: guaneryu, darrick.wong; +Cc: linux-xfs, fstests

Hi all,

The first three patches in this series fix some fstests regressions that
I've observed over the last couple of weeks.

After that are new swapfile tests that check the swapfile activation
code on various weird twists on swapfile format.

The final two tests parameterize xfs_info calls like any other helper
program and make sure that in xfsprogs 4.17, fs geometry printing is
consistent across the xfs utilities.

--D

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

* [PATCH 1/6] xfs/439: don't check filesystem afterwards
  2018-06-05 16:42 [PATCH 0/6] fstests: fixes and new tests Darrick J. Wong
@ 2018-06-05 16:42 ` Darrick J. Wong
  2018-06-05 16:43 ` [PATCH 2/6] xfs/122: fix sb_fname[XFSLABEL_MAX] in test Darrick J. Wong
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 15+ messages in thread
From: Darrick J. Wong @ 2018-06-05 16:42 UTC (permalink / raw)
  To: guaneryu, darrick.wong; +Cc: linux-xfs, fstests

From: Darrick J. Wong <darrick.wong@oracle.com>

We deliberately corrupted the scratch fs, so don't check it afterwards.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/439 |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


diff --git a/tests/xfs/439 b/tests/xfs/439
index 215c4b90..4ab1c986 100755
--- a/tests/xfs/439
+++ b/tests/xfs/439
@@ -47,7 +47,7 @@ _cleanup()
 # real QA test starts here
 _supported_os Linux
 _supported_fs xfs
-_require_scratch
+_require_scratch_nocheck
 # We corrupt XFS on purpose, and check if assert failures would crash system.
 _require_no_xfs_bug_on_assert
 


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

* [PATCH 2/6] xfs/122: fix sb_fname[XFSLABEL_MAX] in test
  2018-06-05 16:42 [PATCH 0/6] fstests: fixes and new tests Darrick J. Wong
  2018-06-05 16:42 ` [PATCH 1/6] xfs/439: don't check filesystem afterwards Darrick J. Wong
@ 2018-06-05 16:43 ` Darrick J. Wong
  2018-06-05 16:43 ` [PATCH 3/6] xfs/310: fix _require_scratch_nocheck ordering Darrick J. Wong
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 15+ messages in thread
From: Darrick J. Wong @ 2018-06-05 16:43 UTC (permalink / raw)
  To: guaneryu, darrick.wong; +Cc: linux-xfs, fstests

From: Darrick J. Wong <darrick.wong@oracle.com>

We recently redefined sb_fname's array length to use a symbolic constant
instead of a magic number, so update this test accordingly.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/122 |    1 +
 1 file changed, 1 insertion(+)


diff --git a/tests/xfs/122 b/tests/xfs/122
index d8366701..0de99b6d 100755
--- a/tests/xfs/122
+++ b/tests/xfs/122
@@ -218,6 +218,7 @@ cat /usr/include/xfs/xfs*.h | indent |\
 awk '
    /typedef struct xfs_sb/ { structon = 1; next }
    structon && $2 ~ /^sb_/ { sub(/[;,]/,"",$2)
+                             sub(/XFSLABEL_MAX/,"12",$2)
                              printf("printf(\"offsetof(xfs_sb_t, %s) = \\%zu\\n\", offsetof(xfs_sb_t, %s));", $2, $2); next}
    structon && /}/ { structon = 0; next}
 '>>$cprog


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

* [PATCH 3/6] xfs/310: fix _require_scratch_nocheck ordering
  2018-06-05 16:42 [PATCH 0/6] fstests: fixes and new tests Darrick J. Wong
  2018-06-05 16:42 ` [PATCH 1/6] xfs/439: don't check filesystem afterwards Darrick J. Wong
  2018-06-05 16:43 ` [PATCH 2/6] xfs/122: fix sb_fname[XFSLABEL_MAX] in test Darrick J. Wong
@ 2018-06-05 16:43 ` Darrick J. Wong
  2018-06-05 16:43 ` [PATCH 4/6] generic: test swapfile creation, activation, and deactivation Darrick J. Wong
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 15+ messages in thread
From: Darrick J. Wong @ 2018-06-05 16:43 UTC (permalink / raw)
  To: guaneryu, darrick.wong; +Cc: linux-xfs, fstests

From: Darrick J. Wong <darrick.wong@oracle.com>

In xfs/310 we have to _require_scratch_nocheck last because anything
else that calls _require_scratch (e.g. _require_xfs_scratch_rmapbt) will
create the "check scratch after test exit" file.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/310 |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


diff --git a/tests/xfs/310 b/tests/xfs/310
index 5c1f20ce..f7b7e30e 100755
--- a/tests/xfs/310
+++ b/tests/xfs/310
@@ -45,8 +45,8 @@ _cleanup()
 # real QA test starts here
 _supported_os Linux
 _supported_fs xfs
-_require_scratch_nocheck
 _require_xfs_scratch_rmapbt
+_require_scratch_nocheck
 _require_xfs_io_command "falloc"
 
 rm -f $seqres.full


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

* [PATCH 4/6] generic: test swapfile creation, activation, and deactivation
  2018-06-05 16:42 [PATCH 0/6] fstests: fixes and new tests Darrick J. Wong
                   ` (2 preceding siblings ...)
  2018-06-05 16:43 ` [PATCH 3/6] xfs/310: fix _require_scratch_nocheck ordering Darrick J. Wong
@ 2018-06-05 16:43 ` Darrick J. Wong
  2018-06-07 12:34   ` Eryu Guan
  2018-06-07 15:17   ` [PATCH v2 " Darrick J. Wong
  2018-06-05 16:43 ` [PATCH 5/6] xfs: abstract xfs_info into $XFS_INFO_PROG Darrick J. Wong
  2018-06-05 16:43 ` [PATCH 6/6] xfs: make sure pretty printed geometry output matches Darrick J. Wong
  5 siblings, 2 replies; 15+ messages in thread
From: Darrick J. Wong @ 2018-06-05 16:43 UTC (permalink / raw)
  To: guaneryu, darrick.wong; +Cc: linux-xfs, fstests

From: Darrick J. Wong <darrick.wong@oracle.com>

Test swapfile activation and deactivation.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/generic/708     |  115 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/708.out |    8 +++
 tests/generic/709     |   91 +++++++++++++++++++++++++++++++++++++++
 tests/generic/709.out |    3 +
 tests/generic/710     |   94 ++++++++++++++++++++++++++++++++++++++++
 tests/generic/710.out |    3 +
 tests/generic/group   |    3 +
 7 files changed, 317 insertions(+)
 create mode 100755 tests/generic/708
 create mode 100644 tests/generic/708.out
 create mode 100755 tests/generic/709
 create mode 100644 tests/generic/709.out
 create mode 100755 tests/generic/710
 create mode 100644 tests/generic/710.out


diff --git a/tests/generic/708 b/tests/generic/708
new file mode 100755
index 00000000..dc3c2924
--- /dev/null
+++ b/tests/generic/708
@@ -0,0 +1,115 @@
+#! /bin/bash
+# FS QA Test No. 708
+#
+# Test various swapfile activation oddities.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2018 Oracle.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#-----------------------------------------------------------------------
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+status=1	# failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	swapoff $swapfile 2> /dev/null
+	rm -f $swapfile
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# remove previous $seqres.full before test
+rm -f $seqres.full
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+_require_scratch_swapfile
+_require_test_program mkswap
+_require_test_program swapon
+
+rm -f $seqres.full
+_scratch_mkfs >>$seqres.full 2>&1
+_scratch_mount >>$seqres.full 2>&1
+
+swapfile=$SCRATCH_MNT/swap
+len=$((2 * 1048576))
+page_size=$(get_page_size)
+
+swapfile_cycle() {
+	local swapfile="$1"
+
+	$CHATTR_PROG +C $swapfile >> $seqres.full 2>&1
+	"$here/src/mkswap" $swapfile >> $seqres.full
+	"$here/src/swapon" $swapfile 2>&1 | _filter_scratch
+	swapoff $swapfile 2>> $seeqres.full
+	rm -f $swapfile
+}
+
+# Create a regular swap file
+echo "regular swap" | tee -a $seqres.full
+_pwrite_byte 0x58 0 $len $swapfile >> $seqres.full
+swapfile_cycle $swapfile
+
+# Create a sparse swap file
+echo "sparse swap" | tee -a $seqres.full
+$XFS_IO_PROG -f -c "truncate $len" $swapfile >> $seqres.full
+swapfile_cycle $swapfile
+
+# Create a swap file with a little too much junk on the end
+echo "too long swap" | tee -a $seqres.full
+_pwrite_byte 0x58 0 $((len + 3)) $swapfile >> $seqres.full
+swapfile_cycle $swapfile
+
+# Create a swap file with a large discontiguous range(?)
+echo "large discontig swap" | tee -a $seqres.full
+_pwrite_byte 0x58 0 $((len * 2)) $swapfile >> $seqres.full
+old_sz="$(stat -c '%s' $swapfile)"
+$XFS_IO_PROG -c "fcollapse $((len / 2)) $len" $swapfile >> $seqres.full 2>&1
+new_sz="$(stat -c '%s' $swapfile)"
+if [ $old_sz -gt $new_sz ]; then
+	swapfile_cycle $swapfile
+fi
+rm -f $swapfile
+
+# Create a swap file with a small discontiguous range(?)
+echo "small discontig swap" | tee -a $seqres.full
+_pwrite_byte 0x58 0 $((len + 1024)) $swapfile >> $seqres.full
+old_sz="$(stat -c '%s' $swapfile)"
+$XFS_IO_PROG -c "fcollapse 66560 1024" $swapfile >> $seqres.full 2>&1
+new_sz="$(stat -c '%s' $swapfile)"
+if [ $old_sz -gt $new_sz ]; then
+	swapfile_cycle $swapfile
+fi
+rm -f $swapfile
+
+# Create a ridiculously small swap file.  Each swap file must have at least
+# two pages after the header page.
+echo "tiny swap" | tee -a $seqres.full
+tiny_len=$((page_size * 3))
+_pwrite_byte 0x58 0 $tiny_len $swapfile >> $seqres.full
+swapfile_cycle $swapfile
+
+status=0
+exit
diff --git a/tests/generic/708.out b/tests/generic/708.out
new file mode 100644
index 00000000..d002974c
--- /dev/null
+++ b/tests/generic/708.out
@@ -0,0 +1,8 @@
+QA output created by 708
+regular swap
+sparse swap
+swapon: Invalid argument
+too long swap
+large discontig swap
+small discontig swap
+tiny swap
diff --git a/tests/generic/709 b/tests/generic/709
new file mode 100755
index 00000000..5e636305
--- /dev/null
+++ b/tests/generic/709
@@ -0,0 +1,91 @@
+#! /bin/bash
+# FS QA Test No. 709
+#
+# Test various swapfile activation oddities on filesystems that support
+# fallocated swapfiles.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2018 Oracle.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#-----------------------------------------------------------------------
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+status=1	# failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	swapoff $swapfile 2> /dev/null
+	rm -f $swapfile
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# remove previous $seqres.full before test
+rm -f $seqres.full
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+_require_scratch_swapfile
+_require_test_program mkswap
+_require_test_program swapon
+_require_xfs_io_command "falloc"
+
+rm -f $seqres.full
+_scratch_mkfs >>$seqres.full 2>&1
+_scratch_mount >>$seqres.full 2>&1
+
+swapfile=$SCRATCH_MNT/swap
+len=$((2 * 1048576))
+page_size=$(get_page_size)
+
+swapfile_cycle() {
+	local swapfile="$1"
+
+	$CHATTR_PROG +C $swapfile >> $seqres.full 2>&1
+	"$here/src/mkswap" $swapfile >> $seqres.full
+	"$here/src/swapon" $swapfile 2>&1 | _filter_scratch
+	swapoff $swapfile 2>> $seeqres.full
+	rm -f $swapfile
+}
+
+# Create a fallocated swap file
+echo "fallocate swap" | tee -a $seqres.full
+$XFS_IO_PROG -f -c "falloc 0 $len" $swapfile >> $seqres.full
+$CHATTR_PROG +C $swapfile >> $seqres.full 2>&1
+"$here/src/mkswap" $swapfile
+"$here/src/swapon" $swapfile >> $seqres.full 2>&1 || \
+	_notrun "fallocated swap not supported here"
+swapoff $swapfile
+
+# Create a fallocated swap file and touch every other $PAGE_SIZE to create
+# a mess of written/unwritten extent records
+echo "mixed swap" | tee -a $seqres.full
+$XFS_IO_PROG -f -c "falloc 0 $len" $swapfile >> $seqres.full
+seq $page_size $((page_size * 2)) $len | while read offset; do
+	_pwrite_byte 0x58 $offset 1 $swapfile >> $seqres.full
+done
+swapfile_cycle $swapfile
+
+status=0
+exit
diff --git a/tests/generic/709.out b/tests/generic/709.out
new file mode 100644
index 00000000..90ba38ae
--- /dev/null
+++ b/tests/generic/709.out
@@ -0,0 +1,3 @@
+QA output created by 709
+fallocate swap
+mixed swap
diff --git a/tests/generic/710 b/tests/generic/710
new file mode 100755
index 00000000..e9dc3f08
--- /dev/null
+++ b/tests/generic/710
@@ -0,0 +1,94 @@
+#! /bin/bash
+# FS QA Test No. 710
+#
+# Test various swapfile activation oddities, having used fcollapse to
+# create discontiguous ranges in the file.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2018 Oracle.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#-----------------------------------------------------------------------
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+status=1	# failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	swapoff $swapfile 2> /dev/null
+	rm -f $swapfile
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# remove previous $seqres.full before test
+rm -f $seqres.full
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+_require_scratch_swapfile
+_require_test_program mkswap
+_require_test_program swapon
+_require_xfs_io_command "fcollapse"
+
+rm -f $seqres.full
+_scratch_mkfs >>$seqres.full 2>&1
+_scratch_mount >>$seqres.full 2>&1
+
+swapfile=$SCRATCH_MNT/swap
+len=$((2 * 1048576))
+page_size=$(get_page_size)
+
+swapfile_cycle() {
+	local swapfile="$1"
+
+	"$here/src/mkswap" $swapfile >> $seqres.full
+	"$here/src/swapon" $swapfile 2>&1 | _filter_scratch
+	swapoff $swapfile 2>> $seeqres.full
+	rm -f $swapfile
+}
+
+# Create a swap file with a large discontiguous range(?)
+echo "large discontig swap" | tee -a $seqres.full
+_pwrite_byte 0x58 0 $((len * 2)) $swapfile >> $seqres.full
+old_sz="$(stat -c '%s' $swapfile)"
+$XFS_IO_PROG -c "fcollapse $((len / 2)) $len" $swapfile >> $seqres.full 2>&1
+new_sz="$(stat -c '%s' $swapfile)"
+if [ $old_sz -gt $new_sz ]; then
+	swapfile_cycle $swapfile
+fi
+rm -f $swapfile
+
+# Create a swap file with a small discontiguous range(?)
+echo "small discontig swap" | tee -a $seqres.full
+_pwrite_byte 0x58 0 $((len + 1024)) $swapfile >> $seqres.full
+old_sz="$(stat -c '%s' $swapfile)"
+$XFS_IO_PROG -c "fcollapse 66560 1024" $swapfile >> $seqres.full 2>&1
+new_sz="$(stat -c '%s' $swapfile)"
+if [ $old_sz -gt $new_sz ]; then
+	swapfile_cycle $swapfile
+fi
+rm -f $swapfile
+
+status=0
+exit
diff --git a/tests/generic/710.out b/tests/generic/710.out
new file mode 100644
index 00000000..ba1f8e40
--- /dev/null
+++ b/tests/generic/710.out
@@ -0,0 +1,3 @@
+QA output created by 710
+large discontig swap
+small discontig swap
diff --git a/tests/generic/group b/tests/generic/group
index 4339c64c..6d747450 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -497,3 +497,6 @@
 493 auto quick swap
 494 auto quick swap punch
 495 auto quick swap
+708 auto quick swap
+709 auto quick swap
+710 auto quick swap collapse


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

* [PATCH 5/6] xfs: abstract xfs_info into $XFS_INFO_PROG
  2018-06-05 16:42 [PATCH 0/6] fstests: fixes and new tests Darrick J. Wong
                   ` (3 preceding siblings ...)
  2018-06-05 16:43 ` [PATCH 4/6] generic: test swapfile creation, activation, and deactivation Darrick J. Wong
@ 2018-06-05 16:43 ` Darrick J. Wong
  2018-06-07 11:37   ` Eryu Guan
  2018-06-05 16:43 ` [PATCH 6/6] xfs: make sure pretty printed geometry output matches Darrick J. Wong
  5 siblings, 1 reply; 15+ messages in thread
From: Darrick J. Wong @ 2018-06-05 16:43 UTC (permalink / raw)
  To: guaneryu, darrick.wong; +Cc: linux-xfs, fstests

From: Darrick J. Wong <darrick.wong@oracle.com>

Abstract calls to xfs_info into $XFS_INFO_PROG like we do for all other
xfs utilities.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 common/attr      |    2 +-
 common/config    |    1 +
 common/populate  |   18 +++++++++---------
 common/rc        |    2 +-
 common/xfs       |    6 +++---
 tests/shared/298 |    2 +-
 tests/xfs/067    |    2 +-
 tests/xfs/073    |    4 ++--
 tests/xfs/085    |    2 +-
 tests/xfs/086    |    2 +-
 tests/xfs/087    |    2 +-
 tests/xfs/088    |    2 +-
 tests/xfs/089    |    2 +-
 tests/xfs/091    |    2 +-
 tests/xfs/093    |    2 +-
 tests/xfs/097    |    4 ++--
 tests/xfs/099    |    2 +-
 tests/xfs/100    |    2 +-
 tests/xfs/101    |    2 +-
 tests/xfs/102    |    2 +-
 tests/xfs/105    |    2 +-
 tests/xfs/112    |    2 +-
 tests/xfs/113    |    2 +-
 tests/xfs/127    |    2 +-
 tests/xfs/130    |    2 +-
 tests/xfs/190    |    2 +-
 tests/xfs/206    |    2 +-
 tests/xfs/233    |    2 +-
 tests/xfs/235    |    2 +-
 tests/xfs/271    |    2 +-
 tests/xfs/307    |    2 +-
 tests/xfs/308    |    2 +-
 tests/xfs/310    |    2 +-
 tests/xfs/348    |    2 +-
 34 files changed, 46 insertions(+), 45 deletions(-)


diff --git a/common/attr b/common/attr
index 3d1385a4..49679d3c 100644
--- a/common/attr
+++ b/common/attr
@@ -30,7 +30,7 @@ _acl_get_max()
 		# CRC format filesystems have much larger ACL counts. The actual
 		# number is into the thousands, but testing that meany takes too
 		# long, so just test well past the old limit of 25.
-		xfs_info $TEST_DIR | _filter_mkfs > /dev/null 2> $tmp.info
+		$XFS_INFO_PROG $TEST_DIR | _filter_mkfs > /dev/null 2> $tmp.info
 		. $tmp.info
 		rm $tmp.info
 		if [ $_fs_has_crcs -eq 0 ]; then
diff --git a/common/config b/common/config
index 221581de..d5150050 100644
--- a/common/config
+++ b/common/config
@@ -205,6 +205,7 @@ export TIMEOUT_PROG="$(type -P timeout)"
 export SETCAP_PROG="$(type -P setcap)"
 export GETCAP_PROG="$(type -P getcap)"
 export CHECKBASHISMS_PROG="$(type -P checkbashisms)"
+export XFS_INFO_PROG="$(type -P xfs_info)"
 
 # use 'udevadm settle' or 'udevsettle' to wait for lv to be settled.
 # newer systems have udevadm command but older systems like RHEL5 don't.
diff --git a/common/populate b/common/populate
index 07ea7e60..b2dd053f 100644
--- a/common/populate
+++ b/common/populate
@@ -117,7 +117,7 @@ _populate_xfs_qmount_option()
 	fi
 
 	# Turn on all the quotas
-	if xfs_info "${TEST_DIR}" | grep -q 'crc=1'; then
+	if $XFS_INFO_PROG "${TEST_DIR}" | grep -q 'crc=1'; then
 		# v5 filesystems can have group & project quotas
 		quota="usrquota,grpquota,prjquota"
 	else
@@ -151,7 +151,7 @@ _scratch_xfs_populate() {
 	_populate_xfs_qmount_option
 	_scratch_mount
 	blksz="$(stat -f -c '%s' "${SCRATCH_MNT}")"
-	dblksz="$(xfs_info "${SCRATCH_MNT}" | grep naming.*bsize | sed -e 's/^.*bsize=//g' -e 's/\([0-9]*\).*$/\1/g')"
+	dblksz="$($XFS_INFO_PROG "${SCRATCH_MNT}" | grep naming.*bsize | sed -e 's/^.*bsize=//g' -e 's/\([0-9]*\).*$/\1/g')"
 	leaf_lblk="$((32 * 1073741824 / blksz))"
 	node_lblk="$((64 * 1073741824 / blksz))"
 
@@ -267,7 +267,7 @@ _scratch_xfs_populate() {
 	./src/punch-alternating "${SCRATCH_MNT}/BNOBT"
 
 	# Reverse-mapping btree
-	is_rmapbt="$(xfs_info "${SCRATCH_MNT}" | grep -c 'rmapbt=1')"
+	is_rmapbt="$($XFS_INFO_PROG "${SCRATCH_MNT}" | grep -c 'rmapbt=1')"
 	if [ $is_rmapbt -gt 0 ]; then
 		echo "+ rmapbt btree"
 		nr="$((blksz * 2 / 24))"
@@ -276,7 +276,7 @@ _scratch_xfs_populate() {
 	fi
 
 	# Realtime Reverse-mapping btree
-	is_rt="$(xfs_info "${SCRATCH_MNT}" | grep -c 'rtextents=[1-9]')"
+	is_rt="$($XFS_INFO_PROG "${SCRATCH_MNT}" | grep -c 'rtextents=[1-9]')"
 	if [ $is_rmapbt -gt 0 ] && [ $is_rt -gt 0 ]; then
 		echo "+ rtrmapbt btree"
 		nr="$((blksz * 2 / 32))"
@@ -285,7 +285,7 @@ _scratch_xfs_populate() {
 	fi
 
 	# Reference-count btree
-	is_reflink="$(xfs_info "${SCRATCH_MNT}" | grep -c 'reflink=1')"
+	is_reflink="$($XFS_INFO_PROG "${SCRATCH_MNT}" | grep -c 'reflink=1')"
 	if [ $is_reflink -gt 0 ]; then
 		echo "+ reflink btree"
 		nr="$((blksz * 2 / 12))"
@@ -534,12 +534,12 @@ _scratch_xfs_populate_check() {
 	leaf_attr="$(__populate_find_inode "${SCRATCH_MNT}/ATTR.FMT_LEAF")"
 	node_attr="$(__populate_find_inode "${SCRATCH_MNT}/ATTR.FMT_NODE")"
 	btree_attr="$(__populate_find_inode "${SCRATCH_MNT}/ATTR.FMT_BTREE")"
-	is_finobt=$(xfs_info "${SCRATCH_MNT}" | grep -c 'finobt=1')
-	is_rmapbt=$(xfs_info "${SCRATCH_MNT}" | grep -c 'rmapbt=1')
-	is_reflink=$(xfs_info "${SCRATCH_MNT}" | grep -c 'reflink=1')
+	is_finobt=$($XFS_INFO_PROG "${SCRATCH_MNT}" | grep -c 'finobt=1')
+	is_rmapbt=$($XFS_INFO_PROG "${SCRATCH_MNT}" | grep -c 'rmapbt=1')
+	is_reflink=$($XFS_INFO_PROG "${SCRATCH_MNT}" | grep -c 'reflink=1')
 
 	blksz="$(stat -f -c '%s' "${SCRATCH_MNT}")"
-	dblksz="$(xfs_info "${SCRATCH_MNT}" | grep naming.*bsize | sed -e 's/^.*bsize=//g' -e 's/\([0-9]*\).*$/\1/g')"
+	dblksz="$($XFS_INFO_PROG "${SCRATCH_MNT}" | grep naming.*bsize | sed -e 's/^.*bsize=//g' -e 's/\([0-9]*\).*$/\1/g')"
 	leaf_lblk="$((32 * 1073741824 / blksz))"
 	node_lblk="$((64 * 1073741824 / blksz))"
 	umount "${SCRATCH_MNT}"
diff --git a/common/rc b/common/rc
index 9c2c0062..8cf6c373 100644
--- a/common/rc
+++ b/common/rc
@@ -328,7 +328,7 @@ _supports_filetype()
 	local fstyp=`$DF_PROG $dir | tail -1 | $AWK_PROG '{print $2}'`
 	case "$fstyp" in
 	xfs)
-		xfs_info $dir | grep -q "ftype=1"
+		$XFS_INFO_PROG $dir | grep -q "ftype=1"
 		;;
 	ext2|ext3|ext4)
 		local dev=`$DF_PROG $dir | tail -1 | $AWK_PROG '{print $1}'`
diff --git a/common/xfs b/common/xfs
index 5d68b5ca..3e34b118 100644
--- a/common/xfs
+++ b/common/xfs
@@ -236,7 +236,7 @@ _require_scratch_xfs_crc()
 	_scratch_mkfs_xfs >/dev/null 2>&1
 	_try_scratch_mount >/dev/null 2>&1 \
 	   || _notrun "Kernel doesn't support crc feature"
-	xfs_info $SCRATCH_MNT | grep -q 'crc=1' || _notrun "crc feature not supported by this filesystem"
+	$XFS_INFO_PROG $SCRATCH_MNT | grep -q 'crc=1' || _notrun "crc feature not supported by this filesystem"
 	_scratch_unmount
 }
 
@@ -467,7 +467,7 @@ _require_xfs_test_rmapbt()
 {
 	_require_test
 
-	if [ "$(xfs_info "$TEST_DIR" | grep -c "rmapbt=1")" -ne 1 ]; then
+	if [ "$($XFS_INFO_PROG "$TEST_DIR" | grep -c "rmapbt=1")" -ne 1 ]; then
 		_notrun "rmapbt not supported by test filesystem type: $FSTYP"
 	fi
 }
@@ -478,7 +478,7 @@ _require_xfs_scratch_rmapbt()
 
 	_scratch_mkfs > /dev/null
 	_scratch_mount
-	if [ "$(xfs_info "$SCRATCH_MNT" | grep -c "rmapbt=1")" -ne 1 ]; then
+	if [ "$($XFS_INFO_PROG "$SCRATCH_MNT" | grep -c "rmapbt=1")" -ne 1 ]; then
 		_scratch_unmount
 		_notrun "rmapbt not supported by scratch filesystem type: $FSTYP"
 	fi
diff --git a/tests/shared/298 b/tests/shared/298
index 0a11300b..9c8e0966 100755
--- a/tests/shared/298
+++ b/tests/shared/298
@@ -69,7 +69,7 @@ get_free_sectors()
 		     }'
 	;;
 	xfs)
-	agsize=`xfs_info $loop_mnt | $SED_PROG -n 's/.*agsize=\(.*\) blks.*/\1/p'`
+	agsize=`$XFS_INFO_PROG $loop_mnt | $SED_PROG -n 's/.*agsize=\(.*\) blks.*/\1/p'`
 	# Convert free space (agno, block, length) to (start sector, end sector)
 	$UMOUNT_PROG $loop_mnt
 	$XFS_DB_PROG -r -c "freesp -d" $img_file | $SED_PROG '/^.*from/,$d'| \
diff --git a/tests/xfs/067 b/tests/xfs/067
index 743d94bb..4aa8966d 100755
--- a/tests/xfs/067
+++ b/tests/xfs/067
@@ -53,7 +53,7 @@ if [ "$isize" -lt 1024 ]; then
 	|| _notrun "Cannot mkfs for this test using MKFS_OPTIONS specified"
 fi
 _scratch_mount
-xfs_info $SCRATCH_MNT >>$seqres.full
+$XFS_INFO_PROG $SCRATCH_MNT >>$seqres.full
 cd $SCRATCH_MNT
 
 echo ""
diff --git a/tests/xfs/073 b/tests/xfs/073
index 9bcc95dd..c1870be2 100755
--- a/tests/xfs/073
+++ b/tests/xfs/073
@@ -107,11 +107,11 @@ _verify_copy()
 	diff -u $tmp.manifest1 $tmp.manifest2
 
 	echo comparing new image geometry to old
-	xfs_info $source_dir \
+	$XFS_INFO_PROG $source_dir \
 		| _filter_copy $source $source_dir '/dev/loop.' '#' \
 		| tr -s ' ' \
 		> $tmp.geometry1
-	xfs_info $target_dir \
+	$XFS_INFO_PROG $target_dir \
 		| _filter_copy $target $target_dir '/dev/loop.' '#' \
 		| tr -s ' ' \
 		> $tmp.geometry2
diff --git a/tests/xfs/085 b/tests/xfs/085
index 57fc47c9..8f932292 100755
--- a/tests/xfs/085
+++ b/tests/xfs/085
@@ -78,7 +78,7 @@ for x in `seq 2 64`; do
 	touch "${TESTFILE}.${x}"
 done
 inode="$(stat -c '%i' "${TESTFILE}.1")"
-agcount="$(xfs_info "${SCRATCH_MNT}" | grep agcount= | sed -e 's/^.*agcount=\([0-9]*\),.*$/\1/g')"
+agcount="$($XFS_INFO_PROG "${SCRATCH_MNT}" | grep agcount= | sed -e 's/^.*agcount=\([0-9]*\),.*$/\1/g')"
 umount "${SCRATCH_MNT}"
 
 echo "+ check fs"
diff --git a/tests/xfs/086 b/tests/xfs/086
index 98b45dde..d05b0619 100755
--- a/tests/xfs/086
+++ b/tests/xfs/086
@@ -79,7 +79,7 @@ for x in `seq 2 64`; do
 	touch "${TESTFILE}.${x}"
 done
 inode="$(stat -c '%i' "${TESTFILE}.1")"
-agcount="$(xfs_info "${SCRATCH_MNT}" | grep agcount= | sed -e 's/^.*agcount=\([0-9]*\),.*$/\1/g')"
+agcount="$($XFS_INFO_PROG "${SCRATCH_MNT}" | grep agcount= | sed -e 's/^.*agcount=\([0-9]*\),.*$/\1/g')"
 test "${agcount}" -gt 1 || _notrun "Single-AG XFS not supported"
 umount "${SCRATCH_MNT}"
 
diff --git a/tests/xfs/087 b/tests/xfs/087
index 65877c7c..4549597c 100755
--- a/tests/xfs/087
+++ b/tests/xfs/087
@@ -79,7 +79,7 @@ for x in `seq 2 64`; do
 	touch "${TESTFILE}.${x}"
 done
 inode="$(stat -c '%i' "${TESTFILE}.1")"
-agcount="$(xfs_info "${SCRATCH_MNT}" | grep agcount= | sed -e 's/^.*agcount=\([0-9]*\),.*$/\1/g')"
+agcount="$($XFS_INFO_PROG "${SCRATCH_MNT}" | grep agcount= | sed -e 's/^.*agcount=\([0-9]*\),.*$/\1/g')"
 umount "${SCRATCH_MNT}"
 
 echo "+ check fs"
diff --git a/tests/xfs/088 b/tests/xfs/088
index 14b1f115..f46c1ead 100755
--- a/tests/xfs/088
+++ b/tests/xfs/088
@@ -79,7 +79,7 @@ for x in `seq 2 64`; do
 	touch "${TESTFILE}.${x}"
 done
 inode="$(stat -c '%i' "${TESTFILE}.1")"
-agcount="$(xfs_info "${SCRATCH_MNT}" | grep agcount= | sed -e 's/^.*agcount=\([0-9]*\),.*$/\1/g')"
+agcount="$($XFS_INFO_PROG "${SCRATCH_MNT}" | grep agcount= | sed -e 's/^.*agcount=\([0-9]*\),.*$/\1/g')"
 umount "${SCRATCH_MNT}"
 
 echo "+ check fs"
diff --git a/tests/xfs/089 b/tests/xfs/089
index e47f7fef..5b808604 100755
--- a/tests/xfs/089
+++ b/tests/xfs/089
@@ -79,7 +79,7 @@ for x in `seq 2 64`; do
 	touch "${TESTFILE}.${x}"
 done
 inode="$(stat -c '%i' "${TESTFILE}.1")"
-agcount="$(xfs_info "${SCRATCH_MNT}" | grep agcount= | sed -e 's/^.*agcount=\([0-9]*\),.*$/\1/g')"
+agcount="$($XFS_INFO_PROG "${SCRATCH_MNT}" | grep agcount= | sed -e 's/^.*agcount=\([0-9]*\),.*$/\1/g')"
 umount "${SCRATCH_MNT}"
 
 echo "+ check fs"
diff --git a/tests/xfs/091 b/tests/xfs/091
index 7adbdc9e..5e50e8a8 100755
--- a/tests/xfs/091
+++ b/tests/xfs/091
@@ -79,7 +79,7 @@ for x in `seq 2 64`; do
 	touch "${TESTFILE}.${x}"
 done
 inode="$(stat -c '%i' "${TESTFILE}.1")"
-agcount="$(xfs_info "${SCRATCH_MNT}" | grep agcount= | sed -e 's/^.*agcount=\([0-9]*\),.*$/\1/g')"
+agcount="$($XFS_INFO_PROG "${SCRATCH_MNT}" | grep agcount= | sed -e 's/^.*agcount=\([0-9]*\),.*$/\1/g')"
 umount "${SCRATCH_MNT}"
 
 echo "+ check fs"
diff --git a/tests/xfs/093 b/tests/xfs/093
index 440cdb66..aa9c360b 100755
--- a/tests/xfs/093
+++ b/tests/xfs/093
@@ -79,7 +79,7 @@ for x in `seq 2 64`; do
 	touch "${TESTFILE}.${x}"
 done
 inode="$(stat -c '%i' "${TESTFILE}.1")"
-agcount="$(xfs_info "${SCRATCH_MNT}" | grep agcount= | sed -e 's/^.*agcount=\([0-9]*\),.*$/\1/g')"
+agcount="$($XFS_INFO_PROG "${SCRATCH_MNT}" | grep agcount= | sed -e 's/^.*agcount=\([0-9]*\),.*$/\1/g')"
 umount "${SCRATCH_MNT}"
 
 echo "+ check fs"
diff --git a/tests/xfs/097 b/tests/xfs/097
index 703bd9b4..56104ee3 100755
--- a/tests/xfs/097
+++ b/tests/xfs/097
@@ -65,7 +65,7 @@ _scratch_mkfs_xfs > /dev/null
 
 echo "+ mount fs image"
 _scratch_mount
-xfs_info "${SCRATCH_MNT}" | grep -q "finobt=1" || _notrun "finobt not enabled"
+$XFS_INFO_PROG "${SCRATCH_MNT}" | grep -q "finobt=1" || _notrun "finobt not enabled"
 blksz="$(stat -f -c '%s' "${SCRATCH_MNT}")"
 
 echo "+ make some files"
@@ -82,7 +82,7 @@ for x in `seq 2 64`; do
 	touch "${TESTFILE}.${x}"
 done
 inode="$(stat -c '%i' "${TESTFILE}.1")"
-agcount="$(xfs_info "${SCRATCH_MNT}" | grep agcount= | sed -e 's/^.*agcount=\([0-9]*\),.*$/\1/g')"
+agcount="$($XFS_INFO_PROG "${SCRATCH_MNT}" | grep agcount= | sed -e 's/^.*agcount=\([0-9]*\),.*$/\1/g')"
 umount "${SCRATCH_MNT}"
 
 echo "+ check fs"
diff --git a/tests/xfs/099 b/tests/xfs/099
index 2d63536c..d9aad7e3 100755
--- a/tests/xfs/099
+++ b/tests/xfs/099
@@ -61,7 +61,7 @@ _scratch_mkfs_xfs > /dev/null
 
 echo "+ mount fs image"
 _scratch_mount
-dblksz="$(xfs_info "${SCRATCH_MNT}" | grep naming.*bsize | sed -e 's/^.*bsize=//g' -e 's/\([0-9]*\).*$/\1/g')"
+dblksz="$($XFS_INFO_PROG "${SCRATCH_MNT}" | grep naming.*bsize | sed -e 's/^.*bsize=//g' -e 's/\([0-9]*\).*$/\1/g')"
 nr="$((dblksz / 40))"
 blksz="$(stat -f -c '%s' "${SCRATCH_MNT}")"
 leaf_lblk="$((32 * 1073741824 / blksz))"
diff --git a/tests/xfs/100 b/tests/xfs/100
index 83146ee0..1e76fc45 100755
--- a/tests/xfs/100
+++ b/tests/xfs/100
@@ -61,7 +61,7 @@ _scratch_mkfs_xfs > /dev/null
 
 echo "+ mount fs image"
 _scratch_mount
-dblksz="$(xfs_info "${SCRATCH_MNT}" | grep naming.*bsize | sed -e 's/^.*bsize=//g' -e 's/\([0-9]*\).*$/\1/g')"
+dblksz="$($XFS_INFO_PROG "${SCRATCH_MNT}" | grep naming.*bsize | sed -e 's/^.*bsize=//g' -e 's/\([0-9]*\).*$/\1/g')"
 nr="$((dblksz / 12))"
 blksz="$(stat -f -c '%s' "${SCRATCH_MNT}")"
 leaf_lblk="$((32 * 1073741824 / blksz))"
diff --git a/tests/xfs/101 b/tests/xfs/101
index 426c3e9c..0e5ed604 100755
--- a/tests/xfs/101
+++ b/tests/xfs/101
@@ -61,7 +61,7 @@ _scratch_mkfs_xfs > /dev/null
 
 echo "+ mount fs image"
 _scratch_mount
-dblksz="$(xfs_info "${SCRATCH_MNT}" | grep naming.*bsize | sed -e 's/^.*bsize=//g' -e 's/\([0-9]*\).*$/\1/g')"
+dblksz="$($XFS_INFO_PROG "${SCRATCH_MNT}" | grep naming.*bsize | sed -e 's/^.*bsize=//g' -e 's/\([0-9]*\).*$/\1/g')"
 nr="$((dblksz / 12))"
 blksz="$(stat -f -c '%s' "${SCRATCH_MNT}")"
 leaf_lblk="$((32 * 1073741824 / blksz))"
diff --git a/tests/xfs/102 b/tests/xfs/102
index 02bc35ca..ec55c3a6 100755
--- a/tests/xfs/102
+++ b/tests/xfs/102
@@ -61,7 +61,7 @@ _scratch_mkfs_xfs > /dev/null
 
 echo "+ mount fs image"
 _scratch_mount
-dblksz="$(xfs_info "${SCRATCH_MNT}" | grep naming.*bsize | sed -e 's/^.*bsize=//g' -e 's/\([0-9]*\).*$/\1/g')"
+dblksz="$($XFS_INFO_PROG "${SCRATCH_MNT}" | grep naming.*bsize | sed -e 's/^.*bsize=//g' -e 's/\([0-9]*\).*$/\1/g')"
 nr="$((16 * dblksz / 40))"
 blksz="$(stat -f -c '%s' "${SCRATCH_MNT}")"
 leaf_lblk="$((32 * 1073741824 / blksz))"
diff --git a/tests/xfs/105 b/tests/xfs/105
index c3a853b0..bac6e282 100755
--- a/tests/xfs/105
+++ b/tests/xfs/105
@@ -61,7 +61,7 @@ _scratch_mkfs_xfs > /dev/null
 
 echo "+ mount fs image"
 _scratch_mount
-dblksz="$(xfs_info "${SCRATCH_MNT}" | grep naming.*bsize | sed -e 's/^.*bsize=//g' -e 's/\([0-9]*\).*$/\1/g')"
+dblksz="$($XFS_INFO_PROG "${SCRATCH_MNT}" | grep naming.*bsize | sed -e 's/^.*bsize=//g' -e 's/\([0-9]*\).*$/\1/g')"
 nr="$((16 * dblksz / 40))"
 blksz="$(stat -f -c '%s' "${SCRATCH_MNT}")"
 leaf_lblk="$((32 * 1073741824 / blksz))"
diff --git a/tests/xfs/112 b/tests/xfs/112
index cec3a168..fc2ee95d 100755
--- a/tests/xfs/112
+++ b/tests/xfs/112
@@ -61,7 +61,7 @@ _scratch_mkfs_xfs > /dev/null
 
 echo "+ mount fs image"
 _scratch_mount
-dblksz="$(xfs_info "${SCRATCH_MNT}" | grep naming.*bsize | sed -e 's/^.*bsize=//g' -e 's/\([0-9]*\).*$/\1/g')"
+dblksz="$($XFS_INFO_PROG "${SCRATCH_MNT}" | grep naming.*bsize | sed -e 's/^.*bsize=//g' -e 's/\([0-9]*\).*$/\1/g')"
 nr="$((16 * dblksz / 40))"
 blksz="$(stat -f -c '%s' "${SCRATCH_MNT}")"
 leaf_lblk="$((32 * 1073741824 / blksz))"
diff --git a/tests/xfs/113 b/tests/xfs/113
index 17af3b66..b19d948d 100755
--- a/tests/xfs/113
+++ b/tests/xfs/113
@@ -61,7 +61,7 @@ _scratch_mkfs_xfs > /dev/null
 
 echo "+ mount fs image"
 _scratch_mount
-dblksz="$(xfs_info "${SCRATCH_MNT}" | grep naming.*bsize | sed -e 's/^.*bsize=//g' -e 's/\([0-9]*\).*$/\1/g')"
+dblksz="$($XFS_INFO_PROG "${SCRATCH_MNT}" | grep naming.*bsize | sed -e 's/^.*bsize=//g' -e 's/\([0-9]*\).*$/\1/g')"
 nr="$((128 * dblksz / 40))"
 blksz="$(stat -f -c '%s' "${SCRATCH_MNT}")"
 leaf_lblk="$((32 * 1073741824 / blksz))"
diff --git a/tests/xfs/127 b/tests/xfs/127
index 60597fbf..863581df 100755
--- a/tests/xfs/127
+++ b/tests/xfs/127
@@ -68,7 +68,7 @@ _scratch_cycle_mount
 echo "Create more reflink copies"
 _cp_reflink $testdir/original $testdir/copy3
 
-xfs_info $SCRATCH_MNT >> $seqres.full
+$XFS_INFO_PROG $SCRATCH_MNT >> $seqres.full
 
 # success, all done
 status=0
diff --git a/tests/xfs/130 b/tests/xfs/130
index a9e0ff48..71df9bbd 100755
--- a/tests/xfs/130
+++ b/tests/xfs/130
@@ -58,7 +58,7 @@ _scratch_mkfs_xfs > /dev/null
 echo "+ mount fs image"
 _scratch_mount
 blksz="$(stat -f -c '%s' "${SCRATCH_MNT}")"
-agcount="$(xfs_info "${SCRATCH_MNT}" | grep agcount= | sed -e 's/^.*agcount=\([0-9]*\),.*$/\1/g')"
+agcount="$($XFS_INFO_PROG "${SCRATCH_MNT}" | grep agcount= | sed -e 's/^.*agcount=\([0-9]*\),.*$/\1/g')"
 
 echo "+ make some files"
 _pwrite_byte 0x62 0 $((blksz * 64)) "${SCRATCH_MNT}/file0" >> "$seqres.full"
diff --git a/tests/xfs/190 b/tests/xfs/190
index d6882162..251b7283 100755
--- a/tests/xfs/190
+++ b/tests/xfs/190
@@ -54,7 +54,7 @@ _supported_os Linux
 _require_scratch
 _scratch_mkfs_xfs >/dev/null 2>&1
 _scratch_mount
-fsblocksize=`xfs_info $SCRATCH_MNT|sed 's/=/ /g'|awk '/^data / { print $3 }'`
+fsblocksize=`$XFS_INFO_PROG $SCRATCH_MNT|sed 's/=/ /g'|awk '/^data / { print $3 }'`
 
 dd if=/dev/zero of=$SCRATCH_MNT/$filename bs=1024k count=10 >> $seqres.full 2>&1
 
diff --git a/tests/xfs/206 b/tests/xfs/206
index d5edf1ae..91467e90 100755
--- a/tests/xfs/206
+++ b/tests/xfs/206
@@ -104,7 +104,7 @@ xfs_growfs $tmpdir  | mkfs_filter
 
 # and double-check the new geometry
 echo "=== xfs_info ==="
-xfs_info $tmpdir | mkfs_filter
+$XFS_INFO_PROG $tmpdir | mkfs_filter
 
 # _cleanup cleans up for us
 
diff --git a/tests/xfs/233 b/tests/xfs/233
index b20dd4f1..9e7d3b32 100755
--- a/tests/xfs/233
+++ b/tests/xfs/233
@@ -66,7 +66,7 @@ _scratch_cycle_mount
 echo "Create more copies"
 cp -p $testdir/original $testdir/copy3
 
-xfs_info $SCRATCH_MNT >> $seqres.full
+$XFS_INFO_PROG $SCRATCH_MNT >> $seqres.full
 
 # success, all done
 status=0
diff --git a/tests/xfs/235 b/tests/xfs/235
index 84725b0a..f7d75e78 100755
--- a/tests/xfs/235
+++ b/tests/xfs/235
@@ -56,7 +56,7 @@ _scratch_mkfs_xfs > /dev/null
 echo "+ mount fs image"
 _scratch_mount
 blksz=$(stat -f -c '%s' ${SCRATCH_MNT})
-agcount=$(xfs_info ${SCRATCH_MNT} | grep agcount= | sed -e 's/^.*agcount=\([0-9]*\),.*$/\1/g')
+agcount=$($XFS_INFO_PROG ${SCRATCH_MNT} | grep agcount= | sed -e 's/^.*agcount=\([0-9]*\),.*$/\1/g')
 
 echo "+ make some files"
 _pwrite_byte 0x62 0 $((blksz * 64)) ${SCRATCH_MNT}/file0 >> $seqres.full
diff --git a/tests/xfs/271 b/tests/xfs/271
index 156cfae6..d82b19b7 100755
--- a/tests/xfs/271
+++ b/tests/xfs/271
@@ -51,7 +51,7 @@ echo "Format and mount"
 _scratch_mkfs > "$seqres.full" 2>&1
 _scratch_mount
 
-agcount=$(xfs_info $SCRATCH_MNT | grep agcount= | sed -e 's/^.*agcount=\([0-9]*\),.*$/\1/g')
+agcount=$($XFS_INFO_PROG $SCRATCH_MNT | grep agcount= | sed -e 's/^.*agcount=\([0-9]*\),.*$/\1/g')
 
 echo "Get fsmap" | tee -a $seqres.full
 $XFS_IO_PROG -c 'fsmap -v' $SCRATCH_MNT > $TEST_DIR/fsmap
diff --git a/tests/xfs/307 b/tests/xfs/307
index d8295245..4d88fccd 100755
--- a/tests/xfs/307
+++ b/tests/xfs/307
@@ -52,7 +52,7 @@ rm -f $seqres.full
 echo "Format"
 _scratch_mkfs > $seqres.full 2>&1
 _scratch_mount >> $seqres.full
-is_rmap=$(xfs_info $SCRATCH_MNT | grep -c "rmapbt=1")
+is_rmap=$($XFS_INFO_PROG $SCRATCH_MNT | grep -c "rmapbt=1")
 _scratch_unmount
 
 _get_agf_data() {
diff --git a/tests/xfs/308 b/tests/xfs/308
index 7e7adac3..3d346ec6 100755
--- a/tests/xfs/308
+++ b/tests/xfs/308
@@ -52,7 +52,7 @@ rm -f $seqres.full
 echo "Format"
 _scratch_mkfs > $seqres.full 2>&1
 _scratch_mount >> $seqres.full
-is_rmap=$(xfs_info $SCRATCH_MNT | grep -c "rmapbt=1")
+is_rmap=$($XFS_INFO_PROG $SCRATCH_MNT | grep -c "rmapbt=1")
 _scratch_unmount
 
 _get_agf_data() {
diff --git a/tests/xfs/310 b/tests/xfs/310
index f7b7e30e..f655693d 100755
--- a/tests/xfs/310
+++ b/tests/xfs/310
@@ -67,7 +67,7 @@ sectors=$(( (nr_blks * 3) * blksz / 512 )) # each AG must have > 2^21 blocks
 _dmhugedisk_init $sectors
 _mkfs_dev -d agcount=2 $DMHUGEDISK_DEV
 _mount $DMHUGEDISK_DEV $SCRATCH_MNT
-xfs_info $SCRATCH_MNT >> $seqres.full
+$XFS_INFO_PROG $SCRATCH_MNT >> $seqres.full
 
 echo "Create the original file blocks"
 mkdir $testdir
diff --git a/tests/xfs/348 b/tests/xfs/348
index 9d3bcb22..4702629e 100755
--- a/tests/xfs/348
+++ b/tests/xfs/348
@@ -70,7 +70,7 @@ mknod $testdir/CHRDEV c 1 1
 mknod $testdir/BLKDEV b 1 1
 mknod $testdir/FIFO p
 
-xfs_info $SCRATCH_MNT | grep -q "ftype=1" && FTYPE_FEATURE=1
+$XFS_INFO_PROG $SCRATCH_MNT | grep -q "ftype=1" && FTYPE_FEATURE=1
 
 # Record test dir inode for xfs_repair filter
 inode_filter=$tmp.sed


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

* [PATCH 6/6] xfs: make sure pretty printed geometry output matches
  2018-06-05 16:42 [PATCH 0/6] fstests: fixes and new tests Darrick J. Wong
                   ` (4 preceding siblings ...)
  2018-06-05 16:43 ` [PATCH 5/6] xfs: abstract xfs_info into $XFS_INFO_PROG Darrick J. Wong
@ 2018-06-05 16:43 ` Darrick J. Wong
  2018-06-07 12:48   ` Eryu Guan
  5 siblings, 1 reply; 15+ messages in thread
From: Darrick J. Wong @ 2018-06-05 16:43 UTC (permalink / raw)
  To: guaneryu, darrick.wong; +Cc: linux-xfs, fstests

From: Darrick J. Wong <darrick.wong@oracle.com>

Make sure that all of our commands that can print geometry information
all print the /same/ information.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 common/xfs        |   41 +++++++++++++++++++++++++
 tests/xfs/710     |   88 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/710.out |    2 +
 tests/xfs/group   |    1 +
 4 files changed, 132 insertions(+)
 create mode 100755 tests/xfs/710
 create mode 100644 tests/xfs/710.out


diff --git a/common/xfs b/common/xfs
index 3e34b118..bc35cd87 100644
--- a/common/xfs
+++ b/common/xfs
@@ -710,3 +710,44 @@ _require_xfs_db_write_array()
 	rm -f $TEST_DIR/$seq.img
 	[ $supported -eq 0 ] && _notrun "xfs_db write can't support array"
 }
+
+_require_xfs_spaceman_command()
+{
+	if [ -z "$1" ]
+	then
+		echo "Usage: _require_xfs_spaceman_command command [switch]" 1>&2
+		exit 1
+	fi
+	local command=$1
+	shift
+	local param="$*"
+	local param_checked=0
+	local opts=""
+
+	_require_command "$XFS_SPACEMAN_PROG" "xfs_spaceman"
+
+	testfile=$TEST_DIR/$$.xfs_spaceman
+	case $command in
+	*)
+		testio=`$XFS_SPACEMAN_PROG -c "help $command" $TEST_DIR 2>&1`
+	esac
+
+	rm -f $testfile 2>&1 > /dev/null
+	echo $testio | grep -q "not found" && \
+		_notrun "xfs_spaceman $command support is missing"
+	echo $testio | grep -q "Operation not supported" && \
+		_notrun "xfs_spaceman $command failed (old kernel/wrong fs?)"
+	echo $testio | grep -q "Invalid" && \
+		_notrun "xfs_spaceman $command failed (old kernel/wrong fs/bad args?)"
+	echo $testio | grep -q "foreign file active" && \
+		_notrun "xfs_spaceman $command not supported on $FSTYP"
+	echo $testio | grep -q "Function not implemented" && \
+		_notrun "xfs_spaceman $command support is missing (missing syscall?)"
+
+	[ -n "$param" ] || return
+
+	if [ $param_checked -eq 0 ]; then
+		$XFS_IO_PROG -c "help $command" | grep -q "^ $param --" || \
+			_notrun "xfs_spaceman $command doesn't support $param"
+	fi
+}
diff --git a/tests/xfs/710 b/tests/xfs/710
new file mode 100755
index 00000000..b03d4836
--- /dev/null
+++ b/tests/xfs/710
@@ -0,0 +1,88 @@
+#! /bin/bash
+# FS QA Test No. 710
+#
+# Make sure pretty printed XFS geometry is the same across all programs.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2018 Oracle, Inc.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#-----------------------------------------------------------------------
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1
+trap "_cleanup; rm -f $tmp.*; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -f $tmp.*
+}
+
+rm -f $seqres.full
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/xfs
+
+# real QA test starts here
+_supported_fs xfs
+_supported_os Linux
+
+_require_scratch_nocheck
+
+# Geometry printing wasn't unified until xfs_spaceman grew an 'info'
+# command, so skip this test if there is no spaceman or it doesn't
+# know what 'info' is.
+_require_xfs_spaceman_command "info"
+_require_command "$XFS_DB_PROG" xfs_db
+_require_command "$XFS_GROWFS_PROG" xfs_growfs
+_require_command "$XFS_INFO_PROG" xfs_info
+
+_scratch_mkfs > $tmp.mkfs
+echo MKFS >> $seqres.full
+cat $tmp.mkfs >> $seqres.full
+
+_scratch_xfs_db -c "info" > $tmp.dbinfo
+echo DB >> $seqres.full
+cat $tmp.dbinfo >> $seqres.full
+diff -u $tmp.mkfs $tmp.dbinfo
+
+_scratch_mount
+
+$XFS_SPACEMAN_PROG -c "info" $SCRATCH_MNT > $tmp.spaceman
+echo SPACEMAN >> $seqres.full
+cat $tmp.spaceman >> $seqres.full
+diff -u $tmp.mkfs $tmp.spaceman
+
+$XFS_GROWFS_PROG -n $SCRATCH_MNT > $tmp.growfs
+echo GROWFS >> $seqres.full
+cat $tmp.growfs >> $seqres.full
+diff -u $tmp.mkfs $tmp.growfs
+
+$XFS_INFO_PROG $SCRATCH_MNT > $tmp.info
+echo INFO >> $seqres.full
+cat $tmp.info >> $seqres.full
+diff -u $tmp.mkfs $tmp.info
+
+echo "Silence is golden."
+status=0
+exit 0
diff --git a/tests/xfs/710.out b/tests/xfs/710.out
new file mode 100644
index 00000000..ae2659d5
--- /dev/null
+++ b/tests/xfs/710.out
@@ -0,0 +1,2 @@
+QA output created by 710
+Silence is golden.
diff --git a/tests/xfs/group b/tests/xfs/group
index 2319f58f..9dd30ae0 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -445,3 +445,4 @@
 445 auto quick filestreams
 446 auto quick
 447 auto mount
+710 auto quick


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

* Re: [PATCH 5/6] xfs: abstract xfs_info into $XFS_INFO_PROG
  2018-06-05 16:43 ` [PATCH 5/6] xfs: abstract xfs_info into $XFS_INFO_PROG Darrick J. Wong
@ 2018-06-07 11:37   ` Eryu Guan
  2018-06-07 15:03     ` Darrick J. Wong
  0 siblings, 1 reply; 15+ messages in thread
From: Eryu Guan @ 2018-06-07 11:37 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: linux-xfs, fstests

On Tue, Jun 05, 2018 at 09:43:27AM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Abstract calls to xfs_info into $XFS_INFO_PROG like we do for all other
> xfs utilities.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  common/attr      |    2 +-
>  common/config    |    1 +
>  common/populate  |   18 +++++++++---------
>  common/rc        |    2 +-

Better to make xfs_info mandatory too when testing xfs, so I did the
below diff on commit

diff --git a/common/rc b/common/rc
index f04c9ea2fd89..9d6665b6c4d7 100644
--- a/common/rc
+++ b/common/rc
@@ -136,6 +136,7 @@ case "$FSTYP" in
         [ "$XFS_REPAIR_PROG" = "" ] && _fatal "xfs_repair not found"
         [ "$XFS_DB_PROG" = "" ] && _fatal "xfs_db not found"
         [ "$MKFS_XFS_PROG" = "" ] && _fatal "mkfs_xfs not found"
+        [ "$XFS_INFO_PROG" = "" ] && _fatal "xfs_info not found"

         . ./common/xfs
         ;;

Thanks,
Eryu

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

* Re: [PATCH 4/6] generic: test swapfile creation, activation, and deactivation
  2018-06-05 16:43 ` [PATCH 4/6] generic: test swapfile creation, activation, and deactivation Darrick J. Wong
@ 2018-06-07 12:34   ` Eryu Guan
  2018-06-07 15:01     ` Darrick J. Wong
  2018-06-07 15:17   ` [PATCH v2 " Darrick J. Wong
  1 sibling, 1 reply; 15+ messages in thread
From: Eryu Guan @ 2018-06-07 12:34 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: linux-xfs, fstests

On Tue, Jun 05, 2018 at 09:43:20AM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Test swapfile activation and deactivation.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  tests/generic/708     |  115 +++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/generic/708.out |    8 +++
>  tests/generic/709     |   91 +++++++++++++++++++++++++++++++++++++++
>  tests/generic/709.out |    3 +
>  tests/generic/710     |   94 ++++++++++++++++++++++++++++++++++++++++
>  tests/generic/710.out |    3 +
>  tests/generic/group   |    3 +
>  7 files changed, 317 insertions(+)
>  create mode 100755 tests/generic/708
>  create mode 100644 tests/generic/708.out
>  create mode 100755 tests/generic/709
>  create mode 100644 tests/generic/709.out
>  create mode 100755 tests/generic/710
>  create mode 100644 tests/generic/710.out
> 
> 
> diff --git a/tests/generic/708 b/tests/generic/708
> new file mode 100755
> index 00000000..dc3c2924
> --- /dev/null
> +++ b/tests/generic/708
> @@ -0,0 +1,115 @@
> +#! /bin/bash
> +# FS QA Test No. 708
> +#
> +# Test various swapfile activation oddities.
> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2018 Oracle.  All Rights Reserved.
> +#
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License as
> +# published by the Free Software Foundation.
> +#
> +# This program is distributed in the hope that it would be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write the Free Software Foundation,
> +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> +#
> +#-----------------------------------------------------------------------
> +
> +seq=`basename $0`
> +seqres=$RESULT_DIR/$seq
> +echo "QA output created by $seq"
> +
> +status=1	# failure is the default!
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +_cleanup()
> +{
> +	cd /
> +	swapoff $swapfile 2> /dev/null
> +	rm -f $swapfile

No need to remove $swapfile which is on $SCRATCH_DEV, but need to remove
$tmp.* :)

(Same in other tests)

> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +
> +# remove previous $seqres.full before test
> +rm -f $seqres.full
> +
> +# real QA test starts here
> +_supported_fs generic
> +_supported_os Linux
> +_require_scratch_swapfile
> +_require_test_program mkswap
> +_require_test_program swapon

Need _require_xfs_io_command "fcollapse" too, and add 'collapse' group.

> +
> +rm -f $seqres.full
> +_scratch_mkfs >>$seqres.full 2>&1
> +_scratch_mount >>$seqres.full 2>&1
> +
> +swapfile=$SCRATCH_MNT/swap
> +len=$((2 * 1048576))
> +page_size=$(get_page_size)
> +
> +swapfile_cycle() {
> +	local swapfile="$1"
> +
> +	$CHATTR_PROG +C $swapfile >> $seqres.full 2>&1
> +	"$here/src/mkswap" $swapfile >> $seqres.full
> +	"$here/src/swapon" $swapfile 2>&1 | _filter_scratch
> +	swapoff $swapfile 2>> $seeqres.full
> +	rm -f $swapfile
> +}
> +
> +# Create a regular swap file
> +echo "regular swap" | tee -a $seqres.full
> +_pwrite_byte 0x58 0 $len $swapfile >> $seqres.full
> +swapfile_cycle $swapfile
> +
> +# Create a sparse swap file
> +echo "sparse swap" | tee -a $seqres.full
> +$XFS_IO_PROG -f -c "truncate $len" $swapfile >> $seqres.full
> +swapfile_cycle $swapfile

This is already covered by generic/495.

> +
> +# Create a swap file with a little too much junk on the end
> +echo "too long swap" | tee -a $seqres.full
> +_pwrite_byte 0x58 0 $((len + 3)) $swapfile >> $seqres.full
> +swapfile_cycle $swapfile
> +
> +# Create a swap file with a large discontiguous range(?)
> +echo "large discontig swap" | tee -a $seqres.full
> +_pwrite_byte 0x58 0 $((len * 2)) $swapfile >> $seqres.full
> +old_sz="$(stat -c '%s' $swapfile)"
> +$XFS_IO_PROG -c "fcollapse $((len / 2)) $len" $swapfile >> $seqres.full 2>&1
> +new_sz="$(stat -c '%s' $swapfile)"
> +if [ $old_sz -gt $new_sz ]; then
> +	swapfile_cycle $swapfile
> +fi
> +rm -f $swapfile
> +
> +# Create a swap file with a small discontiguous range(?)
> +echo "small discontig swap" | tee -a $seqres.full
> +_pwrite_byte 0x58 0 $((len + 1024)) $swapfile >> $seqres.full
> +old_sz="$(stat -c '%s' $swapfile)"
> +$XFS_IO_PROG -c "fcollapse 66560 1024" $swapfile >> $seqres.full 2>&1
> +new_sz="$(stat -c '%s' $swapfile)"
> +if [ $old_sz -gt $new_sz ]; then
> +	swapfile_cycle $swapfile
> +fi
> +rm -f $swapfile

Above two cases are duplicated in generic/710 below? Perhaps generic/710
could be dropped.

Thanks,
Eryu

> +
> +# Create a ridiculously small swap file.  Each swap file must have at least
> +# two pages after the header page.
> +echo "tiny swap" | tee -a $seqres.full
> +tiny_len=$((page_size * 3))
> +_pwrite_byte 0x58 0 $tiny_len $swapfile >> $seqres.full
> +swapfile_cycle $swapfile
> +
> +status=0
> +exit
> diff --git a/tests/generic/708.out b/tests/generic/708.out
> new file mode 100644
> index 00000000..d002974c
> --- /dev/null
> +++ b/tests/generic/708.out
> @@ -0,0 +1,8 @@
> +QA output created by 708
> +regular swap
> +sparse swap
> +swapon: Invalid argument
> +too long swap
> +large discontig swap
> +small discontig swap
> +tiny swap
> diff --git a/tests/generic/709 b/tests/generic/709
> new file mode 100755
> index 00000000..5e636305
> --- /dev/null
> +++ b/tests/generic/709
> @@ -0,0 +1,91 @@
> +#! /bin/bash
> +# FS QA Test No. 709
> +#
> +# Test various swapfile activation oddities on filesystems that support
> +# fallocated swapfiles.
> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2018 Oracle.  All Rights Reserved.
> +#
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License as
> +# published by the Free Software Foundation.
> +#
> +# This program is distributed in the hope that it would be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write the Free Software Foundation,
> +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> +#
> +#-----------------------------------------------------------------------
> +
> +seq=`basename $0`
> +seqres=$RESULT_DIR/$seq
> +echo "QA output created by $seq"
> +
> +status=1	# failure is the default!
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +_cleanup()
> +{
> +	cd /
> +	swapoff $swapfile 2> /dev/null
> +	rm -f $swapfile
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +
> +# remove previous $seqres.full before test
> +rm -f $seqres.full
> +
> +# real QA test starts here
> +_supported_fs generic
> +_supported_os Linux
> +_require_scratch_swapfile
> +_require_test_program mkswap
> +_require_test_program swapon
> +_require_xfs_io_command "falloc"
> +
> +rm -f $seqres.full
> +_scratch_mkfs >>$seqres.full 2>&1
> +_scratch_mount >>$seqres.full 2>&1
> +
> +swapfile=$SCRATCH_MNT/swap
> +len=$((2 * 1048576))
> +page_size=$(get_page_size)
> +
> +swapfile_cycle() {
> +	local swapfile="$1"
> +
> +	$CHATTR_PROG +C $swapfile >> $seqres.full 2>&1
> +	"$here/src/mkswap" $swapfile >> $seqres.full
> +	"$here/src/swapon" $swapfile 2>&1 | _filter_scratch
> +	swapoff $swapfile 2>> $seeqres.full
> +	rm -f $swapfile
> +}
> +
> +# Create a fallocated swap file
> +echo "fallocate swap" | tee -a $seqres.full
> +$XFS_IO_PROG -f -c "falloc 0 $len" $swapfile >> $seqres.full
> +$CHATTR_PROG +C $swapfile >> $seqres.full 2>&1
> +"$here/src/mkswap" $swapfile
> +"$here/src/swapon" $swapfile >> $seqres.full 2>&1 || \
> +	_notrun "fallocated swap not supported here"
> +swapoff $swapfile
> +
> +# Create a fallocated swap file and touch every other $PAGE_SIZE to create
> +# a mess of written/unwritten extent records
> +echo "mixed swap" | tee -a $seqres.full
> +$XFS_IO_PROG -f -c "falloc 0 $len" $swapfile >> $seqres.full
> +seq $page_size $((page_size * 2)) $len | while read offset; do
> +	_pwrite_byte 0x58 $offset 1 $swapfile >> $seqres.full
> +done
> +swapfile_cycle $swapfile
> +
> +status=0
> +exit
> diff --git a/tests/generic/709.out b/tests/generic/709.out
> new file mode 100644
> index 00000000..90ba38ae
> --- /dev/null
> +++ b/tests/generic/709.out
> @@ -0,0 +1,3 @@
> +QA output created by 709
> +fallocate swap
> +mixed swap
> diff --git a/tests/generic/710 b/tests/generic/710
> new file mode 100755
> index 00000000..e9dc3f08
> --- /dev/null
> +++ b/tests/generic/710
> @@ -0,0 +1,94 @@
> +#! /bin/bash
> +# FS QA Test No. 710
> +#
> +# Test various swapfile activation oddities, having used fcollapse to
> +# create discontiguous ranges in the file.
> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2018 Oracle.  All Rights Reserved.
> +#
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License as
> +# published by the Free Software Foundation.
> +#
> +# This program is distributed in the hope that it would be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write the Free Software Foundation,
> +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> +#
> +#-----------------------------------------------------------------------
> +
> +seq=`basename $0`
> +seqres=$RESULT_DIR/$seq
> +echo "QA output created by $seq"
> +
> +status=1	# failure is the default!
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +_cleanup()
> +{
> +	cd /
> +	swapoff $swapfile 2> /dev/null
> +	rm -f $swapfile
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +
> +# remove previous $seqres.full before test
> +rm -f $seqres.full
> +
> +# real QA test starts here
> +_supported_fs generic
> +_supported_os Linux
> +_require_scratch_swapfile
> +_require_test_program mkswap
> +_require_test_program swapon
> +_require_xfs_io_command "fcollapse"
> +
> +rm -f $seqres.full
> +_scratch_mkfs >>$seqres.full 2>&1
> +_scratch_mount >>$seqres.full 2>&1
> +
> +swapfile=$SCRATCH_MNT/swap
> +len=$((2 * 1048576))
> +page_size=$(get_page_size)
> +
> +swapfile_cycle() {
> +	local swapfile="$1"
> +
> +	"$here/src/mkswap" $swapfile >> $seqres.full
> +	"$here/src/swapon" $swapfile 2>&1 | _filter_scratch
> +	swapoff $swapfile 2>> $seeqres.full
> +	rm -f $swapfile
> +}
> +
> +# Create a swap file with a large discontiguous range(?)
> +echo "large discontig swap" | tee -a $seqres.full
> +_pwrite_byte 0x58 0 $((len * 2)) $swapfile >> $seqres.full
> +old_sz="$(stat -c '%s' $swapfile)"
> +$XFS_IO_PROG -c "fcollapse $((len / 2)) $len" $swapfile >> $seqres.full 2>&1
> +new_sz="$(stat -c '%s' $swapfile)"
> +if [ $old_sz -gt $new_sz ]; then
> +	swapfile_cycle $swapfile
> +fi
> +rm -f $swapfile
> +
> +# Create a swap file with a small discontiguous range(?)
> +echo "small discontig swap" | tee -a $seqres.full
> +_pwrite_byte 0x58 0 $((len + 1024)) $swapfile >> $seqres.full
> +old_sz="$(stat -c '%s' $swapfile)"
> +$XFS_IO_PROG -c "fcollapse 66560 1024" $swapfile >> $seqres.full 2>&1
> +new_sz="$(stat -c '%s' $swapfile)"
> +if [ $old_sz -gt $new_sz ]; then
> +	swapfile_cycle $swapfile
> +fi
> +rm -f $swapfile
> +
> +status=0
> +exit
> diff --git a/tests/generic/710.out b/tests/generic/710.out
> new file mode 100644
> index 00000000..ba1f8e40
> --- /dev/null
> +++ b/tests/generic/710.out
> @@ -0,0 +1,3 @@
> +QA output created by 710
> +large discontig swap
> +small discontig swap
> diff --git a/tests/generic/group b/tests/generic/group
> index 4339c64c..6d747450 100644
> --- a/tests/generic/group
> +++ b/tests/generic/group
> @@ -497,3 +497,6 @@
>  493 auto quick swap
>  494 auto quick swap punch
>  495 auto quick swap
> +708 auto quick swap
> +709 auto quick swap
> +710 auto quick swap collapse
> 

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

* Re: [PATCH 6/6] xfs: make sure pretty printed geometry output matches
  2018-06-05 16:43 ` [PATCH 6/6] xfs: make sure pretty printed geometry output matches Darrick J. Wong
@ 2018-06-07 12:48   ` Eryu Guan
  2018-06-07 15:13     ` Darrick J. Wong
  0 siblings, 1 reply; 15+ messages in thread
From: Eryu Guan @ 2018-06-07 12:48 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: linux-xfs, fstests

On Tue, Jun 05, 2018 at 09:43:33AM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Make sure that all of our commands that can print geometry information
> all print the /same/ information.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  common/xfs        |   41 +++++++++++++++++++++++++
>  tests/xfs/710     |   88 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/xfs/710.out |    2 +
>  tests/xfs/group   |    1 +
>  4 files changed, 132 insertions(+)
>  create mode 100755 tests/xfs/710
>  create mode 100644 tests/xfs/710.out
> 
> 
> diff --git a/common/xfs b/common/xfs
> index 3e34b118..bc35cd87 100644
> --- a/common/xfs
> +++ b/common/xfs
> @@ -710,3 +710,44 @@ _require_xfs_db_write_array()
>  	rm -f $TEST_DIR/$seq.img
>  	[ $supported -eq 0 ] && _notrun "xfs_db write can't support array"
>  }
> +
> +_require_xfs_spaceman_command()
> +{
> +	if [ -z "$1" ]
> +	then
> +		echo "Usage: _require_xfs_spaceman_command command [switch]" 1>&2
> +		exit 1
> +	fi
> +	local command=$1
> +	shift
> +	local param="$*"
> +	local param_checked=0
> +	local opts=""
> +
> +	_require_command "$XFS_SPACEMAN_PROG" "xfs_spaceman"
> +
> +	testfile=$TEST_DIR/$$.xfs_spaceman
> +	case $command in
> +	*)
> +		testio=`$XFS_SPACEMAN_PROG -c "help $command" $TEST_DIR 2>&1`
> +	esac
> +
> +	rm -f $testfile 2>&1 > /dev/null
> +	echo $testio | grep -q "not found" && \
> +		_notrun "xfs_spaceman $command support is missing"
> +	echo $testio | grep -q "Operation not supported" && \
> +		_notrun "xfs_spaceman $command failed (old kernel/wrong fs?)"
> +	echo $testio | grep -q "Invalid" && \
> +		_notrun "xfs_spaceman $command failed (old kernel/wrong fs/bad args?)"
> +	echo $testio | grep -q "foreign file active" && \
> +		_notrun "xfs_spaceman $command not supported on $FSTYP"
> +	echo $testio | grep -q "Function not implemented" && \
> +		_notrun "xfs_spaceman $command support is missing (missing syscall?)"
> +
> +	[ -n "$param" ] || return
> +
> +	if [ $param_checked -eq 0 ]; then
> +		$XFS_IO_PROG -c "help $command" | grep -q "^ $param --" || \
                 ^^^^^^^^^^^ XFS_SPACEMAN_PROG

> +			_notrun "xfs_spaceman $command doesn't support $param"
> +	fi
> +}
> diff --git a/tests/xfs/710 b/tests/xfs/710
> new file mode 100755
> index 00000000..b03d4836
> --- /dev/null
> +++ b/tests/xfs/710
> @@ -0,0 +1,88 @@
> +#! /bin/bash
> +# FS QA Test No. 710
> +#
> +# Make sure pretty printed XFS geometry is the same across all programs.
> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2018 Oracle, Inc.
> +#
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License as
> +# published by the Free Software Foundation.
> +#
> +# This program is distributed in the hope that it would be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write the Free Software Foundation,
> +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> +#
> +#-----------------------------------------------------------------------
> +#
> +
> +seq=`basename $0`
> +seqres=$RESULT_DIR/$seq
> +echo "QA output created by $seq"
> +
> +here=`pwd`
> +tmp=/tmp/$$
> +status=1
> +trap "_cleanup; rm -f $tmp.*; exit \$status" 0 1 2 3 15

"rm -f $tmp.*" is done in _cleanup()

> +
> +_cleanup()
> +{
> +	cd /
> +	rm -f $tmp.*
> +}
> +
> +rm -f $seqres.full
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/xfs

No need to source common/xfs, common/rc will source it automatically.

> +
> +# real QA test starts here
> +_supported_fs xfs
> +_supported_os Linux
> +
> +_require_scratch_nocheck
> +
> +# Geometry printing wasn't unified until xfs_spaceman grew an 'info'
> +# command, so skip this test if there is no spaceman or it doesn't
> +# know what 'info' is.
> +_require_xfs_spaceman_command "info"
> +_require_command "$XFS_DB_PROG" xfs_db
> +_require_command "$XFS_GROWFS_PROG" xfs_growfs
> +_require_command "$XFS_INFO_PROG" xfs_info

xfs_db and xfs_info (I fixed that up on commit) have been checked in
common/rc, just need to check xfs_growfs here.

These are all trivial and easy to fix, I'll just fix them on commit too.

Thanks,
Eryu

> +
> +_scratch_mkfs > $tmp.mkfs
> +echo MKFS >> $seqres.full
> +cat $tmp.mkfs >> $seqres.full
> +
> +_scratch_xfs_db -c "info" > $tmp.dbinfo
> +echo DB >> $seqres.full
> +cat $tmp.dbinfo >> $seqres.full
> +diff -u $tmp.mkfs $tmp.dbinfo
> +
> +_scratch_mount
> +
> +$XFS_SPACEMAN_PROG -c "info" $SCRATCH_MNT > $tmp.spaceman
> +echo SPACEMAN >> $seqres.full
> +cat $tmp.spaceman >> $seqres.full
> +diff -u $tmp.mkfs $tmp.spaceman
> +
> +$XFS_GROWFS_PROG -n $SCRATCH_MNT > $tmp.growfs
> +echo GROWFS >> $seqres.full
> +cat $tmp.growfs >> $seqres.full
> +diff -u $tmp.mkfs $tmp.growfs
> +
> +$XFS_INFO_PROG $SCRATCH_MNT > $tmp.info
> +echo INFO >> $seqres.full
> +cat $tmp.info >> $seqres.full
> +diff -u $tmp.mkfs $tmp.info
> +
> +echo "Silence is golden."
> +status=0
> +exit 0
> diff --git a/tests/xfs/710.out b/tests/xfs/710.out
> new file mode 100644
> index 00000000..ae2659d5
> --- /dev/null
> +++ b/tests/xfs/710.out
> @@ -0,0 +1,2 @@
> +QA output created by 710
> +Silence is golden.
> diff --git a/tests/xfs/group b/tests/xfs/group
> index 2319f58f..9dd30ae0 100644
> --- a/tests/xfs/group
> +++ b/tests/xfs/group
> @@ -445,3 +445,4 @@
>  445 auto quick filestreams
>  446 auto quick
>  447 auto mount
> +710 auto quick
> 

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

* Re: [PATCH 4/6] generic: test swapfile creation, activation, and deactivation
  2018-06-07 12:34   ` Eryu Guan
@ 2018-06-07 15:01     ` Darrick J. Wong
  0 siblings, 0 replies; 15+ messages in thread
From: Darrick J. Wong @ 2018-06-07 15:01 UTC (permalink / raw)
  To: Eryu Guan; +Cc: linux-xfs, fstests

On Thu, Jun 07, 2018 at 08:34:38PM +0800, Eryu Guan wrote:
> On Tue, Jun 05, 2018 at 09:43:20AM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <darrick.wong@oracle.com>
> > 
> > Test swapfile activation and deactivation.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> >  tests/generic/708     |  115 +++++++++++++++++++++++++++++++++++++++++++++++++
> >  tests/generic/708.out |    8 +++
> >  tests/generic/709     |   91 +++++++++++++++++++++++++++++++++++++++
> >  tests/generic/709.out |    3 +
> >  tests/generic/710     |   94 ++++++++++++++++++++++++++++++++++++++++
> >  tests/generic/710.out |    3 +
> >  tests/generic/group   |    3 +
> >  7 files changed, 317 insertions(+)
> >  create mode 100755 tests/generic/708
> >  create mode 100644 tests/generic/708.out
> >  create mode 100755 tests/generic/709
> >  create mode 100644 tests/generic/709.out
> >  create mode 100755 tests/generic/710
> >  create mode 100644 tests/generic/710.out
> > 
> > 
> > diff --git a/tests/generic/708 b/tests/generic/708
> > new file mode 100755
> > index 00000000..dc3c2924
> > --- /dev/null
> > +++ b/tests/generic/708
> > @@ -0,0 +1,115 @@
> > +#! /bin/bash
> > +# FS QA Test No. 708
> > +#
> > +# Test various swapfile activation oddities.
> > +#
> > +#-----------------------------------------------------------------------
> > +# Copyright (c) 2018 Oracle.  All Rights Reserved.
> > +#
> > +# This program is free software; you can redistribute it and/or
> > +# modify it under the terms of the GNU General Public License as
> > +# published by the Free Software Foundation.
> > +#
> > +# This program is distributed in the hope that it would be useful,
> > +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > +# GNU General Public License for more details.
> > +#
> > +# You should have received a copy of the GNU General Public License
> > +# along with this program; if not, write the Free Software Foundation,
> > +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> > +#
> > +#-----------------------------------------------------------------------
> > +
> > +seq=`basename $0`
> > +seqres=$RESULT_DIR/$seq
> > +echo "QA output created by $seq"
> > +
> > +status=1	# failure is the default!
> > +trap "_cleanup; exit \$status" 0 1 2 3 15
> > +
> > +_cleanup()
> > +{
> > +	cd /
> > +	swapoff $swapfile 2> /dev/null
> > +	rm -f $swapfile
> 
> No need to remove $swapfile which is on $SCRATCH_DEV, but need to remove
> $tmp.* :)

Ok.  I remember deleting that for some reason, sorry for the thinko.

> (Same in other tests)
> 
> > +}
> > +
> > +# get standard environment, filters and checks
> > +. ./common/rc
> > +. ./common/filter
> > +
> > +# remove previous $seqres.full before test
> > +rm -f $seqres.full
> > +
> > +# real QA test starts here
> > +_supported_fs generic
> > +_supported_os Linux
> > +_require_scratch_swapfile
> > +_require_test_program mkswap
> > +_require_test_program swapon
> 
> Need _require_xfs_io_command "fcollapse" too, and add 'collapse' group.

Looking at this test I wonder wtf is going on, I thought I moved all the
fcollapse bits to 710.  Apparently I forgot to remove them from 708.

> > +
> > +rm -f $seqres.full
> > +_scratch_mkfs >>$seqres.full 2>&1
> > +_scratch_mount >>$seqres.full 2>&1
> > +
> > +swapfile=$SCRATCH_MNT/swap
> > +len=$((2 * 1048576))
> > +page_size=$(get_page_size)
> > +
> > +swapfile_cycle() {
> > +	local swapfile="$1"
> > +
> > +	$CHATTR_PROG +C $swapfile >> $seqres.full 2>&1
> > +	"$here/src/mkswap" $swapfile >> $seqres.full
> > +	"$here/src/swapon" $swapfile 2>&1 | _filter_scratch
> > +	swapoff $swapfile 2>> $seeqres.full
> > +	rm -f $swapfile
> > +}
> > +
> > +# Create a regular swap file
> > +echo "regular swap" | tee -a $seqres.full
> > +_pwrite_byte 0x58 0 $len $swapfile >> $seqres.full
> > +swapfile_cycle $swapfile
> > +
> > +# Create a sparse swap file
> > +echo "sparse swap" | tee -a $seqres.full
> > +$XFS_IO_PROG -f -c "truncate $len" $swapfile >> $seqres.full
> > +swapfile_cycle $swapfile
> 
> This is already covered by generic/495.

Ok, dropped.

> > +
> > +# Create a swap file with a little too much junk on the end
> > +echo "too long swap" | tee -a $seqres.full
> > +_pwrite_byte 0x58 0 $((len + 3)) $swapfile >> $seqres.full
> > +swapfile_cycle $swapfile
> > +
> > +# Create a swap file with a large discontiguous range(?)
> > +echo "large discontig swap" | tee -a $seqres.full
> > +_pwrite_byte 0x58 0 $((len * 2)) $swapfile >> $seqres.full
> > +old_sz="$(stat -c '%s' $swapfile)"
> > +$XFS_IO_PROG -c "fcollapse $((len / 2)) $len" $swapfile >> $seqres.full 2>&1
> > +new_sz="$(stat -c '%s' $swapfile)"
> > +if [ $old_sz -gt $new_sz ]; then
> > +	swapfile_cycle $swapfile
> > +fi
> > +rm -f $swapfile
> > +
> > +# Create a swap file with a small discontiguous range(?)
> > +echo "small discontig swap" | tee -a $seqres.full
> > +_pwrite_byte 0x58 0 $((len + 1024)) $swapfile >> $seqres.full
> > +old_sz="$(stat -c '%s' $swapfile)"
> > +$XFS_IO_PROG -c "fcollapse 66560 1024" $swapfile >> $seqres.full 2>&1
> > +new_sz="$(stat -c '%s' $swapfile)"
> > +if [ $old_sz -gt $new_sz ]; then
> > +	swapfile_cycle $swapfile
> > +fi
> > +rm -f $swapfile
> 
> Above two cases are duplicated in generic/710 below? Perhaps generic/710
> could be dropped.

Nah, dropping these and letting 710 cover it, for those filesystems that
support swapfiles but not fcollapse (e.g. ext2).

> Thanks,
> Eryu
> 
> > +
> > +# Create a ridiculously small swap file.  Each swap file must have at least
> > +# two pages after the header page.
> > +echo "tiny swap" | tee -a $seqres.full
> > +tiny_len=$((page_size * 3))
> > +_pwrite_byte 0x58 0 $tiny_len $swapfile >> $seqres.full
> > +swapfile_cycle $swapfile
> > +
> > +status=0
> > +exit
> > diff --git a/tests/generic/708.out b/tests/generic/708.out
> > new file mode 100644
> > index 00000000..d002974c
> > --- /dev/null
> > +++ b/tests/generic/708.out
> > @@ -0,0 +1,8 @@
> > +QA output created by 708
> > +regular swap
> > +sparse swap
> > +swapon: Invalid argument
> > +too long swap
> > +large discontig swap
> > +small discontig swap
> > +tiny swap
> > diff --git a/tests/generic/709 b/tests/generic/709
> > new file mode 100755
> > index 00000000..5e636305
> > --- /dev/null
> > +++ b/tests/generic/709
> > @@ -0,0 +1,91 @@
> > +#! /bin/bash
> > +# FS QA Test No. 709
> > +#
> > +# Test various swapfile activation oddities on filesystems that support
> > +# fallocated swapfiles.
> > +#
> > +#-----------------------------------------------------------------------
> > +# Copyright (c) 2018 Oracle.  All Rights Reserved.
> > +#
> > +# This program is free software; you can redistribute it and/or
> > +# modify it under the terms of the GNU General Public License as
> > +# published by the Free Software Foundation.
> > +#
> > +# This program is distributed in the hope that it would be useful,
> > +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > +# GNU General Public License for more details.
> > +#
> > +# You should have received a copy of the GNU General Public License
> > +# along with this program; if not, write the Free Software Foundation,
> > +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> > +#
> > +#-----------------------------------------------------------------------
> > +
> > +seq=`basename $0`
> > +seqres=$RESULT_DIR/$seq
> > +echo "QA output created by $seq"
> > +
> > +status=1	# failure is the default!
> > +trap "_cleanup; exit \$status" 0 1 2 3 15
> > +
> > +_cleanup()
> > +{
> > +	cd /
> > +	swapoff $swapfile 2> /dev/null
> > +	rm -f $swapfile
> > +}
> > +
> > +# get standard environment, filters and checks
> > +. ./common/rc
> > +. ./common/filter
> > +
> > +# remove previous $seqres.full before test
> > +rm -f $seqres.full
> > +
> > +# real QA test starts here
> > +_supported_fs generic
> > +_supported_os Linux
> > +_require_scratch_swapfile
> > +_require_test_program mkswap
> > +_require_test_program swapon
> > +_require_xfs_io_command "falloc"
> > +
> > +rm -f $seqres.full
> > +_scratch_mkfs >>$seqres.full 2>&1
> > +_scratch_mount >>$seqres.full 2>&1
> > +
> > +swapfile=$SCRATCH_MNT/swap
> > +len=$((2 * 1048576))
> > +page_size=$(get_page_size)
> > +
> > +swapfile_cycle() {
> > +	local swapfile="$1"
> > +
> > +	$CHATTR_PROG +C $swapfile >> $seqres.full 2>&1
> > +	"$here/src/mkswap" $swapfile >> $seqres.full
> > +	"$here/src/swapon" $swapfile 2>&1 | _filter_scratch
> > +	swapoff $swapfile 2>> $seeqres.full
> > +	rm -f $swapfile
> > +}
> > +
> > +# Create a fallocated swap file
> > +echo "fallocate swap" | tee -a $seqres.full
> > +$XFS_IO_PROG -f -c "falloc 0 $len" $swapfile >> $seqres.full
> > +$CHATTR_PROG +C $swapfile >> $seqres.full 2>&1
> > +"$here/src/mkswap" $swapfile
> > +"$here/src/swapon" $swapfile >> $seqres.full 2>&1 || \
> > +	_notrun "fallocated swap not supported here"
> > +swapoff $swapfile
> > +
> > +# Create a fallocated swap file and touch every other $PAGE_SIZE to create
> > +# a mess of written/unwritten extent records
> > +echo "mixed swap" | tee -a $seqres.full
> > +$XFS_IO_PROG -f -c "falloc 0 $len" $swapfile >> $seqres.full
> > +seq $page_size $((page_size * 2)) $len | while read offset; do
> > +	_pwrite_byte 0x58 $offset 1 $swapfile >> $seqres.full
> > +done
> > +swapfile_cycle $swapfile
> > +
> > +status=0
> > +exit
> > diff --git a/tests/generic/709.out b/tests/generic/709.out
> > new file mode 100644
> > index 00000000..90ba38ae
> > --- /dev/null
> > +++ b/tests/generic/709.out
> > @@ -0,0 +1,3 @@
> > +QA output created by 709
> > +fallocate swap
> > +mixed swap
> > diff --git a/tests/generic/710 b/tests/generic/710
> > new file mode 100755
> > index 00000000..e9dc3f08
> > --- /dev/null
> > +++ b/tests/generic/710
> > @@ -0,0 +1,94 @@
> > +#! /bin/bash
> > +# FS QA Test No. 710
> > +#
> > +# Test various swapfile activation oddities, having used fcollapse to
> > +# create discontiguous ranges in the file.
> > +#
> > +#-----------------------------------------------------------------------
> > +# Copyright (c) 2018 Oracle.  All Rights Reserved.
> > +#
> > +# This program is free software; you can redistribute it and/or
> > +# modify it under the terms of the GNU General Public License as
> > +# published by the Free Software Foundation.
> > +#
> > +# This program is distributed in the hope that it would be useful,
> > +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > +# GNU General Public License for more details.
> > +#
> > +# You should have received a copy of the GNU General Public License
> > +# along with this program; if not, write the Free Software Foundation,
> > +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> > +#
> > +#-----------------------------------------------------------------------
> > +
> > +seq=`basename $0`
> > +seqres=$RESULT_DIR/$seq
> > +echo "QA output created by $seq"
> > +
> > +status=1	# failure is the default!
> > +trap "_cleanup; exit \$status" 0 1 2 3 15
> > +
> > +_cleanup()
> > +{
> > +	cd /
> > +	swapoff $swapfile 2> /dev/null
> > +	rm -f $swapfile
> > +}
> > +
> > +# get standard environment, filters and checks
> > +. ./common/rc
> > +. ./common/filter
> > +
> > +# remove previous $seqres.full before test
> > +rm -f $seqres.full
> > +
> > +# real QA test starts here
> > +_supported_fs generic
> > +_supported_os Linux
> > +_require_scratch_swapfile
> > +_require_test_program mkswap
> > +_require_test_program swapon
> > +_require_xfs_io_command "fcollapse"
> > +
> > +rm -f $seqres.full
> > +_scratch_mkfs >>$seqres.full 2>&1
> > +_scratch_mount >>$seqres.full 2>&1
> > +
> > +swapfile=$SCRATCH_MNT/swap
> > +len=$((2 * 1048576))
> > +page_size=$(get_page_size)
> > +
> > +swapfile_cycle() {
> > +	local swapfile="$1"
> > +
> > +	"$here/src/mkswap" $swapfile >> $seqres.full
> > +	"$here/src/swapon" $swapfile 2>&1 | _filter_scratch
> > +	swapoff $swapfile 2>> $seeqres.full
> > +	rm -f $swapfile
> > +}
> > +
> > +# Create a swap file with a large discontiguous range(?)
> > +echo "large discontig swap" | tee -a $seqres.full
> > +_pwrite_byte 0x58 0 $((len * 2)) $swapfile >> $seqres.full
> > +old_sz="$(stat -c '%s' $swapfile)"
> > +$XFS_IO_PROG -c "fcollapse $((len / 2)) $len" $swapfile >> $seqres.full 2>&1
> > +new_sz="$(stat -c '%s' $swapfile)"
> > +if [ $old_sz -gt $new_sz ]; then
> > +	swapfile_cycle $swapfile
> > +fi
> > +rm -f $swapfile
> > +
> > +# Create a swap file with a small discontiguous range(?)
> > +echo "small discontig swap" | tee -a $seqres.full
> > +_pwrite_byte 0x58 0 $((len + 1024)) $swapfile >> $seqres.full
> > +old_sz="$(stat -c '%s' $swapfile)"
> > +$XFS_IO_PROG -c "fcollapse 66560 1024" $swapfile >> $seqres.full 2>&1
> > +new_sz="$(stat -c '%s' $swapfile)"
> > +if [ $old_sz -gt $new_sz ]; then
> > +	swapfile_cycle $swapfile
> > +fi
> > +rm -f $swapfile
> > +
> > +status=0
> > +exit
> > diff --git a/tests/generic/710.out b/tests/generic/710.out
> > new file mode 100644
> > index 00000000..ba1f8e40
> > --- /dev/null
> > +++ b/tests/generic/710.out
> > @@ -0,0 +1,3 @@
> > +QA output created by 710
> > +large discontig swap
> > +small discontig swap
> > diff --git a/tests/generic/group b/tests/generic/group
> > index 4339c64c..6d747450 100644
> > --- a/tests/generic/group
> > +++ b/tests/generic/group
> > @@ -497,3 +497,6 @@
> >  493 auto quick swap
> >  494 auto quick swap punch
> >  495 auto quick swap
> > +708 auto quick swap
> > +709 auto quick swap
> > +710 auto quick swap collapse
> > 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 5/6] xfs: abstract xfs_info into $XFS_INFO_PROG
  2018-06-07 11:37   ` Eryu Guan
@ 2018-06-07 15:03     ` Darrick J. Wong
  0 siblings, 0 replies; 15+ messages in thread
From: Darrick J. Wong @ 2018-06-07 15:03 UTC (permalink / raw)
  To: Eryu Guan; +Cc: linux-xfs, fstests

On Thu, Jun 07, 2018 at 07:37:13PM +0800, Eryu Guan wrote:
> On Tue, Jun 05, 2018 at 09:43:27AM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <darrick.wong@oracle.com>
> > 
> > Abstract calls to xfs_info into $XFS_INFO_PROG like we do for all other
> > xfs utilities.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> >  common/attr      |    2 +-
> >  common/config    |    1 +
> >  common/populate  |   18 +++++++++---------
> >  common/rc        |    2 +-
> 
> Better to make xfs_info mandatory too when testing xfs, so I did the
> below diff on commit

Ok, thank you for making the change on the way in. :)

--D

> diff --git a/common/rc b/common/rc
> index f04c9ea2fd89..9d6665b6c4d7 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -136,6 +136,7 @@ case "$FSTYP" in
>          [ "$XFS_REPAIR_PROG" = "" ] && _fatal "xfs_repair not found"
>          [ "$XFS_DB_PROG" = "" ] && _fatal "xfs_db not found"
>          [ "$MKFS_XFS_PROG" = "" ] && _fatal "mkfs_xfs not found"
> +        [ "$XFS_INFO_PROG" = "" ] && _fatal "xfs_info not found"
> 
>          . ./common/xfs
>          ;;
> 
> Thanks,
> Eryu
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 6/6] xfs: make sure pretty printed geometry output matches
  2018-06-07 12:48   ` Eryu Guan
@ 2018-06-07 15:13     ` Darrick J. Wong
  0 siblings, 0 replies; 15+ messages in thread
From: Darrick J. Wong @ 2018-06-07 15:13 UTC (permalink / raw)
  To: Eryu Guan; +Cc: linux-xfs, fstests

On Thu, Jun 07, 2018 at 08:48:53PM +0800, Eryu Guan wrote:
> On Tue, Jun 05, 2018 at 09:43:33AM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <darrick.wong@oracle.com>
> > 
> > Make sure that all of our commands that can print geometry information
> > all print the /same/ information.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> >  common/xfs        |   41 +++++++++++++++++++++++++
> >  tests/xfs/710     |   88 +++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  tests/xfs/710.out |    2 +
> >  tests/xfs/group   |    1 +
> >  4 files changed, 132 insertions(+)
> >  create mode 100755 tests/xfs/710
> >  create mode 100644 tests/xfs/710.out
> > 
> > 
> > diff --git a/common/xfs b/common/xfs
> > index 3e34b118..bc35cd87 100644
> > --- a/common/xfs
> > +++ b/common/xfs
> > @@ -710,3 +710,44 @@ _require_xfs_db_write_array()
> >  	rm -f $TEST_DIR/$seq.img
> >  	[ $supported -eq 0 ] && _notrun "xfs_db write can't support array"
> >  }
> > +
> > +_require_xfs_spaceman_command()
> > +{
> > +	if [ -z "$1" ]
> > +	then
> > +		echo "Usage: _require_xfs_spaceman_command command [switch]" 1>&2
> > +		exit 1
> > +	fi
> > +	local command=$1
> > +	shift
> > +	local param="$*"
> > +	local param_checked=0
> > +	local opts=""
> > +
> > +	_require_command "$XFS_SPACEMAN_PROG" "xfs_spaceman"
> > +
> > +	testfile=$TEST_DIR/$$.xfs_spaceman
> > +	case $command in
> > +	*)
> > +		testio=`$XFS_SPACEMAN_PROG -c "help $command" $TEST_DIR 2>&1`
> > +	esac
> > +
> > +	rm -f $testfile 2>&1 > /dev/null
> > +	echo $testio | grep -q "not found" && \
> > +		_notrun "xfs_spaceman $command support is missing"
> > +	echo $testio | grep -q "Operation not supported" && \
> > +		_notrun "xfs_spaceman $command failed (old kernel/wrong fs?)"
> > +	echo $testio | grep -q "Invalid" && \
> > +		_notrun "xfs_spaceman $command failed (old kernel/wrong fs/bad args?)"
> > +	echo $testio | grep -q "foreign file active" && \
> > +		_notrun "xfs_spaceman $command not supported on $FSTYP"
> > +	echo $testio | grep -q "Function not implemented" && \
> > +		_notrun "xfs_spaceman $command support is missing (missing syscall?)"
> > +
> > +	[ -n "$param" ] || return
> > +
> > +	if [ $param_checked -eq 0 ]; then
> > +		$XFS_IO_PROG -c "help $command" | grep -q "^ $param --" || \
>                  ^^^^^^^^^^^ XFS_SPACEMAN_PROG
> 
> > +			_notrun "xfs_spaceman $command doesn't support $param"
> > +	fi
> > +}
> > diff --git a/tests/xfs/710 b/tests/xfs/710
> > new file mode 100755
> > index 00000000..b03d4836
> > --- /dev/null
> > +++ b/tests/xfs/710
> > @@ -0,0 +1,88 @@
> > +#! /bin/bash
> > +# FS QA Test No. 710
> > +#
> > +# Make sure pretty printed XFS geometry is the same across all programs.
> > +#
> > +#-----------------------------------------------------------------------
> > +# Copyright (c) 2018 Oracle, Inc.
> > +#
> > +# This program is free software; you can redistribute it and/or
> > +# modify it under the terms of the GNU General Public License as
> > +# published by the Free Software Foundation.
> > +#
> > +# This program is distributed in the hope that it would be useful,
> > +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > +# GNU General Public License for more details.
> > +#
> > +# You should have received a copy of the GNU General Public License
> > +# along with this program; if not, write the Free Software Foundation,
> > +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> > +#
> > +#-----------------------------------------------------------------------
> > +#
> > +
> > +seq=`basename $0`
> > +seqres=$RESULT_DIR/$seq
> > +echo "QA output created by $seq"
> > +
> > +here=`pwd`
> > +tmp=/tmp/$$
> > +status=1
> > +trap "_cleanup; rm -f $tmp.*; exit \$status" 0 1 2 3 15
> 
> "rm -f $tmp.*" is done in _cleanup()
> 
> > +
> > +_cleanup()
> > +{
> > +	cd /
> > +	rm -f $tmp.*
> > +}
> > +
> > +rm -f $seqres.full
> > +
> > +# get standard environment, filters and checks
> > +. ./common/rc
> > +. ./common/xfs
> 
> No need to source common/xfs, common/rc will source it automatically.
> 
> > +
> > +# real QA test starts here
> > +_supported_fs xfs
> > +_supported_os Linux
> > +
> > +_require_scratch_nocheck
> > +
> > +# Geometry printing wasn't unified until xfs_spaceman grew an 'info'
> > +# command, so skip this test if there is no spaceman or it doesn't
> > +# know what 'info' is.
> > +_require_xfs_spaceman_command "info"
> > +_require_command "$XFS_DB_PROG" xfs_db
> > +_require_command "$XFS_GROWFS_PROG" xfs_growfs
> > +_require_command "$XFS_INFO_PROG" xfs_info
> 
> xfs_db and xfs_info (I fixed that up on commit) have been checked in
> common/rc, just need to check xfs_growfs here.
> 
> These are all trivial and easy to fix, I'll just fix them on commit too.

Ok, thank you!

--D

> 
> Thanks,
> Eryu
> 
> > +
> > +_scratch_mkfs > $tmp.mkfs
> > +echo MKFS >> $seqres.full
> > +cat $tmp.mkfs >> $seqres.full
> > +
> > +_scratch_xfs_db -c "info" > $tmp.dbinfo
> > +echo DB >> $seqres.full
> > +cat $tmp.dbinfo >> $seqres.full
> > +diff -u $tmp.mkfs $tmp.dbinfo
> > +
> > +_scratch_mount
> > +
> > +$XFS_SPACEMAN_PROG -c "info" $SCRATCH_MNT > $tmp.spaceman
> > +echo SPACEMAN >> $seqres.full
> > +cat $tmp.spaceman >> $seqres.full
> > +diff -u $tmp.mkfs $tmp.spaceman
> > +
> > +$XFS_GROWFS_PROG -n $SCRATCH_MNT > $tmp.growfs
> > +echo GROWFS >> $seqres.full
> > +cat $tmp.growfs >> $seqres.full
> > +diff -u $tmp.mkfs $tmp.growfs
> > +
> > +$XFS_INFO_PROG $SCRATCH_MNT > $tmp.info
> > +echo INFO >> $seqres.full
> > +cat $tmp.info >> $seqres.full
> > +diff -u $tmp.mkfs $tmp.info
> > +
> > +echo "Silence is golden."
> > +status=0
> > +exit 0
> > diff --git a/tests/xfs/710.out b/tests/xfs/710.out
> > new file mode 100644
> > index 00000000..ae2659d5
> > --- /dev/null
> > +++ b/tests/xfs/710.out
> > @@ -0,0 +1,2 @@
> > +QA output created by 710
> > +Silence is golden.
> > diff --git a/tests/xfs/group b/tests/xfs/group
> > index 2319f58f..9dd30ae0 100644
> > --- a/tests/xfs/group
> > +++ b/tests/xfs/group
> > @@ -445,3 +445,4 @@
> >  445 auto quick filestreams
> >  446 auto quick
> >  447 auto mount
> > +710 auto quick
> > 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH v2 4/6] generic: test swapfile creation, activation, and deactivation
  2018-06-05 16:43 ` [PATCH 4/6] generic: test swapfile creation, activation, and deactivation Darrick J. Wong
  2018-06-07 12:34   ` Eryu Guan
@ 2018-06-07 15:17   ` Darrick J. Wong
  1 sibling, 0 replies; 15+ messages in thread
From: Darrick J. Wong @ 2018-06-07 15:17 UTC (permalink / raw)
  To: guaneryu; +Cc: linux-xfs, fstests

From: Darrick J. Wong <darrick.wong@oracle.com>

Test swapfile activation and deactivation.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
v2: fix duplicated test hunks and other bugs
---
 tests/generic/708     |   90 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/708.out |    4 ++
 tests/generic/709     |   93 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/709.out |    3 ++
 tests/generic/710     |   96 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/710.out |    3 ++
 tests/generic/group   |    3 ++
 7 files changed, 292 insertions(+)
 create mode 100755 tests/generic/708
 create mode 100644 tests/generic/708.out
 create mode 100755 tests/generic/709
 create mode 100644 tests/generic/709.out
 create mode 100755 tests/generic/710
 create mode 100644 tests/generic/710.out

diff --git a/tests/generic/708 b/tests/generic/708
new file mode 100755
index 00000000..8018143e
--- /dev/null
+++ b/tests/generic/708
@@ -0,0 +1,90 @@
+#! /bin/bash
+# FS QA Test No. 708
+#
+# Test various swapfile activation oddities.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2018 Oracle.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#-----------------------------------------------------------------------
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	swapoff $swapfile 2> /dev/null
+	rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# remove previous $seqres.full before test
+rm -f $seqres.full
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+_require_scratch_swapfile
+_require_test_program mkswap
+_require_test_program swapon
+
+rm -f $seqres.full
+_scratch_mkfs >>$seqres.full 2>&1
+_scratch_mount >>$seqres.full 2>&1
+
+swapfile=$SCRATCH_MNT/swap
+len=$((2 * 1048576))
+page_size=$(get_page_size)
+
+swapfile_cycle() {
+	local swapfile="$1"
+
+	$CHATTR_PROG +C $swapfile >> $seqres.full 2>&1
+	"$here/src/mkswap" $swapfile >> $seqres.full
+	"$here/src/swapon" $swapfile 2>&1 | _filter_scratch
+	swapoff $swapfile 2>> $seeqres.full
+	rm -f $swapfile
+}
+
+# Create a regular swap file
+echo "regular swap" | tee -a $seqres.full
+_pwrite_byte 0x58 0 $len $swapfile >> $seqres.full
+swapfile_cycle $swapfile
+
+# Create a swap file with a little too much junk on the end
+echo "too long swap" | tee -a $seqres.full
+_pwrite_byte 0x58 0 $((len + 3)) $swapfile >> $seqres.full
+swapfile_cycle $swapfile
+
+# Create a ridiculously small swap file.  Each swap file must have at least
+# two pages after the header page.
+echo "tiny swap" | tee -a $seqres.full
+tiny_len=$((page_size * 3))
+_pwrite_byte 0x58 0 $tiny_len $swapfile >> $seqres.full
+swapfile_cycle $swapfile
+
+status=0
+exit
diff --git a/tests/generic/708.out b/tests/generic/708.out
new file mode 100644
index 00000000..d68df3a2
--- /dev/null
+++ b/tests/generic/708.out
@@ -0,0 +1,4 @@
+QA output created by 708
+regular swap
+too long swap
+tiny swap
diff --git a/tests/generic/709 b/tests/generic/709
new file mode 100755
index 00000000..27fb922c
--- /dev/null
+++ b/tests/generic/709
@@ -0,0 +1,93 @@
+#! /bin/bash
+# FS QA Test No. 709
+#
+# Test various swapfile activation oddities on filesystems that support
+# fallocated swapfiles.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2018 Oracle.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#-----------------------------------------------------------------------
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	swapoff $swapfile 2> /dev/null
+	rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# remove previous $seqres.full before test
+rm -f $seqres.full
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+_require_scratch_swapfile
+_require_test_program mkswap
+_require_test_program swapon
+_require_xfs_io_command "falloc"
+
+rm -f $seqres.full
+_scratch_mkfs >>$seqres.full 2>&1
+_scratch_mount >>$seqres.full 2>&1
+
+swapfile=$SCRATCH_MNT/swap
+len=$((2 * 1048576))
+page_size=$(get_page_size)
+
+swapfile_cycle() {
+	local swapfile="$1"
+
+	$CHATTR_PROG +C $swapfile >> $seqres.full 2>&1
+	"$here/src/mkswap" $swapfile >> $seqres.full
+	"$here/src/swapon" $swapfile 2>&1 | _filter_scratch
+	swapoff $swapfile 2>> $seeqres.full
+	rm -f $swapfile
+}
+
+# Create a fallocated swap file
+echo "fallocate swap" | tee -a $seqres.full
+$XFS_IO_PROG -f -c "falloc 0 $len" $swapfile >> $seqres.full
+$CHATTR_PROG +C $swapfile >> $seqres.full 2>&1
+"$here/src/mkswap" $swapfile
+"$here/src/swapon" $swapfile >> $seqres.full 2>&1 || \
+	_notrun "fallocated swap not supported here"
+swapoff $swapfile
+
+# Create a fallocated swap file and touch every other $PAGE_SIZE to create
+# a mess of written/unwritten extent records
+echo "mixed swap" | tee -a $seqres.full
+$XFS_IO_PROG -f -c "falloc 0 $len" $swapfile >> $seqres.full
+seq $page_size $((page_size * 2)) $len | while read offset; do
+	_pwrite_byte 0x58 $offset 1 $swapfile >> $seqres.full
+done
+swapfile_cycle $swapfile
+
+status=0
+exit
diff --git a/tests/generic/709.out b/tests/generic/709.out
new file mode 100644
index 00000000..90ba38ae
--- /dev/null
+++ b/tests/generic/709.out
@@ -0,0 +1,3 @@
+QA output created by 709
+fallocate swap
+mixed swap
diff --git a/tests/generic/710 b/tests/generic/710
new file mode 100755
index 00000000..782156e3
--- /dev/null
+++ b/tests/generic/710
@@ -0,0 +1,96 @@
+#! /bin/bash
+# FS QA Test No. 710
+#
+# Test various swapfile activation oddities, having used fcollapse to
+# create discontiguous ranges in the file.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2018 Oracle.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#-----------------------------------------------------------------------
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	swapoff $swapfile 2> /dev/null
+	rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# remove previous $seqres.full before test
+rm -f $seqres.full
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+_require_scratch_swapfile
+_require_test_program mkswap
+_require_test_program swapon
+_require_xfs_io_command "fcollapse"
+
+rm -f $seqres.full
+_scratch_mkfs >>$seqres.full 2>&1
+_scratch_mount >>$seqres.full 2>&1
+
+swapfile=$SCRATCH_MNT/swap
+len=$((2 * 1048576))
+page_size=$(get_page_size)
+
+swapfile_cycle() {
+	local swapfile="$1"
+
+	"$here/src/mkswap" $swapfile >> $seqres.full
+	"$here/src/swapon" $swapfile 2>&1 | _filter_scratch
+	swapoff $swapfile 2>> $seeqres.full
+	rm -f $swapfile
+}
+
+# Create a swap file with a large discontiguous range(?)
+echo "large discontig swap" | tee -a $seqres.full
+_pwrite_byte 0x58 0 $((len * 2)) $swapfile >> $seqres.full
+old_sz="$(stat -c '%s' $swapfile)"
+$XFS_IO_PROG -c "fcollapse $((len / 2)) $len" $swapfile >> $seqres.full 2>&1
+new_sz="$(stat -c '%s' $swapfile)"
+if [ $old_sz -gt $new_sz ]; then
+	swapfile_cycle $swapfile
+fi
+rm -f $swapfile
+
+# Create a swap file with a small discontiguous range(?)
+echo "small discontig swap" | tee -a $seqres.full
+_pwrite_byte 0x58 0 $((len + 1024)) $swapfile >> $seqres.full
+old_sz="$(stat -c '%s' $swapfile)"
+$XFS_IO_PROG -c "fcollapse 66560 1024" $swapfile >> $seqres.full 2>&1
+new_sz="$(stat -c '%s' $swapfile)"
+if [ $old_sz -gt $new_sz ]; then
+	swapfile_cycle $swapfile
+fi
+rm -f $swapfile
+
+status=0
+exit
diff --git a/tests/generic/710.out b/tests/generic/710.out
new file mode 100644
index 00000000..ba1f8e40
--- /dev/null
+++ b/tests/generic/710.out
@@ -0,0 +1,3 @@
+QA output created by 710
+large discontig swap
+small discontig swap
diff --git a/tests/generic/group b/tests/generic/group
index 4339c64c..6d747450 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -497,3 +497,6 @@
 493 auto quick swap
 494 auto quick swap punch
 495 auto quick swap
+708 auto quick swap
+709 auto quick swap
+710 auto quick swap collapse

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

* [PATCH 0/6] fstests: fixes and new tests
@ 2018-10-05  0:19 Darrick J. Wong
  0 siblings, 0 replies; 15+ messages in thread
From: Darrick J. Wong @ 2018-10-05  0:19 UTC (permalink / raw)
  To: guaneryu, darrick.wong; +Cc: linux-xfs, linux-fsdevel, fstests

Hi all,

The first patch provides a second regression test for a condition where
mmap read of a file's EOF page shows nonzero bytes after EOF if the
previous operation was a zero_range all the way to EOF.  This bug only
seems to manifest on XFS, but it uses generic APIs and so is a generic
test.  The patch concerned here is "xfs: ensure post-EOF zeroing happens
after zeroing part of a file".

The second patch adds tests to see if XFS can detect and correct
incorrect filesystem summary counters at mount time.

Patch 3-5 fix some minor problems that cropped up with the upcoming
xfsprogs 4.19 release due to stricter metadata verification.

Patch 6 adds some regression tests for incorrect behavior on the part of
the clonerange and deduperange ioctls.  Specifically, we check for a
lack of file range verification w.r.t. resource limits; lack of security
privilege clearing when a file is reflinked; exposure of stale disk
contents when a file is reflinked into well above EOF; and problems
deduping when a single byte in the middle of the range doesn't match.

--D

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

end of thread, other threads:[~2018-10-05  7:15 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-05 16:42 [PATCH 0/6] fstests: fixes and new tests Darrick J. Wong
2018-06-05 16:42 ` [PATCH 1/6] xfs/439: don't check filesystem afterwards Darrick J. Wong
2018-06-05 16:43 ` [PATCH 2/6] xfs/122: fix sb_fname[XFSLABEL_MAX] in test Darrick J. Wong
2018-06-05 16:43 ` [PATCH 3/6] xfs/310: fix _require_scratch_nocheck ordering Darrick J. Wong
2018-06-05 16:43 ` [PATCH 4/6] generic: test swapfile creation, activation, and deactivation Darrick J. Wong
2018-06-07 12:34   ` Eryu Guan
2018-06-07 15:01     ` Darrick J. Wong
2018-06-07 15:17   ` [PATCH v2 " Darrick J. Wong
2018-06-05 16:43 ` [PATCH 5/6] xfs: abstract xfs_info into $XFS_INFO_PROG Darrick J. Wong
2018-06-07 11:37   ` Eryu Guan
2018-06-07 15:03     ` Darrick J. Wong
2018-06-05 16:43 ` [PATCH 6/6] xfs: make sure pretty printed geometry output matches Darrick J. Wong
2018-06-07 12:48   ` Eryu Guan
2018-06-07 15:13     ` Darrick J. Wong
2018-10-05  0:19 [PATCH 0/6] fstests: fixes and new tests Darrick J. Wong

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.