ac34d34e7b7184b7362d62414ddcf08c70a4a8ac
[xfstests-dev.git] / tests / generic / 285
1 #! /bin/bash
2 # FS QA Test No. 285
3 #
4 # SEEK_DATA/SEEK_HOLE sanity tests.
5 #
6 # Improved by Jeff.liu@oracle.com
7 # Creater: josef@redhat.com
8 #
9 #-----------------------------------------------------------------------
10 # Copyright (c) 2011 Oracle Inc.  All Rights Reserved.
11 # Copyright (c) 2011 Red Hat.  All Rights Reserved.
12 #
13 # This program is free software; you can redistribute it and/or
14 # modify it under the terms of the GNU General Public License as
15 # published by the Free Software Foundation.
16 #
17 # This program is distributed in the hope that it would be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 # GNU General Public License for more details.
21 #
22 # You should have received a copy of the GNU General Public License
23 # along with this program; if not, write the Free Software Foundation,
24 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
25 #-----------------------------------------------------------------------
26 #
27
28 seq=`basename $0`
29 seqres=$RESULT_DIR/$seq
30 echo "QA output created by $seq"
31
32 here=`pwd`
33 status=1        # failure is the default!
34 trap "_cleanup; exit \$status" 0 1 2 3 15
35
36 # get standard environment, filters and checks
37 . ./common/rc
38 . ./common/filter
39
40 _supported_fs generic
41 _supported_os Linux
42
43 _require_seek_data_hole
44
45 BASE_TEST_FILE=$TEST_DIR/seek_sanity_testfile
46
47 [ -x $here/src/seek_sanity_test ] || _notrun "seek_sanitfy_tester not built"
48
49 # Disable extent zeroing for ext4 as that change where holes are created
50 if [ "$FSTYP" = "ext4" ]; then
51         DEV=`_short_dev $TEST_DEV`
52         echo 0 >/sys/fs/ext4/$DEV/extent_max_zeroout_kb
53 fi
54
55 _cleanup()
56 {
57         eval "rm -f $BASE_TEST_FILE.*"
58 }
59
60 $here/src/seek_sanity_test $BASE_TEST_FILE > $seqres.full 2>&1 ||
61         _fail "seek sanity check failed!"
62
63 # success, all done
64 status=0
65 exit