tests: remove IRIX support from tests also supported on Linux
[xfstests-dev.git] / tests / xfs / 164
1 #! /bin/bash
2 # FS QA Test No. 164
3 #
4 # To test for short dio reads on IRIX and Linux - pv#962005/962547
5 # http://bugworks.engr.sgi.com/query.cgi/962005
6 #
7 # In particular we are interested in dio_reads for the cases of:
8 # * eof on a hole
9 # * eof on an unwritten extent
10 # * eof on a sector boundary and not on a sector boundary 
11 #
12 #-----------------------------------------------------------------------
13 # Copyright (c) 2007 Silicon Graphics, Inc.  All Rights Reserved.
14 #
15 # This program is free software; you can redistribute it and/or
16 # modify it under the terms of the GNU General Public License as
17 # published by the Free Software Foundation.
18 #
19 # This program is distributed in the hope that it would be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22 # GNU General Public License for more details.
23 #
24 # You should have received a copy of the GNU General Public License
25 # along with this program; if not, write the Free Software Foundation,
26 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
27 #
28 #-----------------------------------------------------------------------
29 #
30
31 seq=`basename $0`
32 seqres=$RESULT_DIR/$seq
33 echo "QA output created by $seq"
34
35 here=`pwd`
36 tmp=/tmp/$$
37 status=1        # failure is the default!
38 trap "_cleanup; exit \$status" 0 1 2 3 15
39
40 _cleanup()
41 {
42     cd /
43     rm -f $tmp.*
44 }
45
46 _filter_io()
47 {
48     tee -a $seqres.full | sed 's/ops;.*/ops/'
49 }
50
51 #
52 #   1: [128..199]:      212280..212351    0 (212280..212351)    72 10000
53 #  
54 _filter_bmap()
55 {
56     awk '$3 ~ /hole/ { print $1, $2, $3; next }
57          $7 ~ /10000/ { print $1, $2, "unwritten"; next }
58          {print $1, $2}' >> $seqres.full
59 }
60
61 # get standard environment, filters and checks
62 . ./common/rc
63 . ./common/filter
64
65 # real QA test starts here
66
67 # Modify as appropriate.
68 _supported_fs xfs
69 _supported_os Linux
70 _require_test
71
72 testfile=$TEST_DIR/file.$seq
73 rm -f $seqres.full
74
75 _test_eof_hole()
76 {
77         # on a BB boundary
78         rm -f $testfile
79         $XFS_IO_PROG -f -d \
80                   -c 'pwrite -b 52k 0 52k' \
81                   -c 'truncate 100k' \
82                   -c 'pread -b 200k 0 200k' \
83                   $testfile | _filter_io
84         $XFS_IO_PROG -c 'bmap -vp' $testfile | _filter_bmap
85         echo ""
86
87         # on an odd byte boundary => 1 short of boundary 
88         rm -f $testfile
89         boundary_minus1=`expr 100 \* 1024 - 1`
90         echo "boundary_minus1 = $boundary_minus1"
91         $XFS_IO_PROG -f -d \
92                   -c 'pwrite -b 52k 0 52k' \
93                   -c "truncate $boundary_minus1" \
94                   -c 'pread -b 200k 0 200k' \
95                   $testfile | _filter_io
96         $XFS_IO_PROG -c 'bmap -vp' $testfile | _filter_bmap
97         echo ""
98
99         # on an odd byte boundary => 1 over boundary
100         rm -f $testfile
101         boundary_plus1=`expr 100 \* 1024 + 1`
102         echo "boundary_plus1 = $boundary_plus1"
103         $XFS_IO_PROG -f -d \
104                   -c 'pwrite -b 52k 0 52k' \
105                   -c "truncate $boundary_plus1" \
106                   -c 'pread -b 200k 0 200k' \
107                   $testfile | _filter_io
108         $XFS_IO_PROG -c 'bmap -vp' $testfile | _filter_bmap
109         echo ""
110 }
111
112 _test_eof_unwritten_extent()
113 {
114         # on a BB boundary
115         rm -f $testfile
116         $XFS_IO_PROG -f -d \
117                   -c 'resvsp 0 100k' \
118                   -c 'truncate 100k' \
119                   -c 'pwrite -b 52k 0 52k' \
120                   -c 'pread -b 200k 0 200k' \
121                   $testfile | _filter_io
122         $XFS_IO_PROG -c 'bmap -vp' $testfile | _filter_bmap
123         echo ""
124
125         # on an odd byte boundary => 1 short of boundary 
126         rm -f $testfile
127         boundary_minus1=`expr 100 \* 1024 - 1`
128         echo "boundary_minus1 = $boundary_minus1"
129         $XFS_IO_PROG -f -d \
130                   -c "resvsp 0 $boundary_minus1" \
131                   -c "truncate $boundary_minus1" \
132                   -c 'pwrite -b 52k 0 52k' \
133                   -c 'pread -b 200k 0 200k' \
134                 $testfile | _filter_io
135         $XFS_IO_PROG -c 'bmap -vp' $testfile | _filter_bmap
136         echo ""
137
138         # on an odd byte boundary => 1 over boundary
139         rm -f $testfile
140         boundary_plus1=`expr 100 \* 1024 + 1`
141         echo "boundary_plus1 = $boundary_plus1"
142         $XFS_IO_PROG -f -d \
143                   -c "resvsp 0 $boundary_plus1" \
144                   -c "truncate $boundary_plus1" \
145                   -c 'pwrite -b 52k 0 52k' \
146                   -c 'pread -b 200k 0 200k' \
147                   $testfile | _filter_io
148         $XFS_IO_PROG -c 'bmap -vp' $testfile | _filter_bmap
149         echo ""
150 }
151
152 _test_eof_hole
153 _test_eof_unwritten_extent
154
155 # success, all done
156 status=0
157 exit