All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] common: use _require_xfs_io_command() directly to check fiemap
@ 2017-05-15  7:17 Xiao Yang
  2017-05-15  7:17 ` [PATCH 2/2] common: cleanup _require_xfs_io_command Xiao Yang
  2017-05-16  8:16 ` [PATCH 1/2] common: use _require_xfs_io_command() directly to check fiemap Amir Goldstein
  0 siblings, 2 replies; 8+ messages in thread
From: Xiao Yang @ 2017-05-15  7:17 UTC (permalink / raw)
  To: fstests; +Cc: Xiao Yang

We could remove _require_fiemap and _require_fiemap_attr.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
---
 common/rc         | 12 ------------
 common/reflink    |  2 +-
 tests/generic/043 |  2 +-
 tests/generic/044 |  2 +-
 tests/generic/045 |  2 +-
 tests/generic/046 |  2 +-
 tests/generic/047 |  2 +-
 tests/generic/048 |  2 +-
 tests/generic/049 |  2 +-
 tests/generic/092 |  2 +-
 tests/generic/301 |  2 +-
 tests/generic/302 |  2 +-
 tests/generic/305 |  2 +-
 tests/generic/326 |  2 +-
 tests/generic/327 |  2 +-
 tests/generic/328 |  2 +-
 tests/generic/352 |  2 +-
 tests/generic/353 |  2 +-
 tests/generic/372 |  2 +-
 tests/generic/414 |  2 +-
 tests/generic/425 |  2 +-
 tests/xfs/180     |  2 +-
 tests/xfs/182     |  2 +-
 tests/xfs/184     |  2 +-
 tests/xfs/192     |  2 +-
 tests/xfs/193     |  2 +-
 tests/xfs/198     |  2 +-
 tests/xfs/200     |  2 +-
 tests/xfs/204     |  2 +-
 tests/xfs/207     |  2 +-
 tests/xfs/208     |  2 +-
 tests/xfs/209     |  2 +-
 tests/xfs/210     |  2 +-
 tests/xfs/211     |  2 +-
 tests/xfs/212     |  2 +-
 tests/xfs/213     |  2 +-
 tests/xfs/214     |  2 +-
 tests/xfs/231     |  2 +-
 tests/xfs/232     |  2 +-
 tests/xfs/344     |  2 +-
 tests/xfs/345     |  2 +-
 tests/xfs/346     |  2 +-
 tests/xfs/347     |  2 +-
 43 files changed, 42 insertions(+), 54 deletions(-)

diff --git a/common/rc b/common/rc
index aa35b5e..539f153 100644
--- a/common/rc
+++ b/common/rc
@@ -2940,12 +2940,6 @@ _require_metadata_journaling()
 	esac
 }
 
-# Does fiemap support?
-_require_fiemap()
-{
-	_require_xfs_io_command "fiemap"
-}
-
 _count_extents()
 {
 	$XFS_IO_PROG -c "fiemap" $1 | tail -n +2 | grep -v hole | wc -l
@@ -2956,12 +2950,6 @@ _count_holes()
 	$XFS_IO_PROG -c "fiemap" $1 | tail -n +2 | grep hole | wc -l
 }
 
