From: Lukas Czerner Date: Mon, 28 Apr 2014 00:55:12 +0000 (+1000) Subject: common: Use _require_xfs_io_command() instead of helpers X-Git-Tag: v2022.05.01~3149 X-Git-Url: http://git.apps.os.sepia.ceph.com/?p=xfstests-dev.git;a=commitdiff_plain;h=ce0aa2bc5cdd8fcc3e56cd663796db731f8be893 common: Use _require_xfs_io_command() instead of helpers Number of helpers for checking xfs_io functionality is slowly growing. But it's as easy to simply use _require_xfs_io_command() directly and just specify the command we want to check. It will also avoid the need to create helper every time we need to check a new command in xfs_io. Remove all the helpers and use _require_xfs_io_command() in the tests. Signed-off-by: Lukas Czerner Reviewed-by: Eric Sandeen Signed-off-by: Dave Chinner --- diff --git a/common/defrag b/common/defrag index a4bc976e..732cd640 100644 --- a/common/defrag +++ b/common/defrag @@ -38,7 +38,7 @@ _require_defrag() esac _require_command $DEFRAG_PROG - _require_xfs_io_fiemap + _require_xfs_io_command "fiemap" } _extent_count() diff --git a/common/rc b/common/rc index 07acbc57..5c13db51 100644 --- a/common/rc +++ b/common/rc @@ -1260,47 +1260,6 @@ _require_xfs_io_command() _notrun "xfs_io $command failed (old kernel/wrong fs?)" } -# check that xfs_io, kernel, and filesystem all support zero -_require_xfs_io_zero() -{ - _require_xfs_io_command "zero" -} - -# check that xfs_io, glibc, kernel, and filesystem all (!) support -# fallocate -# -_require_xfs_io_falloc() -{ - _require_xfs_io_command "falloc" -} - -# check that xfs_io, kernel and filesystem all support fallocate with hole -# punching -_require_xfs_io_falloc_punch() -{ - _require_xfs_io_command "fpunch" -} - -# check that xfs_io, kernel and filesystem all support fallocate with collapse -# range -_require_xfs_io_falloc_collapse() -{ - _require_xfs_io_command "fcollapse" -} - -# check that xfs_io, kernel, and filesystem all support fallocate with zero -# range -_require_xfs_io_falloc_zero() -{ - _require_xfs_io_command "fzero" -} - -# check that xfs_io, kernel and filesystem support fiemap -_require_xfs_io_fiemap() -{ - _require_xfs_io_command "fiemap" -} - # Check that a fs has enough free space (in 1024b blocks) # _require_fs_space() diff --git a/tests/btrfs/026 b/tests/btrfs/026 index 6c545901..c2ac5617 100644 --- a/tests/btrfs/026 +++ b/tests/btrfs/026 @@ -48,7 +48,7 @@ _cleanup() _supported_fs btrfs _supported_os Linux -_require_xfs_io_fiemap +_require_xfs_io_command "fiemap" _require_cp_reflink TESTDIR1=$TEST_DIR/test-$seq diff --git a/tests/btrfs/027 b/tests/btrfs/027 index b2dff1c2..d615efd3 100644 --- a/tests/btrfs/027 +++ b/tests/btrfs/027 @@ -48,7 +48,7 @@ _cleanup() _supported_fs btrfs _supported_os Linux -_require_xfs_io_fiemap +_require_xfs_io_command "fiemap" _require_cp_reflink TESTDIR1=$TEST_DIR/test-$seq diff --git a/tests/btrfs/028 b/tests/btrfs/028 index f17f1029..50cffd35 100644 --- a/tests/btrfs/028 +++ b/tests/btrfs/028 @@ -46,7 +46,7 @@ _cleanup() _supported_fs btrfs _supported_os Linux -_require_xfs_io_fiemap +_require_xfs_io_command "fiemap" _require_cp_reflink rm -f $seqres.full diff --git a/tests/btrfs/047 b/tests/btrfs/047 index cc1936df..2dc6499b 100755 --- a/tests/btrfs/047 +++ b/tests/btrfs/047 @@ -59,7 +59,7 @@ _supported_fs btrfs _supported_os Linux _require_scratch _require_fssum -_require_xfs_io_fiemap +_require_xfs_io_command "fiemap" _require_btrfs_send_stream_version _need_to_be_root diff --git a/tests/ext4/001 b/tests/ext4/001 index 8239f0ee..827d8066 100755 --- a/tests/ext4/001 +++ b/tests/ext4/001 @@ -45,7 +45,7 @@ trap "_cleanup ; exit \$status" 0 1 2 3 15 # real QA test starts here _supported_fs ext4 _supported_os Linux -_require_xfs_io_falloc_zero +_require_xfs_io_command "fzero" testfile=$TEST_DIR/001.$$ diff --git a/tests/ext4/002 b/tests/ext4/002 index 12be2539..8cb3fd14 100755 --- a/tests/ext4/002 +++ b/tests/ext4/002 @@ -119,7 +119,7 @@ _check_ext4_eof_flag() # Prerequisites for the test run. _supported_fs ext4 _supported_os Linux -_require_xfs_io_falloc +_require_xfs_io_command "falloc" # Real QA test starts here. rm -f $seqres.full diff --git a/tests/generic/009 b/tests/generic/009 index b4d3e4bb..65abe3c1 100644 --- a/tests/generic/009 +++ b/tests/generic/009 @@ -44,7 +44,7 @@ trap "_cleanup ; exit \$status" 0 1 2 3 15 # real QA test starts here _supported_os Linux -_require_xfs_io_falloc_zero +_require_xfs_io_command "fzero" testfile=$TEST_DIR/009.$$ diff --git a/tests/generic/012 b/tests/generic/012 index e6892995..730625bb 100755 --- a/tests/generic/012 +++ b/tests/generic/012 @@ -51,10 +51,10 @@ trap "_cleanup ; exit \$status" 0 1 2 3 15 _supported_fs generic _supported_os Linux -_require_xfs_io_falloc_punch -_require_xfs_io_falloc -_require_xfs_io_fiemap -_require_xfs_io_falloc_collapse +_require_xfs_io_command "fpunch" +_require_xfs_io_command "falloc" +_require_xfs_io_command "fiemap" +_require_xfs_io_command "fcollapse" testfile=$TEST_DIR/$seq.$$ diff --git a/tests/generic/016 b/tests/generic/016 index 13a44883..15a25519 100755 --- a/tests/generic/016 +++ b/tests/generic/016 @@ -51,10 +51,10 @@ trap "_cleanup ; exit \$status" 0 1 2 3 15 _supported_fs generic _supported_os Linux -_require_xfs_io_falloc_punch -_require_xfs_io_falloc -_require_xfs_io_fiemap -_require_xfs_io_falloc_collapse +_require_xfs_io_command "fpunch" +_require_xfs_io_command "falloc" +_require_xfs_io_command "fiemap" +_require_xfs_io_command "fcollapse" testfile=$TEST_DIR/$seq.$$ diff --git a/tests/generic/017 b/tests/generic/017 index 93a4045b..13b7254d 100755 --- a/tests/generic/017 +++ b/tests/generic/017 @@ -43,8 +43,8 @@ _supported_fs generic _supported_os Linux _require_scratch -_require_xfs_io_fiemap -_require_xfs_io_falloc_collapse +_require_xfs_io_command "fiemap" +_require_xfs_io_command "fcollapse" _do_die_on_error=y testfile=$SCRATCH_MNT/$seq.$$ BLOCKS=10240 diff --git a/tests/generic/021 b/tests/generic/021 index 7f3753ad..eb88e016 100755 --- a/tests/generic/021 +++ b/tests/generic/021 @@ -51,10 +51,10 @@ trap "_cleanup ; exit \$status" 0 1 2 3 15 _supported_fs generic _supported_os Linux -_require_xfs_io_falloc_punch -_require_xfs_io_falloc -_require_xfs_io_fiemap -_require_xfs_io_falloc_collapse +_require_xfs_io_command "fpunch" +_require_xfs_io_command "falloc" +_require_xfs_io_command "fiemap" +_require_xfs_io_command "fcollapse" testfile=$TEST_DIR/$seq.$$ diff --git a/tests/generic/022 b/tests/generic/022 index 55e7206e..55bf8c54 100755 --- a/tests/generic/022 +++ b/tests/generic/022 @@ -51,10 +51,10 @@ trap "_cleanup ; exit \$status" 0 1 2 3 15 _supported_fs generic _supported_os Linux -_require_xfs_io_falloc_punch -_require_xfs_io_falloc -_require_xfs_io_fiemap -_require_xfs_io_falloc_collapse +_require_xfs_io_command "fpunch" +_require_xfs_io_command "falloc" +_require_xfs_io_command "fiemap" +_require_xfs_io_command "fcollapse" testfile=$TEST_DIR/$seq.$$ diff --git a/tests/generic/213 b/tests/generic/213 index 3c8a3042..c99520ff 100755 --- a/tests/generic/213 +++ b/tests/generic/213 @@ -54,7 +54,7 @@ _supported_os Linux rm -f $seqres.full -_require_xfs_io_falloc +_require_xfs_io_command "falloc" # check there's enough freespace on $TEST_DIR ... (1GiB + 1MiB) avail=`df -P $TEST_DIR | awk 'END {print $4}'` diff --git a/tests/generic/214 b/tests/generic/214 index 1885534f..444c1fe1 100755 --- a/tests/generic/214 +++ b/tests/generic/214 @@ -53,7 +53,7 @@ _supported_os Linux rm -f $seqres.full rm -f $TEST_DIR/ouch* -_require_xfs_io_falloc +_require_xfs_io_command "falloc" # Ok, off we go. diff --git a/tests/generic/223 b/tests/generic/223 index 7b0e5840..a67b8d58 100755 --- a/tests/generic/223 +++ b/tests/generic/223 @@ -46,7 +46,7 @@ _supported_fs generic _supported_os Linux _require_scratch -_require_xfs_io_falloc +_require_xfs_io_command "falloc" rm -f $seqres.full diff --git a/tests/generic/228 b/tests/generic/228 index 03d4491f..7ac0872a 100755 --- a/tests/generic/228 +++ b/tests/generic/228 @@ -53,7 +53,7 @@ _supported_os Linux rm -f $seqres.full # Sanity check to see if fallocate works -_require_xfs_io_falloc +_require_xfs_io_command "falloc" # Check if we have good enough space available avail=`df -P $TEST_DIR | awk 'END {print $4}'` diff --git a/tests/generic/255 b/tests/generic/255 index dd329b46..8419065e 100755 --- a/tests/generic/255 +++ b/tests/generic/255 @@ -46,9 +46,9 @@ trap "_cleanup ; exit \$status" 0 1 2 3 15 _supported_fs generic _supported_os Linux -_require_xfs_io_falloc_punch -_require_xfs_io_falloc -_require_xfs_io_fiemap +_require_xfs_io_command "fpunch" +_require_xfs_io_command "falloc" +_require_xfs_io_command "fiemap" testfile=$TEST_DIR/255.$$ diff --git a/tests/generic/256 b/tests/generic/256 index cfe72371..e6cc7dcf 100755 --- a/tests/generic/256 +++ b/tests/generic/256 @@ -46,7 +46,7 @@ trap "_cleanup ; exit \$status" 0 1 2 3 15 _supported_fs generic _supported_os Linux -_require_xfs_io_falloc_punch +_require_xfs_io_command "fpunch" _require_scratch _require_user diff --git a/tests/generic/274 b/tests/generic/274 index 7c4887f4..2d8d4962 100755 --- a/tests/generic/274 +++ b/tests/generic/274 @@ -48,7 +48,7 @@ _cleanup() _supported_fs generic _supported_os IRIX Linux _require_scratch -_require_xfs_io_falloc +_require_xfs_io_command "falloc" echo "------------------------------" echo "preallocation test" diff --git a/tests/generic/300 b/tests/generic/300 index 4e07f8a4..01d46003 100755 --- a/tests/generic/300 +++ b/tests/generic/300 @@ -46,8 +46,8 @@ _require_scratch # xfs_io is not required for this test, but it's the best way to verify # the test system supports fallocate() for allocation and hole punching -_require_xfs_io_falloc -_require_xfs_io_falloc_punch +_require_xfs_io_command "falloc" +_require_xfs_io_command "fpunch" rm -f $seqres.full diff --git a/tests/generic/311 b/tests/generic/311 index 284b59d5..e3890498 100755 --- a/tests/generic/311 +++ b/tests/generic/311 @@ -59,7 +59,7 @@ _require_dm_flakey # xfs_io is not required for this test, but it's the best way to verify # the test system supports fallocate() for allocation -_require_xfs_io_falloc +_require_xfs_io_command "falloc" [ -x $here/src/fsync-tester ] || _notrun "fsync-tester not built" diff --git a/tests/generic/312 b/tests/generic/312 index eaec43cc..1ed49626 100755 --- a/tests/generic/312 +++ b/tests/generic/312 @@ -46,7 +46,7 @@ _cleanup() # real QA test starts here _supported_fs generic _supported_os Linux -_require_xfs_io_falloc +_require_xfs_io_command "falloc" _require_scratch # 5G in byte diff --git a/tests/generic/316 b/tests/generic/316 index 8cb29752..29a4331f 100755 --- a/tests/generic/316 +++ b/tests/generic/316 @@ -45,8 +45,8 @@ _cleanup() _supported_fs generic _supported_os Linux -_require_xfs_io_falloc_punch -_require_xfs_io_fiemap +_require_xfs_io_command "fpunch" +_require_xfs_io_command "fiemap" testfile=$TEST_DIR/$seq.$$ diff --git a/tests/shared/298 b/tests/shared/298 index 6b5402c8..f13c14b3 100755 --- a/tests/shared/298 +++ b/tests/shared/298 @@ -33,7 +33,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fs ext4 xfs _supported_os Linux _require_fstrim -_require_xfs_io_fiemap +_require_xfs_io_command "fiemap" _require_fs_space $TEST_DIR 307200 [ "$FSTYP" = "ext4" ] && _require_dumpe2fs diff --git a/tests/xfs/252 b/tests/xfs/252 index 00be41ad..b2c4c089 100755 --- a/tests/xfs/252 +++ b/tests/xfs/252 @@ -46,8 +46,8 @@ trap "_cleanup ; exit \$status" 0 1 2 3 15 _supported_fs xfs _supported_os Linux -_require_xfs_io_falloc_punch -_require_xfs_io_fiemap +_require_xfs_io_command "fpunch" +_require_xfs_io_command "fiemap" testfile=$TEST_DIR/252.$$ diff --git a/tests/xfs/290 b/tests/xfs/290 index cbe7108d..55322ec9 100755 --- a/tests/xfs/290 +++ b/tests/xfs/290 @@ -46,7 +46,7 @@ trap "exit \$status" 0 1 2 3 15 _supported_fs xfs _supported_os Linux -_require_xfs_io_zero +_require_xfs_io_command "zero" testfile=$TEST_DIR/290.$$