]> Git Repo - qemu.git/blame - tests/qemu-iotests/087
tests: Use '+=' to add additional tests, not '='
[qemu.git] / tests / qemu-iotests / 087
CommitLineData
c75203c8
KW
1#!/bin/bash
2#
3# Test unsupported blockdev-add cases
4#
5# Copyright (C) 2014 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[email protected]
23
24seq=`basename $0`
25echo "QA output created by $seq"
26
27here=`pwd`
c75203c8
KW
28status=1 # failure is the default!
29
30# get standard environment, filters and checks
31. ./common.rc
32. ./common.filter
33
34_supported_fmt qcow2
35_supported_proto file
36_supported_os Linux
37
38function do_run_qemu()
39{
40 echo Testing: "$@"
41 $QEMU -nographic -qmp stdio -serial none "$@"
42 echo
43}
44
45function run_qemu()
46{
e6ff69bf
DB
47 do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qmp \
48 | _filter_qemu | _filter_imgfmt \
4dd7b8d3 49 | sed -e 's/\("actual-size":\s*\)[0-9]\+/\1SIZE/g'
c75203c8
KW
50}
51
52size=128M
53
54_make_test_img $size
55
56echo
be4b67bc 57echo === Missing ID and node-name ===
c75203c8
KW
58echo
59
60run_qemu <<EOF
61{ "execute": "qmp_capabilities" }
62{ "execute": "blockdev-add",
63 "arguments": {
64 "options": {
65 "driver": "$IMGFMT",
66 "file": {
67 "driver": "file",
68 "filename": "$TEST_IMG"
69 }
70 }
71 }
72 }
73{ "execute": "quit" }
74EOF
75
f2d953ec
KW
76echo
77echo === Duplicate ID ===
78echo
79
80run_qemu <<EOF
81{ "execute": "qmp_capabilities" }
82{ "execute": "blockdev-add",
83 "arguments": {
84 "options": {
85 "driver": "$IMGFMT",
86 "id": "disk",
90d9d301 87 "node-name": "test-node",
f2d953ec
KW
88 "file": {
89 "driver": "file",
90 "filename": "$TEST_IMG"
91 }
92 }
93 }
94 }
95{ "execute": "blockdev-add",
96 "arguments": {
97 "options": {
98 "driver": "$IMGFMT",
99 "id": "disk",
100 "file": {
101 "driver": "file",
102 "filename": "$TEST_IMG"
103 }
104 }
105 }
106 }
90d9d301
KW
107{ "execute": "blockdev-add",
108 "arguments": {
109 "options": {
110 "driver": "$IMGFMT",
111 "id": "test-node",
112 "file": {
113 "driver": "file",
114 "filename": "$TEST_IMG"
115 }
116 }
117 }
118 }
119{ "execute": "blockdev-add",
120 "arguments": {
121 "options": {
122 "driver": "$IMGFMT",
123 "id": "disk2",
124 "node-name": "disk",
125 "file": {
126 "driver": "file",
127 "filename": "$TEST_IMG"
128 }
129 }
130 }
131 }
132{ "execute": "blockdev-add",
133 "arguments": {
134 "options": {
135 "driver": "$IMGFMT",
136 "id": "disk2",
137 "node-name": "test-node",
138 "file": {
139 "driver": "file",
140 "filename": "$TEST_IMG"
141 }
142 }
143 }
144 }
145{ "execute": "blockdev-add",
146 "arguments": {
147 "options": {
148 "driver": "$IMGFMT",
149 "id": "disk3",
150 "node-name": "disk3",
151 "file": {
152 "driver": "file",
153 "filename": "$TEST_IMG"
154 }
155 }
156 }
157 }
f2d953ec
KW
158{ "execute": "quit" }
159EOF
160
c75203c8
KW
161echo
162echo === aio=native without O_DIRECT ===
163echo
164
165run_qemu <<EOF
166{ "execute": "qmp_capabilities" }
167{ "execute": "blockdev-add",
168 "arguments": {
169 "options": {
170 "driver": "$IMGFMT",
171 "id": "disk",
172 "aio": "native",
173 "file": {
174 "driver": "file",
175 "filename": "$TEST_IMG"
176 }
177 }
178 }
179 }
180{ "execute": "quit" }
181EOF
182
183echo
184echo === Encrypted image ===
185echo
186
187_make_test_img -o encryption=on $size
c3adb58f
MA
188run_qemu -S <<EOF
189{ "execute": "qmp_capabilities" }
190{ "execute": "blockdev-add",
191 "arguments": {
192 "options": {
193 "driver": "$IMGFMT",
194 "id": "disk",
195 "file": {
196 "driver": "file",
197 "filename": "$TEST_IMG"
198 }
199 }
200 }
201 }
202{ "execute": "quit" }
203EOF
204
c75203c8
KW
205run_qemu <<EOF
206{ "execute": "qmp_capabilities" }
207{ "execute": "blockdev-add",
208 "arguments": {
209 "options": {
210 "driver": "$IMGFMT",
211 "id": "disk",
212 "file": {
213 "driver": "file",
214 "filename": "$TEST_IMG"
215 }
216 }
217 }
218 }
219{ "execute": "quit" }
220EOF
221
fe509ee2
FZ
222echo
223echo === Missing driver ===
224echo
225
226_make_test_img -o encryption=on $size
227run_qemu -S <<EOF
228{ "execute": "qmp_capabilities" }
229{ "execute": "blockdev-add",
230 "arguments": {
231 "options": {
232 "id": "disk"
233 }
234 }
235 }
236{ "execute": "quit" }
237EOF
238
c75203c8
KW
239# success, all done
240echo "*** done"
241rm -f $seq.full
242status=0
This page took 0.228473 seconds and 4 git commands to generate.