master
text 196 lines 4.36 KB
Raw
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 _require_hmp
46
47
48 qemu_comm_method="monitor"
49 silent=
50
51 echo
52 echo === Testing VPC Autodetect ===
53 echo
54 _use_sample_img virtualpc-dynamic.vhd.bz2
55
56 $QEMU_IMG map --output=json --image-opts \
57 "driver=vpc,file.filename=$TEST_IMG" \
58 | _filter_qemu_img_map
59
60 echo
61 echo === Testing VPC with current_size force ===
62 echo
63
64 $QEMU_IMG map --output=json --image-opts \
65 "driver=vpc,force_size_calc=current_size,file.filename=$TEST_IMG" \
66 | _filter_qemu_img_map
67
68 echo
69 echo === Testing VPC with chs force ===
70 echo
71
72 $QEMU_IMG map --output=json --image-opts \
73 "driver=vpc,force_size_calc=chs,file.filename=$TEST_IMG" \
74 | _filter_qemu_img_map
75
76 _cleanup_test_img
77
78 echo
79 echo === Testing Hyper-V Autodetect ===
80 echo
81 _use_sample_img hyperv2012r2-dynamic.vhd.bz2
82
83 $QEMU_IMG map --output=json --image-opts \
84 "driver=vpc,file.filename=$TEST_IMG" \
85 | _filter_qemu_img_map
86
87 echo
88 echo === Testing Hyper-V with current_size force ===
89 echo
90
91 $QEMU_IMG map --output=json --image-opts \
92 "driver=vpc,force_size_calc=current_size,file.filename=$TEST_IMG" \
93 | _filter_qemu_img_map
94
95 echo
96 echo === Testing Hyper-V with chs force ===
97 echo
98
99 $QEMU_IMG map --output=json --image-opts \
100 "driver=vpc,force_size_calc=chs,file.filename=$TEST_IMG" \
101 | _filter_qemu_img_map
102
103 _cleanup_test_img
104
105 echo
106 echo === Testing d2v Autodetect ===
107 echo
108 _use_sample_img d2v-zerofilled.vhd.bz2
109
110 $QEMU_IMG map --output=json --image-opts \
111 "driver=vpc,file.filename=$TEST_IMG" \
112 | _filter_qemu_img_map
113
114 echo
115 echo === Testing d2v with current_size force ===
116 echo
117
118 $QEMU_IMG map --output=json --image-opts \
119 "driver=vpc,force_size_calc=current_size,file.filename=$TEST_IMG" \
120 | _filter_qemu_img_map
121
122 echo
123 echo === Testing d2v with chs force ===
124 echo
125
126 $QEMU_IMG map --output=json --image-opts \
127 "driver=vpc,force_size_calc=chs,file.filename=$TEST_IMG" \
128 | _filter_qemu_img_map
129
130 _cleanup_test_img
131
132 echo
133 echo === Testing Image create, default ===
134 echo
135
136 TEST_IMG="${TEST_DIR}/vpc-create-test.vpc"
137
138 _make_test_img 4G
139
140 echo
141 echo === Read created image, default opts ====
142 echo
143
144 $QEMU_IMG map --output=json --image-opts \
145 "driver=vpc,file.filename=$TEST_IMG" \
146 | _filter_qemu_img_map
147
148 echo
149 echo === Read created image, force_size_calc=chs ====
150 echo
151
152 $QEMU_IMG map --output=json --image-opts \
153 "driver=vpc,force_size_calc=chs,file.filename=$TEST_IMG" \
154 | _filter_qemu_img_map
155
156 echo
157 echo === Read created image, force_size_calc=current_size ====
158 echo
159
160 $QEMU_IMG map --output=json --image-opts \
161 "driver=vpc,force_size_calc=current_size,file.filename=$TEST_IMG" \
162 | _filter_qemu_img_map
163
164 echo
165 echo === Testing Image create, force_size ===
166 echo
167
168 _make_test_img -o force_size 4G
169
170 echo
171 echo === Read created image, default opts ====
172 echo
173
174 $QEMU_IMG map --output=json --image-opts \
175 "driver=vpc,file.filename=$TEST_IMG" \
176 | _filter_qemu_img_map
177
178 echo
179 echo === Read created image, force_size_calc=chs ====
180 echo
181
182 $QEMU_IMG map --output=json --image-opts \
183 "driver=vpc,force_size_calc=chs,file.filename=$TEST_IMG" \
184 | _filter_qemu_img_map
185
186 echo
187 echo === Read created image, force_size_calc=current_size ====
188 echo
189
190 $QEMU_IMG map --output=json --image-opts \
191 "driver=vpc,force_size_calc=current_size,file.filename=$TEST_IMG" \
192 | _filter_qemu_img_map
193
194 echo "*** done"
195 rm -f $seq.full
196 status=0