Merge remote-tracking branch 'remotes/nvme/tags/nvme-fixes-20210407-pull-request...
[qemu/ar7.git] / tests / qemu-iotests / 146
blob98aca96732cf6616072d96c467672a3b5a12ffe3
1 #!/usr/bin/env bash
2 # group: quick
4 # Test VHD image format creator detection and override
6 # Copyright (C) 2016 Red Hat, Inc.
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.
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.
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/>.
22 # creator
23 owner=jcody@redhat.com
25 seq=`basename $0`
26 echo "QA output created by $seq"
28 status=1 # failure is the default!
30 _cleanup()
32 _cleanup_qemu
33 _cleanup_test_img
35 trap "_cleanup; exit \$status" 0 1 2 3 15
37 # get standard environment, filters and checks
38 . ./common.rc
39 . ./common.filter
40 . ./common.qemu
42 _supported_fmt vpc
43 _supported_proto file
44 _supported_os Linux
47 qemu_comm_method="monitor"
48 silent=
50 echo
51 echo === Testing VPC Autodetect ===
52 echo
53 _use_sample_img virtualpc-dynamic.vhd.bz2
55 $QEMU_IMG map --output=json --image-opts \
56 "driver=vpc,file.filename=$TEST_IMG" \
57 | _filter_qemu_img_map
59 echo
60 echo === Testing VPC with current_size force ===
61 echo
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
67 echo
68 echo === Testing VPC with chs force ===
69 echo
71 $QEMU_IMG map --output=json --image-opts \
72 "driver=vpc,force_size_calc=chs,file.filename=$TEST_IMG" \
73 | _filter_qemu_img_map
75 _cleanup_test_img
77 echo
78 echo === Testing Hyper-V Autodetect ===
79 echo
80 _use_sample_img hyperv2012r2-dynamic.vhd.bz2
82 $QEMU_IMG map --output=json --image-opts \
83 "driver=vpc,file.filename=$TEST_IMG" \
84 | _filter_qemu_img_map
86 echo
87 echo === Testing Hyper-V with current_size force ===
88 echo
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
94 echo
95 echo === Testing Hyper-V with chs force ===
96 echo
98 $QEMU_IMG map --output=json --image-opts \
99 "driver=vpc,force_size_calc=chs,file.filename=$TEST_IMG" \
100 | _filter_qemu_img_map
102 _cleanup_test_img
104 echo
105 echo === Testing d2v Autodetect ===
106 echo
107 _use_sample_img d2v-zerofilled.vhd.bz2
109 $QEMU_IMG map --output=json --image-opts \
110 "driver=vpc,file.filename=$TEST_IMG" \
111 | _filter_qemu_img_map
113 echo
114 echo === Testing d2v with current_size force ===
115 echo
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
121 echo
122 echo === Testing d2v with chs force ===
123 echo
125 $QEMU_IMG map --output=json --image-opts \
126 "driver=vpc,force_size_calc=chs,file.filename=$TEST_IMG" \
127 | _filter_qemu_img_map
129 _cleanup_test_img
131 echo
132 echo === Testing Image create, default ===
133 echo
135 TEST_IMG="${TEST_DIR}/vpc-create-test.vpc"
137 _make_test_img 4G
139 echo
140 echo === Read created image, default opts ====
141 echo
143 $QEMU_IMG map --output=json --image-opts \
144 "driver=vpc,file.filename=$TEST_IMG" \
145 | _filter_qemu_img_map
147 echo
148 echo === Read created image, force_size_calc=chs ====
149 echo
151 $QEMU_IMG map --output=json --image-opts \
152 "driver=vpc,force_size_calc=chs,file.filename=$TEST_IMG" \
153 | _filter_qemu_img_map
155 echo
156 echo === Read created image, force_size_calc=current_size ====
157 echo
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
163 echo
164 echo === Testing Image create, force_size ===
165 echo
167 _make_test_img -o force_size 4G
169 echo
170 echo === Read created image, default opts ====
171 echo
173 $QEMU_IMG map --output=json --image-opts \
174 "driver=vpc,file.filename=$TEST_IMG" \
175 | _filter_qemu_img_map
177 echo
178 echo === Read created image, force_size_calc=chs ====
179 echo
181 $QEMU_IMG map --output=json --image-opts \
182 "driver=vpc,force_size_calc=chs,file.filename=$TEST_IMG" \
183 | _filter_qemu_img_map
185 echo
186 echo === Read created image, force_size_calc=current_size ====
187 echo
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
193 echo "*** done"
194 rm -f $seq.full
195 status=0