generic: add _require_odirect to generic/113 and generic/214
[xfstests-dev.git] / tests / generic / 130
1 #! /bin/bash
2 # FSQA Test No. 130
3 #
4 # xfs_io vector read/write and trunc tests. modified from cxfsqa tests
5 # - unixfile_basic_block_hole
6 # - unixfile_buffer_direct_coherency
7 # - unixfile_direct_rw
8 # - unixfile_eof_direct
9 # - unixfile_fsb_edge
10 # - unixfile_open_append
11 # - unixfile_open_trunc
12 # - unixfile_small_vector_async_rw
13 # - unixfile_small_vector_sync_rw
14 #
15 #-----------------------------------------------------------------------
16 # Copyright (c) 2006 Silicon Graphics, Inc.  All Rights Reserved.
17 #
18 # This program is free software; you can redistribute it and/or
19 # modify it under the terms of the GNU General Public License as
20 # published by the Free Software Foundation.
21 #
22 # This program is distributed in the hope that it would be useful,
23 # but WITHOUT ANY WARRANTY; without even the implied warranty of
24 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25 # GNU General Public License for more details.
26 #
27 # You should have received a copy of the GNU General Public License
28 # along with this program; if not, write the Free Software Foundation,
29 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
30 #
31 #-----------------------------------------------------------------------
32 #
33
34 seq=`basename $0`
35 seqres=$RESULT_DIR/$seq
36 echo "QA output created by $seq"
37
38 here=`pwd`
39 tmp=/tmp/$$
40 status=1    # failure is the default!
41 trap "exit \$status" 0 1 2 3 15
42
43 # get standard environment, filters and checks
44 . ./common/rc
45 . ./common/filter
46
47 # real QA test starts here
48 _supported_fs generic
49 _supported_os Linux IRIX
50
51 _require_scratch
52 _require_sparse_files
53 _require_odirect
54
55 _scratch_mkfs >/dev/null 2>&1
56 _scratch_mount
57
58 echo "End-of-file zeroing with direct I/O"
59 $XFS_IO_PROG -f -d -t -c "pwrite -S 0x63 0 65536" \
60     -c "truncate 1" \
61     -c "pwrite -S 0x41 65536 65536" \
62     -c "pread -v 0 131072" \
63     $SCRATCH_MNT/eof-zeroing_direct | _filter_xfs_io_unique
64
65 echo
66 echo "Basic Block Hole test"
67 $XFS_IO_PROG -f -t -c "truncate 8192" \
68     -c "pread -v 5000 3000" \
69     $SCRATCH_MNT/blackhole | _filter_xfs_io_unique
70
71 echo
72 echo "Test buffered and direct IO coherency"
73 $XFS_IO_PROG -f -t -c "pwrite -S 0x41 8000 1000" \
74     -c "pwrite -S 0x57 4000 1000" \
75     $SCRATCH_MNT/buff_direct_coherency | _filter_xfs_io_unique
76
77 $XFS_IO_PROG -d -c "pwrite -S 0x78 20480 4096"\
78     -c "pwrite -S 0x79 4096 4096"\
79     $SCRATCH_MNT/buff_direct_coherency | _filter_xfs_io_unique
80
81 $XFS_IO_PROG -c "pread -v 0 9000"\
82     $SCRATCH_MNT/buff_direct_coherency | _filter_xfs_io_unique
83
84 echo
85 echo "Test direct read and write"
86 $XFS_IO_PROG -f -d -t -c "pwrite -S 0x78 0 65536"\
87     -c "pread -v 0 65536"\
88     -c "pwrite -S 0x46 65536 6553600"\
89     -c "pread -v 0 6619136"\
90     $SCRATCH_MNT/direct_io | _filter_xfs_io_unique
91
92 $XFS_IO_PROG -d -c "pread -v 0 6619136"\
93     $SCRATCH_MNT/direct_io | _filter_xfs_io_unique
94
95 $XFS_IO_PROG -f -d -t -c "pwrite -S 0x61 0 65536"\
96     -c "pread -v 0 65536"\
97     -c "pwrite -S 0x62 65536 131072"\
98     -c "pread -v 0 131072"\
99     $SCRATCH_MNT/async_direct_io | _filter_xfs_io_unique
100
101 $XFS_IO_PROG -d -c "pread -v 0 131072"\
102     $SCRATCH_MNT/async_direct_io | _filter_xfs_io_unique
103
104 echo
105 echo "FSB Edge test"
106 $XFS_IO_PROG -f -t -c "truncate 131072"\
107     -c "pwrite -S 0x5F 0 131072"\
108     -c "truncate 0"\
109     -c "truncate 131072"\
110     -c "pwrite -S 0x61 65535 2"\
111     -c "pread -v 0 131072"\
112     $SCRATCH_MNT/fsb_edge_test | _filter_xfs_io_unique
113
114 echo
115 echo "Open Trunk test (O_TRUNC)"
116 for n in 0 1 2 3 4
117 do
118     $XFS_IO_PROG -f -t -c "pread -v 0 100" $SCRATCH_MNT/$n | _filter_xfs_io_unique
119
120     echo "Test" > $SCRATCH_MNT/$n
121     $XFS_IO_PROG -f -t -c "pread -v 0 100" $SCRATCH_MNT/$n | _filter_xfs_io_unique
122     cat $SCRATCH_MNT/$n
123 done
124 echo "DONE"
125
126 echo
127 echo "Append test"
128 echo "append to me" > $SCRATCH_MNT/append
129 $XFS_IO_PROG -a -c "pwrite -S 0x61 0 10" \
130     -c "pread -v 0 24"\
131     $SCRATCH_MNT/append | _filter_xfs_io_unique
132
133 echo
134 echo "Small Vector Async"
135 echo "abcdefghijklmnopqrstuvwxyz" > $SCRATCH_MNT/small_vector_async
136 $XFS_IO_PROG -f -c "pread -v 0 1"\
137     -c "pread -v 1 1"\
138     -c "pread -v 2 1"\
139     -c "pread -v 3 1"\
140     -c "pread -v 4 1"\
141     -c "pread -v 5 1"\
142     -c "pread -v 6 1"\
143     -c "pread -v 7 1"\
144     -c "pread -v 8 1"\
145     -c "pread -v 9 1"\
146     -c "pread -v 10 1"\
147     -c "pread -v 11 1"\
148     -c "pread -v 12 1"\
149     -c "pread -v 13 13"\
150     -c "pwrite -S 0x61 4090 1"\
151     -c "pwrite -S 0x62 4091 1"\
152     -c "pwrite -S 0x63 4092 1"\
153     -c "pwrite -S 0x64 4093 1"\
154     -c "pwrite -S 0x65 4094 1"\
155     -c "pwrite -S 0x66 4095 1"\
156     -c "pwrite -S 0x67 4096 1"\
157     -c "pwrite -S 0x68 4097 1"\
158     -c "pwrite -S 0x69 4098 1"\
159     -c "pwrite -S 0x6A 4099 1"\
160     -c "pwrite -S 0x6B 4100 1"\
161     -c "pwrite -S 0x6C 4101 1"\
162     -c "pwrite -S 0x6D 4102 1"\
163     -c "pwrite -S 0x6E 4103 1"\
164     -c "pwrite -S 0x6F 4104 1"\
165     -c "pwrite -S 0x70 4105 1"\
166     -c "pread -v 4090 4"\
167     -c "pread -v 4094 4"\
168     -c "pread -v 4098 4"\
169     -c "pread -v 4102 4"\
170     -c "pwrite -S 0x61 10000000000 1"\
171     -c "pwrite -S 0x62 10000000001 1"\
172     -c "pwrite -S 0x63 10000000002 1"\
173     -c "pwrite -S 0x64 10000000003 1"\
174     -c "pwrite -S 0x65 10000000004 1"\
175     -c "pwrite -S 0x66 10000000005 1"\
176     -c "pwrite -S 0x67 10000000006 1"\
177     -c "pwrite -S 0x68 10000000007 1"\
178     -c "pwrite -S 0x69 10000000008 1"\
179     -c "pwrite -S 0x6A 10000000009 1"\
180     -c "pwrite -S 0x6B 10000000010 1"\
181     -c "pwrite -S 0x6C 10000000011 1"\
182     -c "pwrite -S 0x6D 10000000012 1"\
183     -c "pwrite -S 0x6E 10000000013 1"\
184     -c "pwrite -S 0x6F 10000000014 1"\
185     -c "pwrite -S 0x70 10000000015 1"\
186     -c "pread -v 10000000000 4"\
187     -c "pread -v 10000000004 4"\
188     -c "pread -v 10000000008 4"\
189     -c "pread -v 10000000012 4"\
190     $SCRATCH_MNT/small_vector_async | _filter_xfs_io_unique
191
192 echo
193 echo "Small Vector Sync"
194 echo "abcdefghijklmnopqrstuvwxyz" > $SCRATCH_MNT/small_vector_async
195 $XFS_IO_PROG -f -s -c "pread -v 0 1"\
196     -c "pread -v 1 1"\
197     -c "pread -v 2 1"\
198     -c "pread -v 3 1"\
199     -c "pread -v 4 1"\
200     -c "pread -v 5 1"\
201     -c "pread -v 6 1"\
202     -c "pread -v 7 1"\
203     -c "pread -v 8 1"\
204     -c "pread -v 9 1"\
205     -c "pread -v 10 1"\
206     -c "pread -v 11 1"\
207     -c "pread -v 12 1"\
208     -c "pread -v 13 13"\
209     -c "pwrite -S 0x61 4090 1"\
210     -c "pwrite -S 0x62 4091 1"\
211     -c "pwrite -S 0x63 4092 1"\
212     -c "pwrite -S 0x64 4093 1"\
213     -c "pwrite -S 0x65 4094 1"\
214     -c "pwrite -S 0x66 4095 1"\
215     -c "pwrite -S 0x67 4096 1"\
216     -c "pwrite -S 0x68 4097 1"\
217     -c "pwrite -S 0x69 4098 1"\
218     -c "pwrite -S 0x6A 4099 1"\
219     -c "pwrite -S 0x6B 4100 1"\
220     -c "pwrite -S 0x6C 4101 1"\
221     -c "pwrite -S 0x6D 4102 1"\
222     -c "pwrite -S 0x6E 4103 1"\
223     -c "pwrite -S 0x6F 4104 1"\
224     -c "pwrite -S 0x70 4105 1"\
225     -c "pread -v 4090 4"\
226     -c "pread -v 4094 4"\
227     -c "pread -v 4098 4"\
228     -c "pread -v 4102 4"\
229     -c "pwrite -S 0x61 10000000000 1"\
230     -c "pwrite -S 0x62 10000000001 1"\
231     -c "pwrite -S 0x63 10000000002 1"\
232     -c "pwrite -S 0x64 10000000003 1"\
233     -c "pwrite -S 0x65 10000000004 1"\
234     -c "pwrite -S 0x66 10000000005 1"\
235     -c "pwrite -S 0x67 10000000006 1"\
236     -c "pwrite -S 0x68 10000000007 1"\
237     -c "pwrite -S 0x69 10000000008 1"\
238     -c "pwrite -S 0x6A 10000000009 1"\
239     -c "pwrite -S 0x6B 10000000010 1"\
240     -c "pwrite -S 0x6C 10000000011 1"\
241     -c "pwrite -S 0x6D 10000000012 1"\
242     -c "pwrite -S 0x6E 10000000013 1"\
243     -c "pwrite -S 0x6F 10000000014 1"\
244     -c "pwrite -S 0x70 10000000015 1"\
245     -c "pread -v 10000000000 4"\
246     -c "pread -v 10000000004 4"\
247     -c "pread -v 10000000008 4"\
248     -c "pread -v 10000000012 4"\
249     $SCRATCH_MNT/small_vector_async | _filter_xfs_io_unique
250
251 status=0
252 exit