xref: /openbmc/qemu/tests/qemu-iotests/146 (revision b917da4c)
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
27here=`pwd`
28status=1    # failure is the default!
29
30_cleanup()
31{
32    _cleanup_qemu
33    _cleanup_test_img
34}
35trap "_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
47qemu_comm_method="monitor"
48silent=
49
50echo
51echo === Testing VPC Autodetect ===
52echo
53_use_sample_img virtualpc-dynamic.vhd.bz2
54
55${QEMU_IO} -c "open -o driver=vpc ${TEST_IMG}" -c 'map'
56
57echo
58echo === Testing VPC with current_size force ===
59echo
60
61${QEMU_IO} -c "open -o driver=vpc,force_size_calc=current_size ${TEST_IMG}" -c 'map'
62
63echo
64echo === Testing VPC with chs force ===
65echo
66
67${QEMU_IO} -c "open -o driver=vpc,force_size_calc=chs ${TEST_IMG}" -c 'map'
68
69_cleanup_test_img
70
71echo
72echo === Testing Hyper-V Autodetect ===
73echo
74_use_sample_img hyperv2012r2-dynamic.vhd.bz2
75
76${QEMU_IO} -c "open -o driver=vpc ${TEST_IMG}" -c 'map'
77
78echo
79echo === Testing Hyper-V with current_size force ===
80echo
81
82${QEMU_IO} -c "open -o driver=vpc,force_size_calc=current_size ${TEST_IMG}" -c 'map'
83
84echo
85echo === Testing Hyper-V with chs force ===
86echo
87
88${QEMU_IO} -c "open -o driver=vpc,force_size_calc=chs ${TEST_IMG}" -c 'map'
89
90_cleanup_test_img
91
92echo
93echo === Testing d2v Autodetect ===
94echo
95_use_sample_img d2v-zerofilled.vhd.bz2
96
97${QEMU_IO} -c "open -o driver=vpc ${TEST_IMG}" -c 'map'
98
99echo
100echo === Testing d2v with current_size force ===
101echo
102
103${QEMU_IO} -c "open -o driver=vpc,force_size_calc=current_size ${TEST_IMG}" -c 'map'
104
105echo
106echo === Testing d2v with chs force ===
107echo
108
109${QEMU_IO} -c "open -o driver=vpc,force_size_calc=chs ${TEST_IMG}" -c 'map'
110
111_cleanup_test_img
112
113echo
114echo === Testing Image create, default ===
115echo
116
117TEST_IMG="${TEST_DIR}/vpc-create-test.vpc"
118
119_make_test_img 4G
120
121echo
122echo === Read created image, default opts ====
123echo
124
125${QEMU_IO} -c "open -o driver=vpc ${TEST_IMG}" -c 'map'
126
127echo
128echo === Read created image, force_size_calc=chs ====
129echo
130
131${QEMU_IO} -c "open -o driver=vpc,force_size_calc=chs ${TEST_IMG}" -c 'map'
132
133echo
134echo === Read created image, force_size_calc=current_size ====
135echo
136
137${QEMU_IO} -c "open -o driver=vpc,force_size_calc=current_size ${TEST_IMG}" -c 'map'
138
139echo
140echo === Testing Image create, force_size ===
141echo
142
143_make_test_img -o force_size 4G
144
145echo
146echo === Read created image, default opts ====
147echo
148
149${QEMU_IO} -c "open -o driver=vpc ${TEST_IMG}" -c 'map'
150
151echo
152echo === Read created image, force_size_calc=chs ====
153echo
154
155${QEMU_IO} -c "open -o driver=vpc,force_size_calc=chs ${TEST_IMG}" -c 'map'
156
157echo
158echo === Read created image, force_size_calc=current_size ====
159echo
160
161${QEMU_IO} -c "open -o driver=vpc,force_size_calc=current_size ${TEST_IMG}" -c 'map'
162
163echo "*** done"
164rm -f $seq.full
165status=0
166