target/i386/kvm: Free xsave_buf when destroying vCPU
[qemu/rayw.git] / tests / qemu-iotests / 087
blobd8e0e384cdfcfc95cd1f08274d3691f9b3c41ff3
1 #!/usr/bin/env bash
2 # group: rw quick
4 # Test unsupported blockdev-add cases
6 # Copyright (C) 2014 Red Hat, Inc.
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
22 # creator
23 owner=kwolf@redhat.com
25 seq=`basename $0`
26 echo "QA output created by $seq"
28 status=1 # failure is the default!
30 _cleanup()
32 _cleanup_test_img
34 trap "_cleanup; exit \$status" 0 1 2 3 15
36 # get standard environment, filters and checks
37 . ./common.rc
38 . ./common.filter
40 _supported_fmt qcow2
41 _supported_proto file
42 _supported_os Linux
43 _require_working_luks
45 do_run_qemu()
47 echo Testing: "$@"
48 $QEMU -nographic -qmp stdio -serial none "$@"
49 echo
52 run_qemu()
54 do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qmp \
55 | _filter_qemu | _filter_imgfmt \
56 | _filter_actual_image_size
59 size=128M
61 _make_test_img $size
63 echo
64 echo === Missing ID and node-name ===
65 echo
67 run_qemu <<EOF
68 { "execute": "qmp_capabilities" }
69 { "execute": "blockdev-add",
70 "arguments": {
71 "driver": "$IMGFMT",
72 "file": {
73 "driver": "file",
74 "filename": "$TEST_IMG"
78 { "execute": "quit" }
79 EOF
81 echo
82 echo === Duplicate ID ===
83 echo
85 run_qemu -drive driver=$IMGFMT,id=disk,node-name=test-node,file="$TEST_IMG" <<EOF
86 { "execute": "qmp_capabilities" }
87 { "execute": "blockdev-add",
88 "arguments": {
89 "driver": "$IMGFMT",
90 "node-name": "disk",
91 "file": {
92 "driver": "null-co"
96 { "execute": "blockdev-add",
97 "arguments": {
98 "driver": "$IMGFMT",
99 "node-name": "test-node",
100 "file": {
101 "driver": "null-co"
105 { "execute": "quit" }
108 echo
109 echo === aio=native without O_DIRECT ===
110 echo
112 # Skip this test if AIO is not enabled in this build
113 run_qemu_filter_aio()
115 run_qemu "$@" | \
116 sed -e 's/is not supported in this build/it requires cache.direct=on, which was not specified/'
119 run_qemu_filter_aio <<EOF
120 { "execute": "qmp_capabilities" }
121 { "execute": "blockdev-add",
122 "arguments": {
123 "driver": "$IMGFMT",
124 "node-name": "disk",
125 "file": {
126 "driver": "file",
127 "filename": "$TEST_IMG",
128 "aio": "native"
132 { "execute": "quit" }
135 echo
136 echo === Encrypted image QCow ===
137 echo
139 _make_test_img --object secret,id=sec0,data=123456 -o encryption=on,encrypt.key-secret=sec0 $size
140 run_qemu <<EOF
141 { "execute": "qmp_capabilities" }
142 { "execute": "object-add",
143 "arguments": {
144 "qom-type": "secret",
145 "id": "sec0",
146 "data": "123456"
149 { "execute": "blockdev-add",
150 "arguments": {
151 "driver": "$IMGFMT",
152 "node-name": "disk",
153 "file": {
154 "driver": "file",
155 "filename": "$TEST_IMG"
157 "encrypt": {
158 "format": "aes",
159 "key-secret": "sec0"
163 { "execute": "quit" }
166 echo
167 echo === Encrypted image LUKS ===
168 echo
170 _make_test_img --object secret,id=sec0,data=123456 -o encrypt.format=luks,encrypt.key-secret=sec0 $size
171 run_qemu <<EOF
172 { "execute": "qmp_capabilities" }
173 { "execute": "object-add",
174 "arguments": {
175 "qom-type": "secret",
176 "id": "sec0",
177 "data": "123456"
180 { "execute": "blockdev-add",
181 "arguments": {
182 "driver": "$IMGFMT",
183 "node-name": "disk",
184 "file": {
185 "driver": "file",
186 "filename": "$TEST_IMG"
188 "encrypt": {
189 "format": "luks",
190 "key-secret": "sec0"
194 { "execute": "quit" }
197 echo
198 echo === Missing driver ===
199 echo
201 _make_test_img --object secret,id=sec0,data=123456 -o encryption=on,encrypt.key-secret=sec0 $size
202 run_qemu -S <<EOF
203 { "execute": "qmp_capabilities" }
204 { "execute": "blockdev-add",
205 "arguments": {
206 "node-name": "disk"
209 { "execute": "quit" }
212 # success, all done
213 echo "*** done"
214 rm -f $seq.full
215 status=0