-# Does fiemap support reporting xattr extents?
-_require_fiemap_attr()
-{
-	_require_xfs_io_command "fiemap" "-a"
-}
-
 _count_attr_extents()
 {
 	$XFS_IO_PROG -c "fiemap -a" $1 | tail -n +2 | grep -v hole | wc -l
diff --git a/common/reflink b/common/reflink
index 2e364e5..2a7c7b8 100644
--- a/common/reflink
+++ b/common/reflink
@@ -111,7 +111,7 @@ _require_scratch_reflink()
 _require_scratch_explicit_shared_extents()
 {
 	_require_scratch
-	_require_fiemap
+	_require_xfs_io_command "fiemap"
 	_require_scratch_reflink
 	_require_xfs_io_command "reflink"
 	local nr_extents
diff --git a/tests/generic/043 b/tests/generic/043
index 3d98ab0..784683e 100755
--- a/tests/generic/043
+++ b/tests/generic/043
@@ -41,7 +41,7 @@ _supported_os Linux IRIX
 
 _require_scratch
 _require_scratch_shutdown
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _scratch_mkfs >/dev/null 2>&1
 _require_metadata_journaling $SCRATCH_DEV
 _scratch_mount
diff --git a/tests/generic/044 b/tests/generic/044
index eb64b86..f0dc0df 100755
--- a/tests/generic/044
+++ b/tests/generic/044
@@ -41,7 +41,7 @@ _supported_os Linux IRIX
 
 _require_scratch
 _require_scratch_shutdown
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _scratch_mkfs >/dev/null 2>&1
 _require_metadata_journaling $SCRATCH_DEV
 _scratch_mount
diff --git a/tests/generic/045 b/tests/generic/045
index 5ef747f..b49d09e 100755
--- a/tests/generic/045
+++ b/tests/generic/045
@@ -41,7 +41,7 @@ _supported_os Linux IRIX
 
 _require_scratch
 _require_scratch_shutdown
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _scratch_mkfs >/dev/null 2>&1
 _require_metadata_journaling $SCRATCH_DEV
 _scratch_mount
diff --git a/tests/generic/046 b/tests/generic/046
index 882cb09..54cb557 100755
--- a/tests/generic/046
+++ b/tests/generic/046
@@ -41,7 +41,7 @@ _supported_os Linux IRIX
 
 _require_scratch
 _require_scratch_shutdown
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _scratch_mkfs >/dev/null 2>&1
 _require_metadata_journaling $SCRATCH_DEV
 _scratch_mount
diff --git a/tests/generic/047 b/tests/generic/047
index d7e4610..20f157e 100755
--- a/tests/generic/047
+++ b/tests/generic/047
@@ -42,7 +42,7 @@ _supported_os Linux IRIX
 
 _require_scratch
 _require_scratch_shutdown
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _scratch_mkfs >/dev/null 2>&1
 _require_metadata_journaling $SCRATCH_DEV
 _scratch_mount
diff --git a/tests/generic/048 b/tests/generic/048
index 3f0bcc1..dc2ab20 100755
--- a/tests/generic/048
+++ b/tests/generic/048
@@ -42,7 +42,7 @@ _supported_os Linux IRIX
 
 _require_scratch
 _require_scratch_shutdown
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _scratch_mkfs >/dev/null 2>&1
 _require_metadata_journaling $SCRATCH_DEV
 _scratch_mount
diff --git a/tests/generic/049 b/tests/generic/049
index 1f2a4b2..c7f1944 100755
--- a/tests/generic/049
+++ b/tests/generic/049
@@ -42,7 +42,7 @@ _supported_os Linux IRIX
 
 _require_scratch
 _require_scratch_shutdown
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _scratch_mkfs >/dev/null 2>&1
 _require_metadata_journaling $SCRATCH_DEV
 _scratch_mount
diff --git a/tests/generic/092 b/tests/generic/092
index faf08f1..cc615f6 100755
--- a/tests/generic/092
+++ b/tests/generic/092
@@ -53,7 +53,7 @@ _supported_fs generic
 _supported_os Linux
 _require_test
 _require_xfs_io_command "falloc"
-_require_fiemap
+_require_xfs_io_command "fiemap"
 
 # First test to make sure that truncating at i_size trims the preallocated bit
 # past i_size
diff --git a/tests/generic/301 b/tests/generic/301
index 67b1a0c..1c6ea05 100755
--- a/tests/generic/301
+++ b/tests/generic/301
@@ -47,7 +47,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 
 rm -f $seqres.full
 
diff --git a/tests/generic/302 b/tests/generic/302
index 3834f98..5643bb5 100755
--- a/tests/generic/302
+++ b/tests/generic/302
@@ -47,7 +47,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_odirect
 
 rm -f $seqres.full
diff --git a/tests/generic/305 b/tests/generic/305
index ceef333..cb05799 100755
--- a/tests/generic/305
+++ b/tests/generic/305
@@ -46,7 +46,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_quota
 _require_nobody
 _require_user
diff --git a/tests/generic/326 b/tests/generic/326
index 3568efe..c6cc9bb 100755
--- a/tests/generic/326
+++ b/tests/generic/326
@@ -46,7 +46,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_quota
 _require_nobody
 _require_odirect
diff --git a/tests/generic/327 b/tests/generic/327
index 05cfb4a..1e1ab6a 100755
--- a/tests/generic/327
+++ b/tests/generic/327
@@ -45,7 +45,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_quota
 _require_nobody
 _require_user
diff --git a/tests/generic/328 b/tests/generic/328
index 21ec9d3..1ad53fd 100755
--- a/tests/generic/328
+++ b/tests/generic/328
@@ -45,7 +45,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_quota
 _require_nobody
 _require_odirect
diff --git a/tests/generic/352 b/tests/generic/352
index 70e43fb..30eb43b 100755
--- a/tests/generic/352
+++ b/tests/generic/352
@@ -55,7 +55,7 @@ rm -f $seqres.full
 _supported_fs generic
 _supported_os Linux
 _require_scratch_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 
 _scratch_mkfs > /dev/null 2>&1
 _scratch_mount
diff --git a/tests/generic/353 b/tests/generic/353
index ca665cf..ddb9346 100755
--- a/tests/generic/353
+++ b/tests/generic/353
@@ -56,7 +56,7 @@ rm -f $seqres.full
 _supported_fs generic
 _supported_os Linux
 _require_scratch_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 
 _scratch_mkfs > /dev/null 2>&1
 _scratch_mount
diff --git a/tests/generic/372 b/tests/generic/372
index 51a3eca..08c81a9 100755
--- a/tests/generic/372
+++ b/tests/generic/372
@@ -46,7 +46,7 @@ _cleanup()
 _supported_os Linux
 _supported_fs generic
 _require_scratch_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_scratch_explicit_shared_extents
 
 echo "Format and mount"
diff --git a/tests/generic/414 b/tests/generic/414
index ee85d73..6f2136e 100755
--- a/tests/generic/414
+++ b/tests/generic/414
@@ -47,7 +47,7 @@ _cleanup()
 _supported_os Linux
 _supported_fs generic
 _require_scratch_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 
 echo "Format and mount"
 _scratch_mkfs > $seqres.full 2>&1
diff --git a/tests/generic/425 b/tests/generic/425
index 31e8467..800afc5 100755
--- a/tests/generic/425
+++ b/tests/generic/425
@@ -48,7 +48,7 @@ _supported_os Linux
 _supported_fs generic
 _require_scratch
 _require_attrs
-_require_fiemap_attr
+_require_xfs_io_command "fiemap" "-a"
 
 echo "Format and mount"
 _scratch_mkfs > $seqres.full 2>&1
diff --git a/tests/xfs/180 b/tests/xfs/180
index ce2ac26..736267e 100755
--- a/tests/xfs/180
+++ b/tests/xfs/180
@@ -49,7 +49,7 @@ _supported_os Linux
 _supported_fs xfs
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_xfs_io_command "cowextsize"
 
 rm -f $seqres.full
diff --git a/tests/xfs/182 b/tests/xfs/182
index 4413c7d..6d7d21e 100755
--- a/tests/xfs/182
+++ b/tests/xfs/182
@@ -49,7 +49,7 @@ _supported_os Linux
 _supported_fs xfs
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_xfs_io_command "cowextsize"
 _require_odirect
 
diff --git a/tests/xfs/184 b/tests/xfs/184
index 54eb115..2ae19ab 100755
--- a/tests/xfs/184
+++ b/tests/xfs/184
@@ -49,7 +49,7 @@ _supported_os Linux
 _supported_fs xfs
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_xfs_io_command "cowextsize"
 _require_xfs_io_command "funshare"
 
diff --git a/tests/xfs/192 b/tests/xfs/192
index d8bdb25..eeb6025 100755
--- a/tests/xfs/192
+++ b/tests/xfs/192
@@ -49,7 +49,7 @@ _supported_os Linux
 _supported_fs xfs
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_xfs_io_command "cowextsize"
 _require_xfs_io_command "funshare"
 _require_odirect
diff --git a/tests/xfs/193 b/tests/xfs/193
index 76cb143..c45f05a 100755
--- a/tests/xfs/193
+++ b/tests/xfs/193
@@ -48,7 +48,7 @@ _supported_os Linux
 _supported_fs xfs
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_xfs_io_command "cowextsize"
 
 rm -f $seqres.full
diff --git a/tests/xfs/198 b/tests/xfs/198
index d185ca2..bdfd44a 100755
--- a/tests/xfs/198
+++ b/tests/xfs/198
@@ -48,7 +48,7 @@ _supported_os Linux
 _supported_fs xfs
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_xfs_io_command "cowextsize"
 _require_odirect
 
diff --git a/tests/xfs/200 b/tests/xfs/200
index e70fda3..328341c 100755
--- a/tests/xfs/200
+++ b/tests/xfs/200
@@ -51,7 +51,7 @@ _supported_os Linux
 _supported_fs xfs
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_xfs_io_command "cowextsize"
 _require_xfs_io_command "funshare"
 
diff --git a/tests/xfs/204 b/tests/xfs/204
index c0b69cf..9a134e9 100755
--- a/tests/xfs/204
+++ b/tests/xfs/204
@@ -51,7 +51,7 @@ _supported_os Linux
 _supported_fs xfs
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_xfs_io_command "cowextsize"
 _require_xfs_io_command "funshare"
 _require_odirect
diff --git a/tests/xfs/207 b/tests/xfs/207
index efa283f..f9998ee 100755
--- a/tests/xfs/207
+++ b/tests/xfs/207
@@ -48,7 +48,7 @@ _supported_os Linux
 _supported_fs xfs
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_xfs_io_command "cowextsize"
 
 rm -f $seqres.full
diff --git a/tests/xfs/208 b/tests/xfs/208
index 62192cb..b00e4ab 100755
--- a/tests/xfs/208
+++ b/tests/xfs/208
@@ -52,7 +52,7 @@ _supported_os Linux
 _supported_fs xfs
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_xfs_io_command "cowextsize"
 
 rm -f $seqres.full
diff --git a/tests/xfs/209 b/tests/xfs/209
index 9bf1f12..83ccdf6 100755
--- a/tests/xfs/209
+++ b/tests/xfs/209
@@ -45,7 +45,7 @@ _supported_os Linux
 _supported_fs xfs
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_xfs_io_command "cowextsize"
 
 rm -f $seqres.full
diff --git a/tests/xfs/210 b/tests/xfs/210
index d3a2716..8a77464 100755
--- a/tests/xfs/210
+++ b/tests/xfs/210
@@ -49,7 +49,7 @@ _supported_os Linux
 _supported_fs xfs
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_xfs_io_command "cowextsize"
 
 rm -f $seqres.full
diff --git a/tests/xfs/211 b/tests/xfs/211
index 0d150f1..bd4b799 100755
--- a/tests/xfs/211
+++ b/tests/xfs/211
@@ -49,7 +49,7 @@ _supported_os Linux
 _supported_fs xfs
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_xfs_io_command "cowextsize"
 _require_odirect
 
diff --git a/tests/xfs/212 b/tests/xfs/212
index 48235d4..90f6903 100755
--- a/tests/xfs/212
+++ b/tests/xfs/212
@@ -48,7 +48,7 @@ _supported_os Linux
 _supported_fs xfs
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 
 rm -f $seqres.full
 
diff --git a/tests/xfs/213 b/tests/xfs/213
index 844166c..2029abb 100755
--- a/tests/xfs/213
+++ b/tests/xfs/213
@@ -48,7 +48,7 @@ _supported_os Linux
 _supported_fs xfs
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_quota
 _require_nobody
 _require_xfs_io_command "cowextsize"
diff --git a/tests/xfs/214 b/tests/xfs/214
index 01ffbaf..719ea2b 100755
--- a/tests/xfs/214
+++ b/tests/xfs/214
@@ -48,7 +48,7 @@ _supported_os Linux
 _supported_fs xfs
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_quota
 _require_nobody
 _require_xfs_io_command "cowextsize"
diff --git a/tests/xfs/231 b/tests/xfs/231
index f0b64c0..ac1dd16 100755
--- a/tests/xfs/231
+++ b/tests/xfs/231
@@ -52,7 +52,7 @@ _supported_fs xfs
 _require_scratch_reflink
 _require_cp_reflink
 _require_xfs_io_command "cowextsize"
-_require_fiemap
+_require_xfs_io_command "fiemap"
 
 old_cow_lifetime=$(cat /proc/sys/fs/xfs/speculative_cow_prealloc_lifetime)
 
diff --git a/tests/xfs/232 b/tests/xfs/232
index 6b74997..8638ee6 100755
--- a/tests/xfs/232
+++ b/tests/xfs/232
@@ -53,7 +53,7 @@ _supported_fs xfs
 _require_xfs_io_command "cowextsize"
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 
 old_cow_lifetime=$(cat /proc/sys/fs/xfs/speculative_cow_prealloc_lifetime)
 
diff --git a/tests/xfs/344 b/tests/xfs/344
index 806f7ab..d5288cf 100755
--- a/tests/xfs/344
+++ b/tests/xfs/344
@@ -49,7 +49,7 @@ _supported_os Linux
 _supported_fs xfs
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_xfs_io_command "cowextsize"
 _require_xfs_io_command "funshare"
 _require_odirect
diff --git a/tests/xfs/345 b/tests/xfs/345
index 1684297..ccfdb8f 100755
--- a/tests/xfs/345
+++ b/tests/xfs/345
@@ -48,7 +48,7 @@ _supported_os Linux
 _supported_fs xfs
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_xfs_io_command "cowextsize"
 _require_xfs_io_command "funshare"
 
diff --git a/tests/xfs/346 b/tests/xfs/346
index 90fe5eb..f189b5d 100755
--- a/tests/xfs/346
+++ b/tests/xfs/346
@@ -49,7 +49,7 @@ _supported_os Linux
 _supported_fs xfs
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_xfs_io_command "cowextsize"
 _require_xfs_io_command "funshare"
 _require_odirect
diff --git a/tests/xfs/347 b/tests/xfs/347
index 2a13977..fbc5ce3 100755
--- a/tests/xfs/347
+++ b/tests/xfs/347
@@ -49,7 +49,7 @@ _supported_os Linux
 _supported_fs xfs
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_xfs_io_command "cowextsize"
 _require_xfs_io_command "funshare"
 
-- 
1.8.3.1




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

* [PATCH 2/2] common: cleanup _require_xfs_io_command
  2017-05-15  7:17 [PATCH 1/2] common: use _require_xfs_io_command() directly to check fiemap Xiao Yang
@ 2017-05-15  7:17 ` Xiao Yang
  2017-05-16  8:04   ` Eryu Guan
  2017-05-16  8:16 ` [PATCH 1/2] common: use _require_xfs_io_command() directly to check fiemap Amir Goldstein
  1 sibling, 1 reply; 8+ messages in thread
From: Xiao Yang @ 2017-05-15  7:17 UTC (permalink / raw)
  To: fstests; +Cc: Xiao Yang

We don't need to check specific flags at the end of this function
if we have checked them before. e.g, generic/071 and generic/422
are marked as notrun unexpectedly because xfs_io doesn't support
long-format help for falloc before xfsprogs v4.9.  Actually, xfs_io
has supported falloc, so these case should not be marked as notrun.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
---
 common/rc | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/common/rc b/common/rc
index 539f153..2c893c0 100644
--- a/common/rc
+++ b/common/rc
@@ -2041,6 +2041,7 @@ _require_xfs_io_command()
 	command=$1
 	shift
 	param="$*"
+	param_check=0
 
 	testfile=$TEST_DIR/$$.xfs_io
 	case $command in
@@ -2055,6 +2056,7 @@ _require_xfs_io_command()
 		;;
 	"falloc" )
 		testio=`$XFS_IO_PROG -F -f -c "falloc $param 0 1m" $testfile 2>&1`
+		param_check=1
 		;;
 	"fpunch" | "fcollapse" | "zero" | "fzero" | "finsert" | "funshare")
 		testio=`$XFS_IO_PROG -F -f -c "pwrite 0 20k" -c "fsync" \
@@ -2063,6 +2065,7 @@ _require_xfs_io_command()
 	"fiemap")
 		testio=`$XFS_IO_PROG -F -f -c "pwrite 0 20k" -c "fsync" \
 			-c "fiemap -v $param" $testfile 2>&1`
+		param_check=1
 		;;
 	"flink" )
 		testio=`$XFS_IO_PROG -T -F -c "flink $testfile" \
@@ -2087,7 +2090,7 @@ _require_xfs_io_command()
 		testio=`$XFS_IO_PROG -f -c "utimes" 0 0 0 0 $testfile 2>&1`
 		;;
 	*)
-		testio=`$XFS_IO_PROG -c "$command help" 2>&1`
+		testio=`$XFS_IO_PROG -c "help $command" 2>&1`
 	esac
 
 	rm -f $testfile 2>&1 > /dev/null
@@ -2100,9 +2103,10 @@ _require_xfs_io_command()
 	echo $testio | grep -q "foreign file active" && \
 		_notrun "xfs_io $command not supported on $FSTYP"
 
-	test -z "$param" && return
-	$XFS_IO_PROG -c "help $command" | grep -q "^ $param --" || \
-		_notrun "xfs_io $command doesn't support $param"
+	if [ -n $param -a $param_check -eq 0 ]; then
+		$XFS_IO_PROG -c "help $command" | grep -q "^ $param --" || \
+			_notrun "xfs_io $command doesn't support $param"
+	fi
 }
 
 # check that kernel and filesystem support direct I/O
-- 
1.8.3.1




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

* Re: [PATCH 2/2] common: cleanup _require_xfs_io_command
  2017-05-15  7:17 ` [PATCH 2/2] common: cleanup _require_xfs_io_command Xiao Yang
