]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
common: create _require_test_program to look for programs in src/
authorDarrick J. Wong <darrick.wong@oracle.com>
Tue, 9 Feb 2016 08:22:21 +0000 (00:22 -0800)
committerDarrick J. Wong <darrick.wong@oracle.com>
Fri, 12 Feb 2016 17:39:05 +0000 (09:39 -0800)
Create a helper that looks for a test program in src/ and fails the
test if it doesn't exist.  Refactor the existing testcases to use it.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
common/rc
tests/generic/010
tests/generic/094
tests/generic/225
tests/generic/285
tests/generic/286
tests/generic/311
tests/xfs/032
tests/xfs/044

index 84f794a800e8ee4b2ebcd42f950ea7f6b1378395..63eb90b5be2ff2a6dea1ab0b710cb8bb6ddecc08 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -1684,6 +1684,15 @@ _require_aiodio()
     _require_odirect
 }
 
+# this test requires that a test program exists under src/
+# $1 - command (require)
+#
+_require_test_program()
+{
+    SRC_TEST=src/$1
+    [ -x $SRC_TEST ] || _notrun "$SRC_TEST not built"
+}
+
 # run an aio-dio program
 # $1 - command
 _run_aiodio()
index ea8ea50acd8df2bd31e6a023ce557aa9136c59ac..1c9d8f7e5ab3d39a6b9c49c4f7a28a7abbe01ec2 100755 (executable)
@@ -51,7 +51,7 @@ _filter_dbtest()
 . ./common/rc
 . ./common/filter
 
-[ -x $here/src/dbtest ] || _notrun "dbtest was not built for this platform"
+_require_test_program "dbtest"
 
 # real QA test starts here
 _supported_fs generic
index 4e4b66841cfc6c282e633c1438ecf13beb71923d..a51738a481936d4c1f7bb48aff1686af96a119e1 100644 (file)
@@ -53,7 +53,7 @@ _scratch_mount > /dev/null 2>&1
 rm -f $seqres.full
 fiemapfile=$SCRATCH_MNT/$seq.fiemap
 
-[ -x $here/src/fiemap-tester ] || _notrun "fiemap-tester not built"
+_require_test_program "fiemap-tester"
 
 seed=`date +%s`
 
index 6134c8cc3826ca58a7381200061163573e76639d..c8e0f641c9bf9d38a0e1bce527166ff767a7b2f0 100755 (executable)
@@ -53,7 +53,7 @@ rm -f $seqres.full
 fiemapfile=$SCRATCH_MNT/$seq.fiemap
 fiemaplog=$SCRATCH_MNT/$seq.log
 
-[ -x $here/src/fiemap-tester ] || _notrun "fiemap-tester not built"
+_require_test_program "fiemap-tester"
 
 seed=`date +%s`
 
index d6275b5fdcd0e845bba289867aeaeec77197cad1..16e70b1d75187e9e3ff74f00d356115f4bb9c0a9 100755 (executable)
@@ -45,7 +45,7 @@ _require_seek_data_hole
 
 BASE_TEST_FILE=$TEST_DIR/seek_sanity_testfile
 
-[ -x $here/src/seek_sanity_test ] || _notrun "seek_sanitfy_tester not built"
+_require_test_program "seek_sanity_test"
 
 # Disable extent zeroing for ext4 as that change where holes are created
 if [ "$FSTYP" = "ext4" ]; then
index f6bf3569217b4637788cdee1777edd1666c6a795..f88f079e986cb490f6b7626ff8ba34d81bcf6de1 100755 (executable)
@@ -44,7 +44,7 @@ _require_seek_data_hole
 src=$TEST_DIR/seek_copy_testfile
 dest=$TEST_DIR/seek_copy_testfile.dest
 
-[ -x $here/src/seek_copy_test ] || _notrun "seek_copy_test not built"
+_require_test_program "seek_copy_test"
 
 _cleanup()
 {
index f55201197eda66540677de7777f5e7dc36bdb251..69bc1bfbfaeb7d3e20f2a641180cee62aa2c6e71 100755 (executable)
@@ -62,7 +62,7 @@ _require_metadata_journaling $SCRATCH_DEV
 # the test system supports fallocate() for allocation
 _require_xfs_io_command "falloc"
 
-[ -x $here/src/fsync-tester ] || _notrun "fsync-tester not built"
+_require_test_program "fsync-tester"
 
 rm -f $seqres.full
 SEED=1
index 063f272cc1e4ae6413c951d2ad3226a833276b1a..62163790d53ad71b64d9b0d42ce5a2a562bc402e 100755 (executable)
@@ -40,8 +40,7 @@ _supported_fs xfs
 _supported_os IRIX Linux
 
 _require_scratch
-
-[ $here/src/feature ] || _notrun "src/feature not built, skipping this test"
+_require_test_program "feature"
 
 [ "$USE_EXTERNAL" = yes ] && _notrun "Cannot xfs_copy with external devices"
 [ -n "$XFS_COPY_PROG" ] || _notrun "xfs_copy binary not yet installed"
index 2ffd74f0e3170ce5719d42bbbd3bc5a3e20bfc32..ea58c0709dfb76143f53e83d33341066dee5655f 100755 (executable)
@@ -124,7 +124,7 @@ _filter_mkfs <$tmp.mkfs0 2>$tmp.mkfs1
 [ $lversion -ne 1 ] && \
     _notrun "Cannot run this test yet using MKFS_OPTIONS specified"
 
-[ $here/src/loggen ] || _notrun "loggen not built, skipping test"
+_require_test_program "loggen"
 
 _check_mount
 _check_require_logdev