Revert "qdev: Use qdev_get_device_class() for -device <type>,help"
[qemu.git] / tests / qemu-iotests / 087
blob8694749947780c9a21368d5a13e42cfdce6a1237
1 #!/bin/bash
3 # Test unsupported blockdev-add cases
5 # Copyright (C) 2014 Red Hat, Inc.
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.
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.
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/>.
21 # creator
22 owner=kwolf@redhat.com
24 seq=`basename $0`
25 echo "QA output created by $seq"
27 here=`pwd`
28 tmp=/tmp/$$
29 status=1 # failure is the default!
31 # get standard environment, filters and checks
32 . ./common.rc
33 . ./common.filter
35 _supported_fmt qcow2
36 _supported_proto file
37 _supported_os Linux
39 function do_run_qemu()
41 echo Testing: "$@"
42 $QEMU -nographic -qmp stdio -serial none "$@"
43 echo
46 function run_qemu()
48 do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qmp | _filter_qemu \
49 | sed -e 's/\("actual-size":\s*\)[0-9]\+/\1SIZE/g'
52 size=128M
54 _make_test_img $size
56 echo
57 echo === Missing ID ===
58 echo
60 run_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"
73 { "execute": "quit" }
74 EOF
76 echo
77 echo === Duplicate ID ===
78 echo
80 run_qemu <<EOF
81 { "execute": "qmp_capabilities" }
82 { "execute": "blockdev-add",
83 "arguments": {
84 "options": {
85 "driver": "$IMGFMT",
86 "id": "disk",
87 "node-name": "test-node",
88 "file": {
89 "driver": "file",
90 "filename": "$TEST_IMG"
95 { "execute": "blockdev-add",
96 "arguments": {
97 "options": {
98 "driver": "$IMGFMT",
99 "id": "disk",
100 "file": {
101 "driver": "file",
102 "filename": "$TEST_IMG"
107 { "execute": "blockdev-add",
108 "arguments": {
109 "options": {
110 "driver": "$IMGFMT",
111 "id": "test-node",
112 "file": {
113 "driver": "file",
114 "filename": "$TEST_IMG"
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"
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"
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"
158 { "execute": "quit" }
161 echo
162 echo === aio=native without O_DIRECT ===
163 echo
165 run_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"
180 { "execute": "quit" }
183 echo
184 echo === Encrypted image ===
185 echo
187 _make_test_img -o encryption=on $size
188 run_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"
202 { "execute": "quit" }
205 run_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"
219 { "execute": "quit" }
222 echo
223 echo === Missing driver ===
224 echo
226 _make_test_img -o encryption=on $size
227 run_qemu -S <<EOF
228 { "execute": "qmp_capabilities" }
229 { "execute": "blockdev-add",
230 "arguments": {
231 "options": {
232 "id": "disk"
236 { "execute": "quit" }
239 # success, all done
240 echo "*** done"
241 rm -f $seq.full
242 status=0