@ 2017-05-16  8:04   ` Eryu Guan
  2017-05-16  8:13     ` Xiao Yang
  2017-05-17  1:42     ` [PATCH v2 1/2] common: use _require_xfs_io_command() directly to check fiemap Xiao Yang
  0 siblings, 2 replies; 8+ messages in thread
From: Eryu Guan @ 2017-05-16  8:04 UTC (permalink / raw)
  To: Xiao Yang; +Cc: fstests

On Mon, May 15, 2017 at 03:17:59PM +0800, Xiao Yang wrote:
> We don't need to check specific flags at the end of this function
> if we have checked them before. e.g, generic/071 and generic/422
> are marked as notrun unexpectedly because xfs_io doesn't support
> long-format help for falloc before xfsprogs v4.9.  Actually, xfs_io
> has supported falloc, so these case should not be marked as notrun.
> 
> Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>

Thanks for the fix!

> ---
>  common/rc | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/common/rc b/common/rc
> index 539f153..2c893c0 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -2041,6 +2041,7 @@ _require_xfs_io_command()
>  	command=$1
>  	shift
>  	param="$*"
> +	param_check=0
>  
>  	testfile=$TEST_DIR/$$.xfs_io
>  	case $command in
> @@ -2055,6 +2056,7 @@ _require_xfs_io_command()
>  		;;
>  	"falloc" )
>  		testio=`$XFS_IO_PROG -F -f -c "falloc $param 0 1m" $testfile 2>&1`
> +		param_check=1
>  		;;
>  	"fpunch" | "fcollapse" | "zero" | "fzero" | "finsert" | "funshare")
>  		testio=`$XFS_IO_PROG -F -f -c "pwrite 0 20k" -c "fsync" \
> @@ -2063,6 +2065,7 @@ _require_xfs_io_command()
>  	"fiemap")
>  		testio=`$XFS_IO_PROG -F -f -c "pwrite 0 20k" -c "fsync" \
>  			-c "fiemap -v $param" $testfile 2>&1`
> +		param_check=1
>  		;;
>  	"flink" )
>  		testio=`$XFS_IO_PROG -T -F -c "flink $testfile" \
> @@ -2087,7 +2090,7 @@ _require_xfs_io_command()
>  		testio=`$XFS_IO_PROG -f -c "utimes" 0 0 0 0 $testfile 2>&1`
>  		;;
>  	*)
> -		testio=`$XFS_IO_PROG -c "$command help" 2>&1`
> +		testio=`$XFS_IO_PROG -c "help $command" 2>&1`
>  	esac
>  
>  	rm -f $testfile 2>&1 > /dev/null
> @@ -2100,9 +2103,10 @@ _require_xfs_io_command()
>  	echo $testio | grep -q "foreign file active" && \
>  		_notrun "xfs_io $command not supported on $FSTYP"
>  
> -	test -z "$param" && return
> -	$XFS_IO_PROG -c "help $command" | grep -q "^ $param --" || \
> -		_notrun "xfs_io $command doesn't support $param"
> +	if [ -n $param -a $param_check -eq 0 ]; then

$param needs quotes here, otherwise if no param is specified [ -n ]
still reports pass, e.g.

$ unset empty_var
$ if [ -n $empty_var ]; then echo "should not see this"; fi
should not see this
$ if [ -n "$empty_var" ]; then echo "should not see this"; fi
<nothing printed>

I can fix it at commit time.

Thanks,
Eryu

> +		$XFS_IO_PROG -c "help $command" | grep -q "^ $param --" || \
> +			_notrun "xfs_io $command doesn't support $param"
> +	fi
>  }
>  
>  # check that kernel and filesystem support direct I/O
> -- 
> 1.8.3.1
> 
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 2/2] common: cleanup _require_xfs_io_command
  2017-05-16  8:04   ` Eryu Guan
