These changes are the raw update to qemu-2.6.
[kvmfornfv.git] / qemu / tests / qemu-iotests / 146
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
22 owner=jcody@redhat.com
23
24 seq=`basename $0`
25 echo "QA output created by $seq"
26
27 here=`pwd`
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_IO} -c "open -o driver=vpc ${TEST_IMG}" -c 'map'
56
57 echo
58 echo === Testing VPC with current_size force ===
59 echo
60
61 ${QEMU_IO} -c "open -o driver=vpc,force_size_calc=current_size ${TEST_IMG}" -c 'map'
62
63 echo
64 echo === Testing VPC with chs force ===
65 echo
66
67 ${QEMU_IO} -c "open -o driver=vpc,force_size_calc=chs ${TEST_IMG}" -c 'map'
68
69 _cleanup_test_img
70
71 echo
72 echo === Testing Hyper-V Autodetect ===
73 echo
74 _use_sample_img hyperv2012r2-dynamic.vhd.bz2
75
76 ${QEMU_IO} -c "open -o driver=vpc ${TEST_IMG}" -c 'map'
77
78 echo
79 echo === Testing Hyper-V with current_size force ===
80 echo
81
82 ${QEMU_IO} -c "open -o driver=vpc,force_size_calc=current_size ${TEST_IMG}" -c 'map'
83
84 echo
85 echo === Testing Hyper-V with chs force ===
86 echo
87
88 ${QEMU_IO} -c "open -o driver=vpc,force_size_calc=chs ${TEST_IMG}" -c 'map'
89
90 _cleanup_test_img
91
92 echo
93 echo === Testing d2v Autodetect ===
94 echo
95 _use_sample_img d2v-zerofilled.vhd.bz2
96
97 ${QEMU_IO} -c "open -o driver=vpc ${TEST_IMG}" -c 'map'
98
99 echo
100 echo === Testing d2v with current_size force ===
101 echo
102
103 ${QEMU_IO} -c "open -o driver=vpc,force_size_calc=current_size ${TEST_IMG}" -c 'map'
104
105 echo
106 echo === Testing d2v with chs force ===
107 echo
108
109 ${QEMU_IO} -c "open -o driver=vpc,force_size_calc=chs ${TEST_IMG}" -c 'map'
110
111 _cleanup_test_img
112
113 echo
114 echo === Testing Image create, default ===
115 echo
116
117 TEST_IMG="${TEST_DIR}/vpc-create-test.vpc"
118
119 _make_test_img 4G
120
121 echo
122 echo === Read created image, default opts ====
123 echo
124
125 ${QEMU_IO} -c "open -o driver=vpc ${TEST_IMG}" -c 'map'
126
127 echo
128 echo === Read created image, force_size_calc=chs ====
129 echo
130
131 ${QEMU_IO} -c "open -o driver=vpc,force_size_calc=chs ${TEST_IMG}" -c 'map'
132
133 echo
134 echo === Read created image, force_size_calc=current_size ====
135 echo
136
137 ${QEMU_IO} -c "open -o driver=vpc,force_size_calc=current_size ${TEST_IMG}" -c 'map'
138
139 echo
140 echo === Testing Image create, force_size ===
141 echo
142
143 _make_test_img -o force_size 4G
144
145 echo
146 echo === Read created image, default opts ====
147 echo
148
149 ${QEMU_IO} -c "open -o driver=vpc ${TEST_IMG}" -c 'map'
150
151 echo
152 echo === Read created image, force_size_calc=chs ====
153 echo
154
155 ${QEMU_IO} -c "open -o driver=vpc,force_size_calc=chs ${TEST_IMG}" -c 'map'
156
157 echo
158 echo === Read created image, force_size_calc=current_size ====
159 echo
160
161 ${QEMU_IO} -c "open -o driver=vpc,force_size_calc=current_size ${TEST_IMG}" -c 'map'
162
163 echo "*** done"
164 rm -f $seq.full
165 status=0