xfstests: resolve compiler warnings
[xfstests-dev.git] / 290
1 #! /bin/bash
2 # FS QA Test No. 290
3 #
4 # Makes calls to XFS_IOC_ZERO_RANGE and checks tossed ranges
5 #
6 # Nothing should be tossed unless the range includes a page boundry
7 #
8 # Primarily tests page boundries and boundries that are
9 #  off-by-one to ensure we're only tossing what's expected
10 #
11 #-----------------------------------------------------------------------
12 # Copyright (c) 2012 SGI.  All Rights Reserved.
13 #
14 # This program is free software; you can redistribute it and/or
15 # modify it under the terms of the GNU General Public License as
16 # published by the Free Software Foundation.
17 #
18 # This program is distributed in the hope that it would be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 # GNU General Public License for more details.
22 #
23 # You should have received a copy of the GNU General Public License
24 # along with this program; if not, write the Free Software Foundation,
25 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
26 #-----------------------------------------------------------------------
27 #
28 # creator
29 owner=adahl@sgi.com
30
31 seq=`basename $0`
32 echo "QA output created by $seq"
33
34 here=`pwd`
35 tmp=/tmp/$$
36 status=1        # failure is the default!
37 trap "exit \$status" 0 1 2 3 15
38
39 # get standard environment, filters and checks
40 . ./common.rc
41 . ./common.filter
42
43 # real QA test starts here
44
45 # Modify as appropriate.
46 _supported_fs xfs
47 _supported_os Linux
48
49 _require_xfs_io_zero
50
51 testfile=$TEST_DIR/290.$$
52
53 test_zero()
54 {
55         zero_start=$1
56         zero_len=$2
57
58         $XFS_IO_PROG -f -t -c "pwrite -S 0x41 0 4096" \
59                       -c "pwrite -S 0x42 4096 4096" \
60                       -c "zero $zero_start $zero_len" \
61                       -c "pread -v 0 8192" \
62                       $testfile | _filter_xfs_io_unique
63 }
64
65 # [0,1] -- Shouldn't toss anything
66 test_zero    0    1
67
68 #[0,4095] -- Shouldn't toss anything
69 test_zero    0 4095
70
71 #[0,4096] -- Should toss first page
72 test_zero    0 4096
73
74 #[0,4097] -- Should toss first page
75 test_zero    0 4097
76
77 #[4095,8191] -- Should toss last byte of first page
78 test_zero 4095 4096
79
80 #[4095,8192] -- Should toss second page & last byte of first page
81 test_zero 4095 4097
82
83 #[4095,8193] -- Should toss second page & last byte of first page
84 test_zero 4095 4098
85
86 #[4096,8192] -- Should toss second page
87 test_zero 4096 4096
88
89 #[1024,5120] -- Should toss from 1024 to end of first page
90 test_zero 1024 4096
91
92 # success, all done
93 status=0
94 exit