@ 2017-05-16  8:13     ` Xiao Yang
  2017-05-17  1:42     ` [PATCH v2 1/2] common: use _require_xfs_io_command() directly to check fiemap Xiao Yang
  1 sibling, 0 replies; 8+ messages in thread
From: Xiao Yang @ 2017-05-16  8:13 UTC (permalink / raw)
  To: Eryu Guan; +Cc: fstests

On 2017/05/16 16:04, Eryu Guan wrote:
> On Mon, May 15, 2017 at 03:17:59PM +0800, Xiao Yang wrote:
>> We don't need to check specific flags at the end of this function
>> if we have checked them before. e.g, generic/071 and generic/422
>> are marked as notrun unexpectedly because xfs_io doesn't support
>> long-format help for falloc before xfsprogs v4.9.  Actually, xfs_io
>> has supported falloc, so these case should not be marked as notrun.
>>
>> Signed-off-by: Xiao Yang<yangx.jy@cn.fujitsu.com>
> Thanks for the fix!
>
>> ---
>>   common/rc | 12 ++++++++----
>>   1 file changed, 8 insertions(+), 4 deletions(-)
>>
>> diff --git a/common/rc b/common/rc
>> index 539f153..2c893c0 100644
>> --- a/common/rc
>> +++ b/common/rc
>> @@ -2041,6 +2041,7 @@ _require_xfs_io_command()
>>   	command=$1
>>   	shift
>>   	param="$*"
>> +	param_check=0
>>
>>   	testfile=$TEST_DIR/$$.xfs_io
>>   	case $command in
>> @@ -2055,6 +2056,7 @@ _require_xfs_io_command()
>>   		;;
>>   	"falloc" )
>>   		testio=`$XFS_IO_PROG -F -f -c "falloc $param 0 1m" $testfile 2>&1`
>> +		param_check=1
>>   		;;
>>   	"fpunch" | "fcollapse" | "zero" | "fzero" | "finsert" | "funshare")
>>   		testio=`$XFS_IO_PROG -F -f -c "pwrite 0 20k" -c "fsync" \
>> @@ -2063,6 +2065,7 @@ _require_xfs_io_command()
>>   	"fiemap")
>>   		testio=`$XFS_IO_PROG -F -f -c "pwrite 0 20k" -c "fsync" \
>>   			-c "fiemap -v $param" $testfile 2>&1`
>> +		param_check=1
>>   		;;
>>   	"flink" )
>>   		testio=`$XFS_IO_PROG -T -F -c "flink $testfile" \
>> @@ -2087,7 +2090,7 @@ _require_xfs_io_command()
>>   		testio=`$XFS_IO_PROG -f -c "utimes" 0 0 0 0 $testfile 2>&1`
>>   		;;
>>   	*)
>> -		testio=`$XFS_IO_PROG -c "$command help" 2>&1`
>> +		testio=`$XFS_IO_PROG -c "help $command" 2>&1`
>>   	esac
>>
>>   	rm -f $testfile 2>&1>  /dev/null
>> @@ -2100,9 +2103,10 @@ _require_xfs_io_command()
>>   	echo $testio | grep -q "foreign file active"&&  \
>>   		_notrun "xfs_io $command not supported on $FSTYP"
>>
>> -	test -z "$param"&&  return
>> -	$XFS_IO_PROG -c "help $command" | grep -q "^ $param --" || \
>> -		_notrun "xfs_io $command doesn't support $param"
>> +	if [ -n $param -a $param_check -eq 0 ]; then
> $param needs quotes here, otherwise if no param is specified [ -n ]
> still reports pass, e.g.
>
> $ unset empty_var
> $ if [ -n $empty_var ]; then echo "should not see this"; fi
> should not see this
> $ if [ -n "$empty_var" ]; then echo "should not see this"; fi
> <nothing printed>
>
> I can fix it at commit time.
Hi Eryu

