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