fstests: define and use TIMEOUT_PROG
authorAmir Goldstein <amir73il@gmail.com>
Mon, 14 May 2018 05:49:50 +0000 (08:49 +0300)
committerEryu Guan <guaneryu@gmail.com>
Wed, 16 May 2018 03:31:38 +0000 (11:31 +0800)
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
common/config
tests/generic/297
tests/generic/298

index cc3180694e26d69c09da2f729ea32f0125b6ac5b..af360cefc80471a7c1c505d46759b9b590d26af9 100644 (file)
@@ -204,6 +204,7 @@ export UBIUPDATEVOL_PROG="`set_prog_path ubiupdatevol`"
 export THIN_CHECK_PROG="$(set_prog_path thin_check)"
 export PYTHON2_PROG="`set_prog_path python2`"
 export SQLITE3_PROG="`set_prog_path sqlite3`"
+export TIMEOUT_PROG="`set_prog_path timeout`"
 
 # use 'udevadm settle' or 'udevsettle' to wait for lv to be settled.
 # newer systems have udevadm command but older systems like RHEL5 don't.
index f7eb37b98a401345aca31d995e3a3ac9d2a3f348..a3ba5c4faaebc5b443984b8e255ba348e750c610 100755 (executable)
@@ -45,7 +45,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_cp_reflink
-_require_command "$(which timeout)" "timeout"
+_require_command "$TIMEOUT_PROG" "timeout"
 
 test $FSTYP == "nfs"  && _notrun "NFS can't interrupt clone operations"
 
@@ -83,7 +83,7 @@ kill_after=2  # give us a shorter time to die
 n=$(stat -c '%s' $testdir/file1)
 echo "performing kill test on $n bytes..." >> $seqres.full
 touch $TEST_DIR/before
-timeout -s INT ${kill_after}s $XFS_IO_PROG -f -c "reflink $testdir/file1 0 $n $n" $testdir/file1 >> $seqres.full 2>&1
+$TIMEOUT_PROG -s INT ${kill_after}s $XFS_IO_PROG -f -c "reflink $testdir/file1 0 $n $n" $testdir/file1 >> $seqres.full 2>&1
 touch $TEST_DIR/after
 before=$(stat -c '%Y' $TEST_DIR/before)
 after=$(stat -c '%Y' $TEST_DIR/after)
index b518da1db78be94905e88db725c52ec748fd87d5..a4d458cf267e8face390bf1cc49b7e698cdfbe64 100755 (executable)
@@ -45,7 +45,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_cp_reflink
-_require_command "$(which timeout)" "timeout"
+_require_command "$TIMEOUT_PROG" "timeout"
 
 test $FSTYP == "nfs"  && _notrun "NFS can't interrupt clone operations"
 
@@ -83,7 +83,7 @@ kill_after=2  # give us a shorter time to die
 n=$(stat -c '%s' $testdir/file1)
 echo "performing kill test on $n bytes..." >> $seqres.full
 touch $TEST_DIR/before
-urk=$(timeout -s KILL ${kill_after}s $XFS_IO_PROG -f -c "reflink $testdir/file1 0 $n $n" $testdir/file1 >> $seqres.full 2>&1)
+urk=$($TIMEOUT_PROG -s KILL ${kill_after}s $XFS_IO_PROG -f -c "reflink $testdir/file1 0 $n $n" $testdir/file1 >> $seqres.full 2>&1)
 touch $TEST_DIR/after
 before=$(stat -c '%Y' $TEST_DIR/before)
 after=$(stat -c '%Y' $TEST_DIR/after)