Agreed.  Thanks for your explanation. :-)

Thanks,
Xiao Yang.
> Thanks,
> Eryu
>
>> +		$XFS_IO_PROG -c "help $command" | grep -q "^ $param --" || \
>> +			_notrun "xfs_io $command doesn't support $param"
>> +	fi
>>   }
>>
>>   # check that kernel and filesystem support direct I/O
>> -- 
>> 1.8.3.1
>>
>>
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe fstests" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
> .
>




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

* Re: [PATCH 1/2] common: use _require_xfs_io_command() directly to check fiemap
  2017-05-15  7:17 [PATCH 1/2] common: use _require_xfs_io_command() directly to check fiemap Xiao Yang
  2017-05-15  7:17 ` [PATCH 2/2] common: cleanup _require_xfs_io_command Xiao Yang
@ 2017-05-16  8:16 ` Amir Goldstein
  2017-05-17  1:10   ` Xiao Yang
  1 sibling, 1 reply; 8+ messages in thread
From: Amir Goldstein @ 2017-05-16  8:16 UTC (permalink / raw)
  To: Xiao Yang; +Cc: fstests

On Mon, May 15, 2017 at 10:17 AM, Xiao Yang <yangx.jy@cn.fujitsu.com> wrote:
> We could remove _require_fiemap and _require_fiemap_attr.
>

We COULD remove it but why SHOULD we?

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

* Re: [PATCH 1/2] common: use _require_xfs_io_command() directly to check fiemap
  2017-05-16  8:16 ` [PATCH 1/2] common: use _require_xfs_io_command() directly to check fiemap Amir Goldstein
