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