fstests: test for fallocate capability in more tests
[xfstests-dev.git] / tests / generic / 286
index f6bf3569217b4637788cdee1777edd1666c6a795..8be4fbc91859daeaa74cb8de74151cb0d4b9c2d4 100755 (executable)
@@ -1,27 +1,11 @@
 #! /bin/bash
-# FS QA Test No. 286
-#
-# SEEK_DATA/SEEK_HOLE copy tests.
-#
-#-----------------------------------------------------------------------
+# SPDX-License-Identifier: GPL-2.0
 # Copyright (c) 2011 Oracle Inc.  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.
-#
-# 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.
-#
-# 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
+# FS QA Test No. 286
 #
-#-----------------------------------------------------------------------
+# SEEK_DATA/SEEK_HOLE copy tests.
 #
-
 seq=`basename $0`
 seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
@@ -39,12 +23,13 @@ _supported_fs generic
 _supported_os Linux
 
 _require_test
+_require_xfs_io_command "falloc"
 _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()
 {
@@ -73,7 +58,7 @@ test01()
 
        $here/src/seek_copy_test $src $dest
        
-       test $(stat -c "%s" $src) = $(stat -c "%s" $dest) ||
+       test $(_get_filesize $src) = $(_get_filesize $dest) ||
                _fail "TEST01: file size check failed"
 
        cmp $src $dest || _fail "TEST01: file bytes check failed"
@@ -101,7 +86,7 @@ test02()
 
        $here/src/seek_copy_test $src $dest
 
-       test $(stat -c "%s" $src) = $(stat -c "%s" $dest) ||
+       test $(_get_filesize $src) = $(_get_filesize $dest) ||
                _fail "TEST02: file size check failed"
 
        cmp $src $dest || _fail "TEST02: file bytes check failed"
@@ -143,7 +128,7 @@ test03()
        echo >>$seqres.full
        $here/src/seek_copy_test $src $dest
 
-       test $(stat -c "%s" $src) = $(stat -c "%s" $dest) ||
+       test $(_get_filesize $src) = $(_get_filesize $dest) ||
                _fail "TEST03: file size check failed"
 
        cmp $src $dest || _fail "TEST03: file bytes check failed"
@@ -185,7 +170,7 @@ test04()
        echo >>$seqres.full
        $here/src/seek_copy_test $src $dest
 
-       test $(stat -c "%s" $src) = $(stat -c "%s" $dest) ||
+       test $(_get_filesize $src) = $(_get_filesize $dest) ||
                _fail "TEST04: file size check failed"
 
        cmp $src $dest || _fail "TEST04: file bytes check failed"