xfstests: install shared libs with +x bits
[xfstests-dev.git] / 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 # creator
31 owner=tes@puffy.melbourne.sgi.com
32
33 seq=`basename $0`
34 echo "QA output created by $seq"
35
36 here=`pwd`
37 tmp=/tmp/$$
38 status=1        # failure is the default!
39 trap "_cleanup; exit \$status" 0 1 2 3 15
40
41 _cleanup()
42 {
43     cd /
44     rm -f $tmp.*
45 }
46
47 _filter_io()
48 {
49     tee -a $seq.full | sed 's/ops;.*/ops/'
50 }
51
52 #
53 #   1: [128..199]:      212280..212351    0 (212280..212351)    72 10000
54 #  
55 #  
56 _filter_bmap()
57 {
58     awk '$3 ~ /hole/ { print $1, $2, $3; next }
59          $7 ~ /10000/ { print $1, $2, "unwritten"; next }
60          {print $1, $2}' >> $seq.full
61 }
62
63
64 # get standard environment, filters and checks
65 . ./common.rc
66 . ./common.filter
67
68 # real QA test starts here
69
70 # Modify as appropriate.
71 _supported_fs xfs
72 _supported_os IRIX Linux
73
74 testfile=$TEST_DIR/file.$seq
75
76 _test_eof_hole()
77 {
78         # on a BB boundary
79         rm -f $testfile
80         $XFS_IO_PROG -f -d \
81                   -c 'pwrite -b 52k 0 52k' \
82                   -c 'truncate 100k' \
83                   -c 'pread -b 200k 0 200k' \
84                   $testfile | _filter_io
85         $XFS_IO_PROG -c 'bmap -vp' $testfile | _filter_bmap
86         echo ""
87
88         # on an odd byte boundary => 1 short of boundary 
89         rm -f $testfile
90         boundary_minus1=`expr 100 \* 1024 - 1`
91         echo "boundary_minus1 = $boundary_minus1"
92         $XFS_IO_PROG -f -d \
93                   -c 'pwrite -b 52k 0 52k' \
94                   -c "truncate $boundary_minus1" \
95                   -c 'pread -b 200k 0 200k' \
96                   $testfile | _filter_io
97         $XFS_IO_PROG -c 'bmap -vp' $testfile | _filter_bmap
98         echo ""
99
100         # on an odd byte boundary => 1 over boundary
101         rm -f $testfile
102         boundary_plus1=`expr 100 \* 1024 + 1`
103         echo "boundary_plus1 = $boundary_plus1"
104         $XFS_IO_PROG -f -d \
105                   -c 'pwrite -b 52k 0 52k' \
106                   -c "truncate $boundary_plus1" \
107                   -c 'pread -b 200k 0 200k' \
108                   $testfile | _filter_io
109         $XFS_IO_PROG -c 'bmap -vp' $testfile | _filter_bmap
110         echo ""
111 }
112
113 _test_eof_unwritten_extent()
114 {
115         # on a BB boundary
116         rm -f $testfile
117         $XFS_IO_PROG -f -d \
118                   -c 'resvsp 0 100k' \
119                   -c 'truncate 100k' \
120                   -c 'pwrite -b 52k 0 52k' \
121                   -c 'pread -b 200k 0 200k' \
122                   $testfile | _filter_io
123         $XFS_IO_PROG -c 'bmap -vp' $testfile | _filter_bmap
124         echo ""
125
126         # on an odd byte boundary => 1 short of boundary 
127         rm -f $testfile
128         boundary_minus1=`expr 100 \* 1024 - 1`
129         echo "boundary_minus1 = $boundary_minus1"
130         $XFS_IO_PROG -f -d \
131                   -c "resvsp 0 $boundary_minus1" \
132                   -c "truncate $boundary_minus1" \
133                   -c 'pwrite -b 52k 0 52k' \
134                   -c 'pread -b 200k 0 200k' \
135                 $testfile | _filter_io
136         $XFS_IO_PROG -c 'bmap -vp' $testfile | _filter_bmap
137         echo ""
138
139         # on an odd byte boundary => 1 over boundary
140         rm -f $testfile
141         boundary_plus1=`expr 100 \* 1024 + 1`
142         echo "boundary_plus1 = $boundary_plus1"
143         $XFS_IO_PROG -f -d \
144                   -c "resvsp 0 $boundary_plus1" \
145                   -c "truncate $boundary_plus1" \
146                   -c 'pwrite -b 52k 0 52k' \
147                   -c 'pread -b 200k 0 200k' \
148                   $testfile | _filter_io
149         $XFS_IO_PROG -c 'bmap -vp' $testfile | _filter_bmap
150         echo ""
151 }
152
153 _test_eof_hole
154 _test_eof_unwritten_extent
155
156 # success, all done
157 status=0
158 exit