@ 2017-05-17  1:10   ` Xiao Yang
  0 siblings, 0 replies; 8+ messages in thread
From: Xiao Yang @ 2017-05-17  1:10 UTC (permalink / raw)
  To: Amir Goldstein; +Cc: fstests, Eryu Guan

On 2017/05/16 16:16, Amir Goldstein wrote:
> On Mon, May 15, 2017 at 10:17 AM, Xiao Yang<yangx.jy@cn.fujitsu.com>  wrote:
>> We could remove _require_fiemap and _require_fiemap_attr.
>>
> We COULD remove it but why SHOULD we?
>
>
Hi Amir

Sorry for my lack of explanation, this is just a cleanup for growing 
unnecessary helper.

_require_fiemap and _require_xfs_io_command "fiemap" do the same thing, but i find that
some test cases use the former and some use the latter, i feel they shoud be unified.

Moreover, the number of helpers like this is slowly growing, but it's easy to simply use
_require_xfs_io_command directly and just specify the command we want to check.

If it is acceptable, then i will rewrite the commit message and send a v2.

Thanks,
Xiao Yang






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

* [PATCH v2 1/2] common: use _require_xfs_io_command() directly to check fiemap
  2017-05-16  8:04   ` Eryu Guan
  2017-05-16  8:13     ` Xiao Yang
@ 2017-05-17  1:42     ` Xiao Yang
  2017-05-17  1:42       ` [PATCH v2 2/2] common: cleanup _require_xfs_io_command Xiao Yang
  1 sibling, 1 reply; 8+ messages in thread
From: Xiao Yang @ 2017-05-17  1:42 UTC (permalink / raw)
  To: eguan; +Cc: amir73il, fstests, Xiao Yang

1) _require_fiemap and _require_xfs_io_command "fiemap" do the
   same thing, but some test cases use the former and some use
   the latter, so i feel they should be unified.

2) The number of helpers like this is slowly growing, but it's
   easy to simply use _require_xfs_io_command directly and just
   specify the command we want to check.

This is just a cleanup for keeping it simple.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
---
 common/rc         | 12 ------------
 common/reflink    |  2 +-
 tests/generic/043 |  2 +-
 tests/generic/044 |  2 +-
 tests/generic/045 |  2 +-
 tests/generic/046 |  2 +-
 tests/generic/047 |  2 +-
 tests/generic/048 |  2 +-
 tests/generic/049 |  2 +-
 tests/generic/092 |  2 +-
 tests/generic/301 |  2 +-
 tests/generic/302 |  2 +-
 tests/generic/305 |  2 +-
 tests/generic/326 |  2 +-
 tests/generic/327 |  2 +-
 tests/generic/328 |  2 +-
 tests/generic/352 |  2 +-
 tests/generic/353 |  2 +-
 tests/generic/372 |  2 +-
 tests/generic/414 |  2 +-
 tests/generic/425 |  2 +-
 tests/xfs/180     |  2 +-
 tests/xfs/182     |  2 +-
 tests/xfs/184     |  2 +-
 tests/xfs/192     |  2 +-
 tests/xfs/193     |  2 +-
 tests/xfs/198     |  2 +-
 tests/xfs/200     |  2 +-
 tests/xfs/204     |  2 +-
 tests/xfs/207     |  2 +-
 tests/xfs/208     |  2 +-
 tests/xfs/209     |  2 +-
 tests/xfs/210     |  2 +-
 tests/xfs/211     |  2 +-
 tests/xfs/212     |  2 +-
 tests/xfs/213     |  2 +-
 tests/xfs/214     |  2 +-
 tests/xfs/231     |  2 +-
 tests/xfs/232     |  2 +-
 tests/xfs/344     |  2 +-
 tests/xfs/345     |  2 +-
 tests/xfs/346     |  2 +-
 tests/xfs/347     |  2 +-
 43 files changed, 42 insertions(+), 54 deletions(-)

diff --git a/common/rc b/common/rc
index aa35b5e..539f153 100644
--- a/common/rc
+++ b/common/rc
@@ -2940,12 +2940,6 @@ _require_metadata_journaling()
 	esac
 }
 
-# Does fiemap support?
-_require_fiemap()
-{
-	_require_xfs_io_command "fiemap"
-}
-
 _count_extents()
 {
 	$XFS_IO_PROG -c "fiemap" $1 | tail -n +2 | grep -v hole | wc -l
@@ -2956,12 +2950,6 @@ _count_holes()
 	$XFS_IO_PROG -c "fiemap" $1 | tail -n +2 | grep hole | wc -l
 }
 
-# Does fiemap support reporting xattr extents?
-_require_fiemap_attr()
-{
-	_require_xfs_io_command "fiemap" "-a"
-}
-
 _count_attr_extents()
 {
 	$XFS_IO_PROG -c "fiemap -a" $1 | tail -n +2 | grep -v hole | wc -l
diff --git a/common/reflink b/common/reflink
index 2e364e5..2a7c7b8 100644
--- a/common/reflink
+++ b/common/reflink
@@ -111,7 +111,7 @@ _require_scratch_reflink()
 _require_scratch_explicit_shared_extents()
 {
 	_require_scratch
-	_require_fiemap
+	_require_xfs_io_command "fiemap"
 	_require_scratch_reflink
 	_require_xfs_io_command "reflink"
 	local nr_extents
diff --git a/tests/generic/043 b/tests/generic/043
index 3d98ab0..784683e 100755
--- a/tests/generic/043
+++ b/tests/generic/043
@@ -41,7 +41,7 @@ _supported_os Linux IRIX
 
 _require_scratch
 _require_scratch_shutdown
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _scratch_mkfs >/dev/null 2>&1
 _require_metadata_journaling $SCRATCH_DEV
 _scratch_mount
diff --git a/tests/generic/044 b/tests/generic/044
index eb64b86..f0dc0df 100755
--- a/tests/generic/044
+++ b/tests/generic/044
@@ -41,7 +41,7 @@ _supported_os Linux IRIX
 
 _require_scratch
 _require_scratch_shutdown
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _scratch_mkfs >/dev/null 2>&1
 _require_metadata_journaling $SCRATCH_DEV
 _scratch_mount
diff --git a/tests/generic/045 b/tests/generic/045
index 5ef747f..b49d09e 100755
--- a/tests/generic/045
+++ b/tests/generic/045
@@ -41,7 +41,7 @@ _supported_os Linux IRIX
 
 _require_scratch
 _require_scratch_shutdown
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _scratch_mkfs >/dev/null 2>&1
 _require_metadata_journaling $SCRATCH_DEV
 _scratch_mount
diff --git a/tests/generic/046 b/tests/generic/046
index 882cb09..54cb557 100755
--- a/tests/generic/046
+++ b/tests/generic/046
@@ -41,7 +41,7 @@ _supported_os Linux IRIX
 
 _require_scratch
 _require_scratch_shutdown
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _scratch_mkfs >/dev/null 2>&1
 _require_metadata_journaling $SCRATCH_DEV
 _scratch_mount
diff --git a/tests/generic/047 b/tests/generic/047
index d7e4610..20f157e 100755
--- a/tests/generic/047
+++ b/tests/generic/047
@@ -42,7 +42,7 @@ _supported_os Linux IRIX
 
 _require_scratch
 _require_scratch_shutdown
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _scratch_mkfs >/dev/null 2>&1
 _require_metadata_journaling $SCRATCH_DEV
 _scratch_mount
diff --git a/tests/generic/048 b/tests/generic/048
index 3f0bcc1..dc2ab20 100755
--- a/tests/generic/048
+++ b/tests/generic/048
@@ -42,7 +42,7 @@ _supported_os Linux IRIX
 
 _require_scratch
 _require_scratch_shutdown
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _scratch_mkfs >/dev/null 2>&1
 _require_metadata_journaling $SCRATCH_DEV
 _scratch_mount
diff --git a/tests/generic/049 b/tests/generic/049
index 1f2a4b2..c7f1944 100755
--- a/tests/generic/049
+++ b/tests/generic/049
@@ -42,7 +42,7 @@ _supported_os Linux IRIX
 
 _require_scratch
 _require_scratch_shutdown
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _scratch_mkfs >/dev/null 2>&1
 _require_metadata_journaling $SCRATCH_DEV
 _scratch_mount
diff --git a/tests/generic/092 b/tests/generic/092
index faf08f1..cc615f6 100755
--- a/tests/generic/092
+++ b/tests/generic/092
@@ -53,7 +53,7 @@ _supported_fs generic
 _supported_os Linux
 _require_test
 _require_xfs_io_command "falloc"
-_require_fiemap
+_require_xfs_io_command "fiemap"
 
 # First test to make sure that truncating at i_size trims the preallocated bit
 # past i_size
diff --git a/tests/generic/301 b/tests/generic/301
index 67b1a0c..1c6ea05 100755
--- a/tests/generic/301
+++ b/tests/generic/301
@@ -47,7 +47,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 
 rm -f $seqres.full
 
diff --git a/tests/generic/302 b/tests/generic/302
index 3834f98..5643bb5 100755
--- a/tests/generic/302
+++ b/tests/generic/302
@@ -47,7 +47,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_odirect
 
 rm -f $seqres.full
diff --git a/tests/generic/305 b/tests/generic/305
index ceef333..cb05799 100755
--- a/tests/generic/305
+++ b/tests/generic/305
@@ -46,7 +46,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_quota
 _require_nobody
 _require_user
diff --git a/tests/generic/326 b/tests/generic/326
index 3568efe..c6cc9bb 100755
--- a/tests/generic/326
+++ b/tests/generic/326
@@ -46,7 +46,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_quota
 _require_nobody
 _require_odirect
diff --git a/tests/generic/327 b/tests/generic/327
index 05cfb4a..1e1ab6a 100755
--- a/tests/generic/327
+++ b/tests/generic/327
@@ -45,7 +45,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_quota
 _require_nobody
 _require_user
diff --git a/tests/generic/328 b/tests/generic/328
index 21ec9d3..1ad53fd 100755
--- a/tests/generic/328
+++ b/tests/generic/328
@@ -45,7 +45,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_quota
 _require_nobody
 _require_odirect
diff --git a/tests/generic/352 b/tests/generic/352
index 70e43fb..30eb43b 100755
--- a/tests/generic/352
+++ b/tests/generic/352
@@ -55,7 +55,7 @@ rm -f $seqres.full
 _supported_fs generic
 _supported_os Linux
 _require_scratch_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 
 _scratch_mkfs > /dev/null 2>&1
 _scratch_mount
diff --git a/tests/generic/353 b/tests/generic/353
index ca665cf..ddb9346 100755
--- a/tests/generic/353
+++ b/tests/generic/353
@@ -56,7 +56,7 @@ rm -f $seqres.full
 _supported_fs generic
 _supported_os Linux
 _require_scratch_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 
 _scratch_mkfs > /dev/null 2>&1
 _scratch_mount
diff --git a/tests/generic/372 b/tests/generic/372
index 51a3eca..08c81a9 100755
--- a/tests/generic/372
+++ b/tests/generic/372
@@ -46,7 +46,7 @@ _cleanup()
 _supported_os Linux
 _supported_fs generic
 _require_scratch_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_scratch_explicit_shared_extents
 
 echo "Format and mount"
diff --git a/tests/generic/414 b/tests/generic/414
index ee85d73..6f2136e 100755
--- a/tests/generic/414
+++ b/tests/generic/414
@@ -47,7 +47,7 @@ _cleanup()
 _supported_os Linux
 _supported_fs generic
 _require_scratch_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 
 echo "Format and mount"
 _scratch_mkfs > $seqres.full 2>&1
diff --git a/tests/generic/425 b/tests/generic/425
index 31e8467..800afc5 100755
--- a/tests/generic/425
+++ b/tests/generic/425
@@ -48,7 +48,7 @@ _supported_os Linux
 _supported_fs generic
 _require_scratch
 _require_attrs
-_require_fiemap_attr
+_require_xfs_io_command "fiemap" "-a"
 
 echo "Format and mount"
 _scratch_mkfs > $seqres.full 2>&1
diff --git a/tests/xfs/180 b/tests/xfs/180
index ce2ac26..736267e 100755
--- a/tests/xfs/180
+++ b/tests/xfs/180
@@ -49,7 +49,7 @@ _supported_os Linux
 _supported_fs xfs
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_xfs_io_command "cowextsize"
 
 rm -f $seqres.full
diff --git a/tests/xfs/182 b/tests/xfs/182
index 4413c7d..6d7d21e 100755
--- a/tests/xfs/182
+++ b/tests/xfs/182
@@ -49,7 +49,7 @@ _supported_os Linux
 _supported_fs xfs
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_xfs_io_command "cowextsize"
 _require_odirect
 
diff --git a/tests/xfs/184 b/tests/xfs/184
index 54eb115..2ae19ab 100755
--- a/tests/xfs/184
+++ b/tests/xfs/184
@@ -49,7 +49,7 @@ _supported_os Linux
 _supported_fs xfs
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_xfs_io_command "cowextsize"
 _require_xfs_io_command "funshare"
 
diff --git a/tests/xfs/192 b/tests/xfs/192
index d8bdb25..eeb6025 100755
--- a/tests/xfs/192
+++ b/tests/xfs/192
@@ -49,7 +49,7 @@ _supported_os Linux
 _supported_fs xfs
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_xfs_io_command "cowextsize"
 _require_xfs_io_command "funshare"
 _require_odirect
diff --git a/tests/xfs/193 b/tests/xfs/193
index 76cb143..c45f05a 100755
--- a/tests/xfs/193
+++ b/tests/xfs/193
@@ -48,7 +48,7 @@ _supported_os Linux
 _supported_fs xfs
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_xfs_io_command "cowextsize"
 
 rm -f $seqres.full
diff --git a/tests/xfs/198 b/tests/xfs/198
index d185ca2..bdfd44a 100755
--- a/tests/xfs/198
+++ b/tests/xfs/198
@@ -48,7 +48,7 @@ _supported_os Linux
 _supported_fs xfs
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_xfs_io_command "cowextsize"
 _require_odirect
 
diff --git a/tests/xfs/200 b/tests/xfs/200
index e70fda3..328341c 100755
--- a/tests/xfs/200
+++ b/tests/xfs/200
@@ -51,7 +51,7 @@ _supported_os Linux
 _supported_fs xfs
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_xfs_io_command "cowextsize"
 _require_xfs_io_command "funshare"
 
diff --git a/tests/xfs/204 b/tests/xfs/204
index c0b69cf..9a134e9 100755
--- a/tests/xfs/204
+++ b/tests/xfs/204
@@ -51,7 +51,7 @@ _supported_os Linux
 _supported_fs xfs
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_xfs_io_command "cowextsize"
 _require_xfs_io_command "funshare"
 _require_odirect
diff --git a/tests/xfs/207 b/tests/xfs/207
index efa283f..f9998ee 100755
--- a/tests/xfs/207
+++ b/tests/xfs/207
@@ -48,7 +48,7 @@ _supported_os Linux
 _supported_fs xfs
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_xfs_io_command "cowextsize"
 
 rm -f $seqres.full
diff --git a/tests/xfs/208 b/tests/xfs/208
index 62192cb..b00e4ab 100755
--- a/tests/xfs/208
+++ b/tests/xfs/208
@@ -52,7 +52,7 @@ _supported_os Linux
 _supported_fs xfs
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_xfs_io_command "cowextsize"
 
 rm -f $seqres.full
diff --git a/tests/xfs/209 b/tests/xfs/209
index 9bf1f12..83ccdf6 100755
--- a/tests/xfs/209
+++ b/tests/xfs/209
@@ -45,7 +45,7 @@ _supported_os Linux
 _supported_fs xfs
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_xfs_io_command "cowextsize"
 
 rm -f $seqres.full
diff --git a/tests/xfs/210 b/tests/xfs/210
index d3a2716..8a77464 100755
--- a/tests/xfs/210
+++ b/tests/xfs/210
@@ -49,7 +49,7 @@ _supported_os Linux
 _supported_fs xfs
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_xfs_io_command "cowextsize"
 
 rm -f $seqres.full
diff --git a/tests/xfs/211 b/tests/xfs/211
index 0d150f1..bd4b799 100755
--- a/tests/xfs/211
+++ b/tests/xfs/211
@@ -49,7 +49,7 @@ _supported_os Linux
 _supported_fs xfs
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_xfs_io_command "cowextsize"
 _require_odirect
 
diff --git a/tests/xfs/212 b/tests/xfs/212
index 48235d4..90f6903 100755
--- a/tests/xfs/212
+++ b/tests/xfs/212
@@ -48,7 +48,7 @@ _supported_os Linux
 _supported_fs xfs
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 
 rm -f $seqres.full
 
diff --git a/tests/xfs/213 b/tests/xfs/213
index 844166c..2029abb 100755
--- a/tests/xfs/213
+++ b/tests/xfs/213
@@ -48,7 +48,7 @@ _supported_os Linux
 _supported_fs xfs
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_quota
 _require_nobody
 _require_xfs_io_command "cowextsize"
diff --git a/tests/xfs/214 b/tests/xfs/214
index 01ffbaf..719ea2b 100755
--- a/tests/xfs/214
+++ b/tests/xfs/214
@@ -48,7 +48,7 @@ _supported_os Linux
 _supported_fs xfs
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_quota
 _require_nobody
 _require_xfs_io_command "cowextsize"
diff --git a/tests/xfs/231 b/tests/xfs/231
index f0b64c0..ac1dd16 100755
--- a/tests/xfs/231
+++ b/tests/xfs/231
@@ -52,7 +52,7 @@ _supported_fs xfs
 _require_scratch_reflink
 _require_cp_reflink
 _require_xfs_io_command "cowextsize"
-_require_fiemap
+_require_xfs_io_command "fiemap"
 
 old_cow_lifetime=$(cat /proc/sys/fs/xfs/speculative_cow_prealloc_lifetime)
 
diff --git a/tests/xfs/232 b/tests/xfs/232
index 6b74997..8638ee6 100755
--- a/tests/xfs/232
+++ b/tests/xfs/232
@@ -53,7 +53,7 @@ _supported_fs xfs
 _require_xfs_io_command "cowextsize"
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 
 old_cow_lifetime=$(cat /proc/sys/fs/xfs/speculative_cow_prealloc_lifetime)
 
diff --git a/tests/xfs/344 b/tests/xfs/344
index 806f7ab..d5288cf 100755
--- a/tests/xfs/344
+++ b/tests/xfs/344
@@ -49,7 +49,7 @@ _supported_os Linux
 _supported_fs xfs
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_xfs_io_command "cowextsize"
 _require_xfs_io_command "funshare"
 _require_odirect
diff --git a/tests/xfs/345 b/tests/xfs/345
index 1684297..ccfdb8f 100755
--- a/tests/xfs/345
+++ b/tests/xfs/345
@@ -48,7 +48,7 @@ _supported_os Linux
 _supported_fs xfs
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_xfs_io_command "cowextsize"
 _require_xfs_io_command "funshare"
 
diff --git a/tests/xfs/346 b/tests/xfs/346
index 90fe5eb..f189b5d 100755
--- a/tests/xfs/346
+++ b/tests/xfs/346
@@ -49,7 +49,7 @@ _supported_os Linux
 _supported_fs xfs
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_xfs_io_command "cowextsize"
 _require_xfs_io_command "funshare"
 _require_odirect
diff --git a/tests/xfs/347 b/tests/xfs/347
index 2a13977..fbc5ce3 100755
--- a/tests/xfs/347
+++ b/tests/xfs/347
@@ -49,7 +49,7 @@ _supported_os Linux
 _supported_fs xfs
 _require_scratch_reflink
 _require_cp_reflink
-_require_fiemap
+_require_xfs_io_command "fiemap"
 _require_xfs_io_command "cowextsize"
 _require_xfs_io_command "funshare"
 
-- 
1.8.3.1




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

* [PATCH v2 2/2] common: cleanup _require_xfs_io_command
  2017-05-17  1:42     ` [PATCH v2 1/2] common: use _require_xfs_io_command() directly to check fiemap Xiao Yang
