#! /bin/bash
-# FS QA Test No. 298
-#
-# See how well reflink handles SIGKILL in the middle of a slow reflink.
-#
-#-----------------------------------------------------------------------
+# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2016, Oracle and/or its affiliates. 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.
+# FS QA Test No. 298
#
-# 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.
+# See how well reflink handles SIGKILL in the middle of a slow reflink.
#
-# 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"
_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"
echo "Try to kill reflink after a shorter period of time"
kill_after=2 # give us a shorter time to die
-n=$(stat -c '%s' $testdir/file1)
+n=$(_get_filesize $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)