OSDN Git Service

Merge tag 'pull-halloween-omnibus-311023-2' of https://gitlab.com/stsquad/qemu into...
[qmiga/qemu.git] / tests / qemu-iotests / 146
1 #!/usr/bin/env bash
2 # group: quick
3 #
4 # Test VHD image format creator detection and override
5 #
6 # Copyright (C) 2016 Red Hat, Inc.
7 #
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
12 #
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
20 #
21
22 # creator
23 owner=codyprime@gmail.com
24
25 seq=`basename $0`
26 echo "QA output created by $seq"
27
28 status=1    # failure is the default!
29
30 _cleanup()
31 {
32     _cleanup_qemu
33     _cleanup_test_img
34 }
35 trap "_cleanup; exit \$status" 0 1 2 3 15
36
37 # get standard environment, filters and checks
38 . ./common.rc
39 . ./common.filter
40 . ./common.qemu
41
42 _supported_fmt vpc
43 _supported_proto file
44 _supported_os Linux
45
46
47 qemu_comm_method="monitor"
48 silent=
49
50 echo
51 echo === Testing VPC Autodetect ===
52 echo
53 _use_sample_img virtualpc-dynamic.vhd.bz2
54
55 $QEMU_IMG map --output=json --image-opts \
56     "driver=vpc,file.filename=$TEST_IMG" \
57     | _filter_qemu_img_map
58
59 echo
60 echo === Testing VPC with current_size force ===
61 echo
62
63 $QEMU_IMG map --output=json --image-opts \
64     "driver=vpc,force_size_calc=current_size,file.filename=$TEST_IMG" \
65     | _filter_qemu_img_map
66
67 echo
68 echo === Testing VPC with chs force ===
69 echo
70
71 $QEMU_IMG map --output=json --image-opts \
72     "driver=vpc,force_size_calc=chs,file.filename=$TEST_IMG" \
73     | _filter_qemu_img_map
74
75 _cleanup_test_img
76
77 echo
78 echo === Testing Hyper-V Autodetect ===
79 echo
80 _use_sample_img hyperv2012r2-dynamic.vhd.bz2
81
82 $QEMU_IMG map --output=json --image-opts \
83     "driver=vpc,file.filename=$TEST_IMG" \
84     | _filter_qemu_img_map
85
86 echo
87 echo === Testing Hyper-V with current_size force ===
88 echo
89
90 $QEMU_IMG map --output=json --image-opts \
91     "driver=vpc,force_size_calc=current_size,file.filename=$TEST_IMG" \
92     | _filter_qemu_img_map
93
94 echo
95 echo === Testing Hyper-V with chs force ===
96 echo
97
98 $QEMU_IMG map --output=json --image-opts \
99     "driver=vpc,force_size_calc=chs,file.filename=$TEST_IMG" \
100     | _filter_qemu_img_map
101
102 _cleanup_test_img
103
104 echo
105 echo === Testing d2v Autodetect ===
106 echo
107 _use_sample_img d2v-zerofilled.vhd.bz2
108
109 $QEMU_IMG map --output=json --image-opts \
110     "driver=vpc,file.filename=$TEST_IMG" \
111     | _filter_qemu_img_map
112
113 echo
114 echo === Testing d2v with current_size force ===
115 echo
116
117 $QEMU_IMG map --output=json --image-opts \
118     "driver=vpc,force_size_calc=current_size,file.filename=$TEST_IMG" \
119     | _filter_qemu_img_map
120
121 echo
122 echo === Testing d2v with chs force ===
123 echo
124
125 $QEMU_IMG map --output=json --image-opts \
126     "driver=vpc,force_size_calc=chs,file.filename=$TEST_IMG" \
127     | _filter_qemu_img_map
128
129 _cleanup_test_img
130
131 echo
132 echo === Testing Image create, default ===
133 echo
134
135 TEST_IMG="${TEST_DIR}/vpc-create-test.vpc"
136
137 _make_test_img 4G
138
139 echo
140 echo === Read created image, default opts ====
141 echo
142
143 $QEMU_IMG map --output=json --image-opts \
144     "driver=vpc,file.filename=$TEST_IMG" \
145     | _filter_qemu_img_map
146
147 echo
148 echo === Read created image, force_size_calc=chs ====
149 echo
150
151 $QEMU_IMG map --output=json --image-opts \
152     "driver=vpc,force_size_calc=chs,file.filename=$TEST_IMG" \
153     | _filter_qemu_img_map
154
155 echo
156 echo === Read created image, force_size_calc=current_size ====
157 echo
158
159 $QEMU_IMG map --output=json --image-opts \
160     "driver=vpc,force_size_calc=current_size,file.filename=$TEST_IMG" \
161     | _filter_qemu_img_map
162
163 echo
164 echo === Testing Image create, force_size ===
165 echo
166
167 _make_test_img -o force_size 4G
168
169 echo
170 echo === Read created image, default opts ====
171 echo
172
173 $QEMU_IMG map --output=json --image-opts \
174     "driver=vpc,file.filename=$TEST_IMG" \
175     | _filter_qemu_img_map
176
177 echo
178 echo === Read created image, force_size_calc=chs ====
179 echo
180
181 $QEMU_IMG map --output=json --image-opts \
182     "driver=vpc,force_size_calc=chs,file.filename=$TEST_IMG" \
183     | _filter_qemu_img_map
184
185 echo
186 echo === Read created image, force_size_calc=current_size ====
187 echo
188
189 $QEMU_IMG map --output=json --image-opts \
190     "driver=vpc,force_size_calc=current_size,file.filename=$TEST_IMG" \
191     | _filter_qemu_img_map
192
193 echo "*** done"
194 rm -f $seq.full
195 status=0