xfstests: resolve compiler warnings
[xfstests-dev.git] / 165
1 #! /bin/bash
2 # FS QA Test No. 165
3 #
4 # Test out prealloc, direct writes and buffered read
5 # Some experimentation when looking at 
6 #   pv#962014 - DMF 3.7 reading incorrect data 
7 # Doesn't actually reproduce the problem but it tried to :-)
8 #
9 #-----------------------------------------------------------------------
10 # Copyright (c) 2007 Silicon Graphics, Inc.  All Rights Reserved.
11 #
12 # This program is free software; you can redistribute it and/or
13 # modify it under the terms of the GNU General Public License as
14 # published by the Free Software Foundation.
15 #
16 # This program is distributed in the hope that it would be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 # GNU General Public License for more details.
20 #
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write the Free Software Foundation,
23 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
24 #
25 #-----------------------------------------------------------------------
26 #
27 # creator
28 owner=tes@puffy.melbourne.sgi.com
29
30 seq=`basename $0`
31 echo "QA output created by $seq"
32
33 here=`pwd`
34 tmp=/tmp/$$
35 status=1        # failure is the default!
36 trap "_cleanup; exit \$status" 0 1 2 3 15
37
38 _cleanup()
39 {
40     cd /
41     rm -f $tmp.*
42 }
43
44 _filter_io()
45 {
46     tee -a $seq.full | _filter_xfs_io
47 }
48
49 #
50 # <    1: [8..79]:         6552..6623        0 (6552..6623)        72
51 # >    1: [8..79]:         202544..202615    0 (202544..202615)    72
52 #
53 #
54 _filter_bmap()
55 {
56     awk '$3 ~ /hole/ { print $1, $2, $3; next }
57          {print $1, $2}' >> $seq.full
58 }
59
60 # get standard environment, filters and checks
61 . ./common.rc
62 . ./common.filter
63
64 # real QA test starts here
65
66 # Modify as appropriate.
67 _supported_fs xfs
68 _supported_os IRIX Linux
69
70 # io tests 
71 testfile=$TEST_DIR/file.$seq
72 rm -f $testfile
73 rm -f $seq.full
74 len=4
75 end=`expr 10 \* $len`
76
77 # Other test...
78 #$XFS_IO_PROG -f -c "resvsp ${off}k ${end}k" $testfile
79
80 # write the initial file
81 $XFS_IO_PROG -f -c "pwrite 0  ${end}k" $testfile | _filter_io
82
83
84 off=0
85 while [ $off -le $end ]
86 do
87         offset=${off}k
88         length=${len}k
89
90         $XFS_IO_PROG -c "unresvsp $offset $length" -c "bmap -vp" $testfile | _filter_bmap
91
92         let off=$off+$len # skip over 1
93         let off=$off+$len
94 done
95
96 off=0
97 while [ $off -le $end ]
98 do
99         offset=${off}k
100         length=${len}k
101         bufsize=${len}k
102         echo ""
103         echo "*** offset = $offset ***"
104         echo ""
105
106         # prealloc and write
107         $XFS_IO_PROG -d -c "resvsp $offset $length" -c "pwrite -b $bufsize $offset $length" $testfile | _filter_io
108
109         # Other tests...
110         #$XFS_IO_PROG -c "resvsp $offset $length" $testfile
111         #xfs_bmap -v -p $testfile
112         #$XFS_IO_PROG -d -c "pwrite -b $bufsize $offset $length" $testfile
113         #xfs_bmap -v -p $testfile
114
115         $XFS_IO_PROG -r -c "pread -v -b $bufsize $offset $length" $testfile >$tmp.$off &
116
117         # Other tests...
118         #$XFS_IO_PROG -r -c "pread -v -b $bufsize $offset $length" $testfile
119         #sleep 5
120
121         let off=$off+$len # skip over 1
122         let off=$off+$len
123 done
124
125 wait
126 cat $tmp.* | _filter_io
127
128 # success, all done
129 status=0
130 exit