root / tests / qemu-iotests / 077 @ 9a05feab
History | View | Annotate | Download (5.7 kB)
1 | 9e1cb96d | Kevin Wolf | #!/bin/bash |
---|---|---|---|
2 | 9e1cb96d | Kevin Wolf | # |
3 | 9e1cb96d | Kevin Wolf | # Test concurrent pread/pwrite |
4 | 9e1cb96d | Kevin Wolf | # |
5 | 9e1cb96d | Kevin Wolf | # Copyright (C) 2014 Red Hat, Inc. |
6 | 9e1cb96d | Kevin Wolf | # |
7 | 9e1cb96d | Kevin Wolf | # This program is free software; you can redistribute it and/or modify |
8 | 9e1cb96d | Kevin Wolf | # it under the terms of the GNU General Public License as published by |
9 | 9e1cb96d | Kevin Wolf | # the Free Software Foundation; either version 2 of the License, or |
10 | 9e1cb96d | Kevin Wolf | # (at your option) any later version. |
11 | 9e1cb96d | Kevin Wolf | # |
12 | 9e1cb96d | Kevin Wolf | # This program is distributed in the hope that it will be useful, |
13 | 9e1cb96d | Kevin Wolf | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | 9e1cb96d | Kevin Wolf | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | 9e1cb96d | Kevin Wolf | # GNU General Public License for more details. |
16 | 9e1cb96d | Kevin Wolf | # |
17 | 9e1cb96d | Kevin Wolf | # You should have received a copy of the GNU General Public License |
18 | 9e1cb96d | Kevin Wolf | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 | 9e1cb96d | Kevin Wolf | # |
20 | 9e1cb96d | Kevin Wolf | |
21 | 9e1cb96d | Kevin Wolf | # creator |
22 | 9e1cb96d | Kevin Wolf | owner=kwolf@redhat.com |
23 | 9e1cb96d | Kevin Wolf | |
24 | 9e1cb96d | Kevin Wolf | seq=`basename $0` |
25 | 9e1cb96d | Kevin Wolf | echo "QA output created by $seq" |
26 | 9e1cb96d | Kevin Wolf | |
27 | 9e1cb96d | Kevin Wolf | here=`pwd` |
28 | 9e1cb96d | Kevin Wolf | tmp=/tmp/$$ |
29 | 9e1cb96d | Kevin Wolf | status=1 # failure is the default! |
30 | 9e1cb96d | Kevin Wolf | |
31 | 9e1cb96d | Kevin Wolf | _cleanup() |
32 | 9e1cb96d | Kevin Wolf | { |
33 | 9e1cb96d | Kevin Wolf | _cleanup_test_img |
34 | 9e1cb96d | Kevin Wolf | } |
35 | 9e1cb96d | Kevin Wolf | trap "_cleanup; exit \$status" 0 1 2 3 15 |
36 | 9e1cb96d | Kevin Wolf | |
37 | 9e1cb96d | Kevin Wolf | # get standard environment, filters and checks |
38 | 9e1cb96d | Kevin Wolf | . ./common.rc |
39 | 9e1cb96d | Kevin Wolf | . ./common.filter |
40 | 9e1cb96d | Kevin Wolf | |
41 | f5106206 | Kevin Wolf | _supported_fmt raw |
42 | 9e1cb96d | Kevin Wolf | _supported_proto generic |
43 | 9e1cb96d | Kevin Wolf | _supported_os Linux |
44 | 9e1cb96d | Kevin Wolf | |
45 | 9e1cb96d | Kevin Wolf | CLUSTER_SIZE=4k |
46 | 9e1cb96d | Kevin Wolf | size=128M |
47 | 9e1cb96d | Kevin Wolf | |
48 | 9e1cb96d | Kevin Wolf | _make_test_img $size |
49 | 9e1cb96d | Kevin Wolf | |
50 | 9e1cb96d | Kevin Wolf | echo |
51 | 9e1cb96d | Kevin Wolf | echo "== Some concurrent requests involving RMW ==" |
52 | 9e1cb96d | Kevin Wolf | |
53 | 9e1cb96d | Kevin Wolf | function test_io() |
54 | 9e1cb96d | Kevin Wolf | { |
55 | 9e1cb96d | Kevin Wolf | echo "open -o file.align=4k blkdebug::$TEST_IMG" |
56 | 9e1cb96d | Kevin Wolf | # A simple RMW request |
57 | 9e1cb96d | Kevin Wolf | cat <<EOF |
58 | 9e1cb96d | Kevin Wolf | aio_write -P 10 0x200 0x200 |
59 | 9e1cb96d | Kevin Wolf | aio_flush |
60 | 9e1cb96d | Kevin Wolf | EOF |
61 | 9e1cb96d | Kevin Wolf | |
62 | 9e1cb96d | Kevin Wolf | # Sequential RMW requests on the same physical sector |
63 | 9e1cb96d | Kevin Wolf | off=0x1000 |
64 | 9e1cb96d | Kevin Wolf | for ev in "head" "after_head" "tail" "after_tail"; do |
65 | 9e1cb96d | Kevin Wolf | cat <<EOF |
66 | 9e1cb96d | Kevin Wolf | break pwritev_rmw.$ev A |
67 | 9e1cb96d | Kevin Wolf | aio_write -P 10 $((off + 0x200)) 0x200 |
68 | 9e1cb96d | Kevin Wolf | wait_break A |
69 | 9e1cb96d | Kevin Wolf | aio_write -P 11 $((off + 0x400)) 0x200 |
70 | 9e1cb96d | Kevin Wolf | sleep 100 |
71 | 9e1cb96d | Kevin Wolf | resume A |
72 | 9e1cb96d | Kevin Wolf | aio_flush |
73 | 9e1cb96d | Kevin Wolf | EOF |
74 | 9e1cb96d | Kevin Wolf | off=$((off + 0x1000)) |
75 | 9e1cb96d | Kevin Wolf | done |
76 | 9e1cb96d | Kevin Wolf | |
77 | 9e1cb96d | Kevin Wolf | # Chained dependencies |
78 | 9e1cb96d | Kevin Wolf | cat <<EOF |
79 | 9e1cb96d | Kevin Wolf | break pwritev_rmw.after_tail A |
80 | 9e1cb96d | Kevin Wolf | aio_write -P 10 0x5000 0x200 |
81 | 9e1cb96d | Kevin Wolf | wait_break A |
82 | 9e1cb96d | Kevin Wolf | aio_write -P 11 0x5200 0x200 |
83 | 9e1cb96d | Kevin Wolf | aio_write -P 12 0x5400 0x200 |
84 | 9e1cb96d | Kevin Wolf | aio_write -P 13 0x5600 0x200 |
85 | 9e1cb96d | Kevin Wolf | aio_write -P 14 0x5800 0x200 |
86 | 9e1cb96d | Kevin Wolf | aio_write -P 15 0x5a00 0x200 |
87 | 9e1cb96d | Kevin Wolf | aio_write -P 16 0x5c00 0x200 |
88 | 9e1cb96d | Kevin Wolf | aio_write -P 17 0x5e00 0x200 |
89 | 9e1cb96d | Kevin Wolf | sleep 100 |
90 | 9e1cb96d | Kevin Wolf | resume A |
91 | 9e1cb96d | Kevin Wolf | aio_flush |
92 | 9e1cb96d | Kevin Wolf | EOF |
93 | 9e1cb96d | Kevin Wolf | |
94 | 9e1cb96d | Kevin Wolf | # Overlapping multiple requests |
95 | 9e1cb96d | Kevin Wolf | cat <<EOF |
96 | 9e1cb96d | Kevin Wolf | break pwritev_rmw.after_tail A |
97 | 9e1cb96d | Kevin Wolf | aio_write -P 10 0x6000 0x200 |
98 | 9e1cb96d | Kevin Wolf | wait_break A |
99 | 9e1cb96d | Kevin Wolf | break pwritev_rmw.after_head B |
100 | 9e1cb96d | Kevin Wolf | aio_write -P 10 0x7e00 0x200 |
101 | 9e1cb96d | Kevin Wolf | wait_break B |
102 | 9e1cb96d | Kevin Wolf | aio_write -P 11 0x6800 0x1000 |
103 | 9e1cb96d | Kevin Wolf | resume A |
104 | 9e1cb96d | Kevin Wolf | sleep 100 |
105 | 9e1cb96d | Kevin Wolf | resume B |
106 | 9e1cb96d | Kevin Wolf | aio_flush |
107 | 9e1cb96d | Kevin Wolf | EOF |
108 | 9e1cb96d | Kevin Wolf | |
109 | 9e1cb96d | Kevin Wolf | cat <<EOF |
110 | 9e1cb96d | Kevin Wolf | break pwritev_rmw.after_tail A |
111 | 9e1cb96d | Kevin Wolf | aio_write -P 10 0x8000 0x200 |
112 | 9e1cb96d | Kevin Wolf | wait_break A |
113 | 9e1cb96d | Kevin Wolf | break pwritev_rmw.after_head B |
114 | 9e1cb96d | Kevin Wolf | aio_write -P 10 0x9e00 0x200 |
115 | 9e1cb96d | Kevin Wolf | wait_break B |
116 | 9e1cb96d | Kevin Wolf | aio_write -P 11 0x8800 0x1000 |
117 | 9e1cb96d | Kevin Wolf | resume B |
118 | 9e1cb96d | Kevin Wolf | sleep 100 |
119 | 9e1cb96d | Kevin Wolf | resume A |
120 | 9e1cb96d | Kevin Wolf | aio_flush |
121 | 9e1cb96d | Kevin Wolf | EOF |
122 | 9e1cb96d | Kevin Wolf | |
123 | 9e1cb96d | Kevin Wolf | cat <<EOF |
124 | 9e1cb96d | Kevin Wolf | break pwritev_rmw.after_tail A |
125 | 9e1cb96d | Kevin Wolf | aio_write -P 10 0xa000 0x200 |
126 | 9e1cb96d | Kevin Wolf | wait_break A |
127 | 9e1cb96d | Kevin Wolf | aio_write -P 11 0xa800 0x1000 |
128 | 9e1cb96d | Kevin Wolf | break pwritev_rmw.after_head B |
129 | 9e1cb96d | Kevin Wolf | aio_write -P 10 0xbe00 0x200 |
130 | 9e1cb96d | Kevin Wolf | wait_break B |
131 | 9e1cb96d | Kevin Wolf | resume A |
132 | 9e1cb96d | Kevin Wolf | sleep 100 |
133 | 9e1cb96d | Kevin Wolf | resume B |
134 | 9e1cb96d | Kevin Wolf | aio_flush |
135 | 9e1cb96d | Kevin Wolf | EOF |
136 | 9e1cb96d | Kevin Wolf | |
137 | 9e1cb96d | Kevin Wolf | cat <<EOF |
138 | 9e1cb96d | Kevin Wolf | break pwritev_rmw.after_tail A |
139 | 9e1cb96d | Kevin Wolf | aio_write -P 10 0xc000 0x200 |
140 | 9e1cb96d | Kevin Wolf | wait_break A |
141 | 9e1cb96d | Kevin Wolf | aio_write -P 11 0xc800 0x1000 |
142 | 9e1cb96d | Kevin Wolf | break pwritev_rmw.after_head B |
143 | 9e1cb96d | Kevin Wolf | aio_write -P 10 0xde00 0x200 |
144 | 9e1cb96d | Kevin Wolf | wait_break B |
145 | 9e1cb96d | Kevin Wolf | resume B |
146 | 9e1cb96d | Kevin Wolf | sleep 100 |
147 | 9e1cb96d | Kevin Wolf | resume A |
148 | 9e1cb96d | Kevin Wolf | aio_flush |
149 | 9e1cb96d | Kevin Wolf | EOF |
150 | 9e1cb96d | Kevin Wolf | |
151 | 9e1cb96d | Kevin Wolf | # Only RMW for the tail part |
152 | 9e1cb96d | Kevin Wolf | cat <<EOF |
153 | 9e1cb96d | Kevin Wolf | break pwritev_rmw.after_tail A |
154 | 9e1cb96d | Kevin Wolf | aio_write -P 10 0xe000 0x1800 |
155 | 9e1cb96d | Kevin Wolf | wait_break A |
156 | 9e1cb96d | Kevin Wolf | aio_write -P 11 0xf000 0xc00 |
157 | 9e1cb96d | Kevin Wolf | sleep 100 |
158 | 9e1cb96d | Kevin Wolf | resume A |
159 | 9e1cb96d | Kevin Wolf | aio_flush |
160 | 9e1cb96d | Kevin Wolf | EOF |
161 | 9e1cb96d | Kevin Wolf | |
162 | 9e1cb96d | Kevin Wolf | cat <<EOF |
163 | 9e1cb96d | Kevin Wolf | break pwritev A |
164 | 9e1cb96d | Kevin Wolf | aio_write -P 10 0x10000 0x800 |
165 | 9e1cb96d | Kevin Wolf | wait_break A |
166 | 9e1cb96d | Kevin Wolf | break pwritev_rmw.after_tail B |
167 | 9e1cb96d | Kevin Wolf | aio_write -P 11 0x10000 0x400 |
168 | 9e1cb96d | Kevin Wolf | break pwritev_done C |
169 | 9e1cb96d | Kevin Wolf | resume A |
170 | 9e1cb96d | Kevin Wolf | wait_break C |
171 | 9e1cb96d | Kevin Wolf | resume C |
172 | 9e1cb96d | Kevin Wolf | sleep 100 |
173 | 9e1cb96d | Kevin Wolf | wait_break B |
174 | 9e1cb96d | Kevin Wolf | resume B |
175 | 9e1cb96d | Kevin Wolf | aio_flush |
176 | 9e1cb96d | Kevin Wolf | EOF |
177 | 9e1cb96d | Kevin Wolf | |
178 | 9e1cb96d | Kevin Wolf | cat <<EOF |
179 | 9e1cb96d | Kevin Wolf | break pwritev A |
180 | 9e1cb96d | Kevin Wolf | aio_write -P 10 0x11000 0x800 |
181 | 9e1cb96d | Kevin Wolf | wait_break A |
182 | 9e1cb96d | Kevin Wolf | aio_write -P 11 0x11000 0x1000 |
183 | 9e1cb96d | Kevin Wolf | sleep 100 |
184 | 9e1cb96d | Kevin Wolf | resume A |
185 | 9e1cb96d | Kevin Wolf | aio_flush |
186 | 9e1cb96d | Kevin Wolf | EOF |
187 | 9e1cb96d | Kevin Wolf | } |
188 | 9e1cb96d | Kevin Wolf | |
189 | 9e1cb96d | Kevin Wolf | test_io | $QEMU_IO | _filter_qemu_io | \ |
190 | 9e1cb96d | Kevin Wolf | sed -e 's,[0-9/]* bytes at offset [0-9]*,XXX/XXX bytes at offset XXX,g' \ |
191 | 9e1cb96d | Kevin Wolf | -e 's/^[0-9]* \(bytes\|KiB\)/XXX bytes/' \ |
192 | 9e1cb96d | Kevin Wolf | -e '/Suspended/d' |
193 | 9e1cb96d | Kevin Wolf | |
194 | 9e1cb96d | Kevin Wolf | echo |
195 | 9e1cb96d | Kevin Wolf | echo "== Verify image content ==" |
196 | 9e1cb96d | Kevin Wolf | |
197 | 9e1cb96d | Kevin Wolf | function verify_io() |
198 | 9e1cb96d | Kevin Wolf | { |
199 | 9e1cb96d | Kevin Wolf | # A simple RMW request |
200 | 9e1cb96d | Kevin Wolf | echo read -P 0 0 0x200 |
201 | 9e1cb96d | Kevin Wolf | echo read -P 10 0x200 0x200 |
202 | 9e1cb96d | Kevin Wolf | echo read -P 0 0x400 0xc00 |
203 | 9e1cb96d | Kevin Wolf | |
204 | 9e1cb96d | Kevin Wolf | # Sequential RMW requests on the same physical sector |
205 | 9e1cb96d | Kevin Wolf | echo read -P 0 0x1000 0x200 |
206 | 9e1cb96d | Kevin Wolf | echo read -P 10 0x1200 0x200 |
207 | 9e1cb96d | Kevin Wolf | echo read -P 11 0x1400 0x200 |
208 | 9e1cb96d | Kevin Wolf | echo read -P 0 0x1600 0xa00 |
209 | 9e1cb96d | Kevin Wolf | |
210 | 9e1cb96d | Kevin Wolf | echo read -P 0 0x2000 0x200 |
211 | 9e1cb96d | Kevin Wolf | echo read -P 10 0x2200 0x200 |
212 | 9e1cb96d | Kevin Wolf | echo read -P 11 0x2400 0x200 |
213 | 9e1cb96d | Kevin Wolf | echo read -P 0 0x2600 0xa00 |
214 | 9e1cb96d | Kevin Wolf | |
215 | 9e1cb96d | Kevin Wolf | echo read -P 0 0x3000 0x200 |
216 | 9e1cb96d | Kevin Wolf | echo read -P 10 0x3200 0x200 |
217 | 9e1cb96d | Kevin Wolf | echo read -P 11 0x3400 0x200 |
218 | 9e1cb96d | Kevin Wolf | echo read -P 0 0x3600 0xa00 |
219 | 9e1cb96d | Kevin Wolf | |
220 | 9e1cb96d | Kevin Wolf | echo read -P 0 0x4000 0x200 |
221 | 9e1cb96d | Kevin Wolf | echo read -P 10 0x4200 0x200 |
222 | 9e1cb96d | Kevin Wolf | echo read -P 11 0x4400 0x200 |
223 | 9e1cb96d | Kevin Wolf | echo read -P 0 0x4600 0xa00 |
224 | 9e1cb96d | Kevin Wolf | |
225 | 9e1cb96d | Kevin Wolf | # Chained dependencies |
226 | 9e1cb96d | Kevin Wolf | echo read -P 10 0x5000 0x200 |
227 | 9e1cb96d | Kevin Wolf | echo read -P 11 0x5200 0x200 |
228 | 9e1cb96d | Kevin Wolf | echo read -P 12 0x5400 0x200 |
229 | 9e1cb96d | Kevin Wolf | echo read -P 13 0x5600 0x200 |
230 | 9e1cb96d | Kevin Wolf | echo read -P 14 0x5800 0x200 |
231 | 9e1cb96d | Kevin Wolf | echo read -P 15 0x5a00 0x200 |
232 | 9e1cb96d | Kevin Wolf | echo read -P 16 0x5c00 0x200 |
233 | 9e1cb96d | Kevin Wolf | echo read -P 17 0x5e00 0x200 |
234 | 9e1cb96d | Kevin Wolf | |
235 | 9e1cb96d | Kevin Wolf | # Overlapping multiple requests |
236 | 9e1cb96d | Kevin Wolf | echo read -P 10 0x6000 0x200 |
237 | 9e1cb96d | Kevin Wolf | echo read -P 0 0x6200 0x600 |
238 | 9e1cb96d | Kevin Wolf | echo read -P 11 0x6800 0x1000 |
239 | 9e1cb96d | Kevin Wolf | echo read -P 0 0x7800 0x600 |
240 | 9e1cb96d | Kevin Wolf | echo read -P 10 0x7e00 0x200 |
241 | 9e1cb96d | Kevin Wolf | |
242 | 9e1cb96d | Kevin Wolf | echo read -P 10 0x8000 0x200 |
243 | 9e1cb96d | Kevin Wolf | echo read -P 0 0x8200 0x600 |
244 | 9e1cb96d | Kevin Wolf | echo read -P 11 0x8800 0x1000 |
245 | 9e1cb96d | Kevin Wolf | echo read -P 0 0x9800 0x600 |
246 | 9e1cb96d | Kevin Wolf | echo read -P 10 0x9e00 0x200 |
247 | 9e1cb96d | Kevin Wolf | |
248 | 9e1cb96d | Kevin Wolf | echo read -P 10 0xa000 0x200 |
249 | 9e1cb96d | Kevin Wolf | echo read -P 0 0xa200 0x600 |
250 | 9e1cb96d | Kevin Wolf | echo read -P 11 0xa800 0x1000 |
251 | 9e1cb96d | Kevin Wolf | echo read -P 0 0xb800 0x600 |
252 | 9e1cb96d | Kevin Wolf | echo read -P 10 0xbe00 0x200 |
253 | 9e1cb96d | Kevin Wolf | |
254 | 9e1cb96d | Kevin Wolf | echo read -P 10 0xc000 0x200 |
255 | 9e1cb96d | Kevin Wolf | echo read -P 0 0xc200 0x600 |
256 | 9e1cb96d | Kevin Wolf | echo read -P 11 0xc800 0x1000 |
257 | 9e1cb96d | Kevin Wolf | echo read -P 0 0xd800 0x600 |
258 | 9e1cb96d | Kevin Wolf | echo read -P 10 0xde00 0x200 |
259 | 9e1cb96d | Kevin Wolf | |
260 | 9e1cb96d | Kevin Wolf | # Only RMW for the tail part |
261 | 9e1cb96d | Kevin Wolf | echo read -P 10 0xe000 0x1000 |
262 | 9e1cb96d | Kevin Wolf | echo read -P 11 0xf800 0x400 |
263 | 9e1cb96d | Kevin Wolf | echo read -P 0 0xfc00 0x400 |
264 | 9e1cb96d | Kevin Wolf | |
265 | 9e1cb96d | Kevin Wolf | echo read -P 11 0x10000 0x400 |
266 | 9e1cb96d | Kevin Wolf | echo read -P 10 0x10400 0x400 |
267 | 9e1cb96d | Kevin Wolf | |
268 | 9e1cb96d | Kevin Wolf | echo read -P 11 0x11800 0x800 |
269 | 9e1cb96d | Kevin Wolf | } |
270 | 9e1cb96d | Kevin Wolf | |
271 | 9e1cb96d | Kevin Wolf | verify_io | $QEMU_IO "$TEST_IMG" | _filter_qemu_io |
272 | 9e1cb96d | Kevin Wolf | |
273 | 9e1cb96d | Kevin Wolf | _check_test_img |
274 | 9e1cb96d | Kevin Wolf | |
275 | 9e1cb96d | Kevin Wolf | # success, all done |
276 | 9e1cb96d | Kevin Wolf | echo "*** done" |
277 | 9e1cb96d | Kevin Wolf | rm -f $seq.full |
278 | 9e1cb96d | Kevin Wolf | status=0 |