root / tests / qemu-iotests / 017 @ b3ce604e
History | View | Annotate | Download (2.4 kB)
1 | 908eaf68 | Stefan Hajnoczi | #!/bin/bash |
---|---|---|---|
2 | 2557d865 | Kevin Wolf | # |
3 | 2557d865 | Kevin Wolf | # Simple backing file reads |
4 | 2557d865 | Kevin Wolf | # |
5 | 2557d865 | Kevin Wolf | # Copyright (C) 2009 Red Hat, Inc. |
6 | 2557d865 | Kevin Wolf | # |
7 | 2557d865 | Kevin Wolf | # This program is free software; you can redistribute it and/or modify |
8 | 2557d865 | Kevin Wolf | # it under the terms of the GNU General Public License as published by |
9 | 2557d865 | Kevin Wolf | # the Free Software Foundation; either version 2 of the License, or |
10 | 2557d865 | Kevin Wolf | # (at your option) any later version. |
11 | 2557d865 | Kevin Wolf | # |
12 | 2557d865 | Kevin Wolf | # This program is distributed in the hope that it will be useful, |
13 | 2557d865 | Kevin Wolf | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | 2557d865 | Kevin Wolf | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | 2557d865 | Kevin Wolf | # GNU General Public License for more details. |
16 | 2557d865 | Kevin Wolf | # |
17 | 2557d865 | Kevin Wolf | # You should have received a copy of the GNU General Public License |
18 | e8c212d6 | Christoph Hellwig | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 | 2557d865 | Kevin Wolf | # |
20 | 2557d865 | Kevin Wolf | |
21 | 2557d865 | Kevin Wolf | # creator |
22 | 2557d865 | Kevin Wolf | owner=kwolf@redhat.com |
23 | 2557d865 | Kevin Wolf | |
24 | 2557d865 | Kevin Wolf | seq=`basename $0` |
25 | 2557d865 | Kevin Wolf | echo "QA output created by $seq" |
26 | 2557d865 | Kevin Wolf | |
27 | 2557d865 | Kevin Wolf | here=`pwd` |
28 | 2557d865 | Kevin Wolf | tmp=/tmp/$$ |
29 | 2557d865 | Kevin Wolf | status=1 # failure is the default! |
30 | 2557d865 | Kevin Wolf | |
31 | 2557d865 | Kevin Wolf | _cleanup() |
32 | 2557d865 | Kevin Wolf | { |
33 | 2557d865 | Kevin Wolf | _cleanup_test_img |
34 | 2557d865 | Kevin Wolf | } |
35 | 2557d865 | Kevin Wolf | trap "_cleanup; exit \$status" 0 1 2 3 15 |
36 | 2557d865 | Kevin Wolf | |
37 | 2557d865 | Kevin Wolf | # get standard environment, filters and checks |
38 | 2557d865 | Kevin Wolf | . ./common.rc |
39 | 2557d865 | Kevin Wolf | . ./common.filter |
40 | 2557d865 | Kevin Wolf | . ./common.pattern |
41 | 2557d865 | Kevin Wolf | |
42 | 2557d865 | Kevin Wolf | # Any format supporting backing files |
43 | f5a4bbd9 | Stefan Hajnoczi | _supported_fmt qcow qcow2 vmdk qed |
44 | 9cdfa1b3 | MORITA Kazutaka | _supported_proto generic |
45 | 2557d865 | Kevin Wolf | _supported_os Linux |
46 | 2557d865 | Kevin Wolf | |
47 | 2557d865 | Kevin Wolf | TEST_OFFSETS="0 4294967296" |
48 | 2557d865 | Kevin Wolf | |
49 | 2557d865 | Kevin Wolf | _make_test_img 6G |
50 | 2557d865 | Kevin Wolf | |
51 | 2557d865 | Kevin Wolf | echo "Filling base image" |
52 | 2557d865 | Kevin Wolf | echo |
53 | 2557d865 | Kevin Wolf | |
54 | 2557d865 | Kevin Wolf | for offset in $TEST_OFFSETS; do |
55 | 2557d865 | Kevin Wolf | # Some clusters with alternating backing file/image file reads |
56 | 2557d865 | Kevin Wolf | io writev $(( offset )) 512 1024 64 |
57 | 2557d865 | Kevin Wolf | |
58 | 2557d865 | Kevin Wolf | # Complete backing clusters |
59 | 2557d865 | Kevin Wolf | io writev $(( offset + 64 * 1024)) 65536 65536 1 |
60 | 2557d865 | Kevin Wolf | done |
61 | 2557d865 | Kevin Wolf | _check_test_img |
62 | 2557d865 | Kevin Wolf | |
63 | 2557d865 | Kevin Wolf | echo "Creating test image with backing file" |
64 | 2557d865 | Kevin Wolf | echo |
65 | 2557d865 | Kevin Wolf | |
66 | 2557d865 | Kevin Wolf | mv $TEST_IMG $TEST_IMG.base |
67 | 2557d865 | Kevin Wolf | _make_test_img -b $TEST_IMG.base 6G |
68 | 2557d865 | Kevin Wolf | |
69 | 2557d865 | Kevin Wolf | echo "Filling test image" |
70 | 2557d865 | Kevin Wolf | echo |
71 | 2557d865 | Kevin Wolf | |
72 | 2557d865 | Kevin Wolf | for offset in $TEST_OFFSETS; do |
73 | 2557d865 | Kevin Wolf | # Some clusters with alternating backing file/image file reads |
74 | 2557d865 | Kevin Wolf | io writev $(( offset + 512 )) 512 1024 64 |
75 | 2557d865 | Kevin Wolf | |
76 | 2557d865 | Kevin Wolf | # Complete test image clusters |
77 | 2557d865 | Kevin Wolf | io writev $(( offset + 64 * 1024 + 65536)) 65536 65536 1 |
78 | 2557d865 | Kevin Wolf | done |
79 | 2557d865 | Kevin Wolf | _check_test_img |
80 | 2557d865 | Kevin Wolf | |
81 | 2557d865 | Kevin Wolf | echo "Reading" |
82 | 2557d865 | Kevin Wolf | echo |
83 | 2557d865 | Kevin Wolf | |
84 | 2557d865 | Kevin Wolf | for offset in $TEST_OFFSETS; do |
85 | 2557d865 | Kevin Wolf | # Some clusters with alternating backing file/image file reads |
86 | 2557d865 | Kevin Wolf | io readv $(( offset )) 512 1024 64 |
87 | 2557d865 | Kevin Wolf | io readv $(( offset + 512 )) 512 1024 64 |
88 | 2557d865 | Kevin Wolf | |
89 | 2557d865 | Kevin Wolf | # Complete test image clusters |
90 | 2557d865 | Kevin Wolf | io readv $(( offset + 64 * 1024)) 65536 65536 1 |
91 | 2557d865 | Kevin Wolf | io readv $(( offset + 64 * 1024 + 65536)) 65536 65536 1 |
92 | 2557d865 | Kevin Wolf | |
93 | 2557d865 | Kevin Wolf | # Empty sectors |
94 | 2557d865 | Kevin Wolf | io_zero readv $(( offset + 64 * 1024 + 65536 * 4 )) 65536 65536 1 |
95 | 2557d865 | Kevin Wolf | done |
96 | 2557d865 | Kevin Wolf | _check_test_img |
97 | 2557d865 | Kevin Wolf | |
98 | 2557d865 | Kevin Wolf | # success, all done |
99 | 2557d865 | Kevin Wolf | echo "*** done" |
100 | 2557d865 | Kevin Wolf | rm -f $seq.full |
101 | 2557d865 | Kevin Wolf | status=0 |