@ 2017-05-17  1:42       ` Xiao Yang
  0 siblings, 0 replies; 8+ messages in thread
From: Xiao Yang @ 2017-05-17  1:42 UTC (permalink / raw)
  To: eguan; +Cc: amir73il, fstests, Xiao Yang

We don't need to check specific flags at the end of this function
if we have checked them before. e.g, generic/071 and generic/422
are marked as notrun unexpectedly because xfs_io doesn't support
long-format help for falloc before xfsprogs v4.9.  Actually, xfs_io
has supported falloc, so these case should not be marked as notrun.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
---
 common/rc | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/common/rc b/common/rc
index 539f153..6c27dea 100644
--- a/common/rc
+++ b/common/rc
@@ -2041,6 +2041,7 @@ _require_xfs_io_command()
 	command=$1
 	shift
 	param="$*"
+	param_check=0
 
 	testfile=$TEST_DIR/$$.xfs_io
 	case $command in
@@ -2055,6 +2056,7 @@ _require_xfs_io_command()
 		;;
 	"falloc" )
 		testio=`$XFS_IO_PROG -F -f -c "falloc $param 0 1m" $testfile 2>&1`
+		param_check=1
 		;;
 	"fpunch" | "fcollapse" | "zero" | "fzero" | "finsert" | "funshare")
 		testio=`$XFS_IO_PROG -F -f -c "pwrite 0 20k" -c "fsync" \
@@ -2063,6 +2065,7 @@ _require_xfs_io_command()
 	"fiemap")
 		testio=`$XFS_IO_PROG -F -f -c "pwrite 0 20k" -c "fsync" \
 			-c "fiemap -v $param" $testfile 2>&1`
+		param_check=1
 		;;
 	"flink" )
 		testio=`$XFS_IO_PROG -T -F -c "flink $testfile" \
@@ -2087,7 +2090,7 @@ _require_xfs_io_command()
 		testio=`$XFS_IO_PROG -f -c "utimes" 0 0 0 0 $testfile 2>&1`
 		;;
 	*)
-		testio=`$XFS_IO_PROG -c "$command help" 2>&1`
+		testio=`$XFS_IO_PROG -c "help $command" 2>&1`
 	esac
 
 	rm -f $testfile 2>&1 > /dev/null
@@ -2100,9 +2103,10 @@ _require_xfs_io_command()
 	echo $testio | grep -q "foreign file active" && \
 		_notrun "xfs_io $command not supported on $FSTYP"
 
-	test -z "$param" && return
-	$XFS_IO_PROG -c "help $command" | grep -q "^ $param --" || \
-		_notrun "xfs_io $command doesn't support $param"
+	if [ -n "$param" -a $param_check -eq 0 ]; then
+		$XFS_IO_PROG -c "help $command" | grep -q "^ $param --" || \
+			_notrun "xfs_io $command doesn't support $param"
+	fi
 }
 
 # check that kernel and filesystem support direct I/O
-- 
1.8.3.1




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

end of thread, other threads:[~2017-05-17  1:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-15  7:17 [PATCH 1/2] common: use _require_xfs_io_command() directly to check fiemap Xiao Yang
2017-05-15  7:17 ` [PATCH 2/2] common: cleanup _require_xfs_io_command Xiao Yang
2017-05-16  8:04   ` Eryu Guan
2017-05-16  8:13     ` Xiao Yang
2017-05-17  1:42     ` [PATCH v2 1/2] common: use _require_xfs_io_command() directly to check fiemap Xiao Yang
2017-05-17  1:42       ` [PATCH v2 2/2] common: cleanup _require_xfs_io_command Xiao Yang
2017-05-16  8:16 ` [PATCH 1/2] common: use _require_xfs_io_command() directly to check fiemap Amir Goldstein
2017-05-17  1:10   ` Xiao Yang

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.