es1370: check total frame count against current frame
[qemu/ar7.git] / tests / qemu-iotests / 087
blobbdfdad3454e3b5e1f950f4bc55baff58210a817e
1 #!/usr/bin/env 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 status=1 # failure is the default!
29 _cleanup()
31 _cleanup_test_img
33 trap "_cleanup; exit \$status" 0 1 2 3 15
35 # get standard environment, filters and checks
36 . ./common.rc
37 . ./common.filter
39 _supported_fmt qcow2
40 _supported_proto file
41 _supported_os Linux
43 do_run_qemu()
45 echo Testing: "$@"
46 $QEMU -nographic -qmp stdio -serial none "$@"
47 echo
50 run_qemu()
52 do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qmp \
53 | _filter_qemu | _filter_imgfmt \
54 | _filter_actual_image_size
57 size=128M
59 _make_test_img $size
61 echo
62 echo === Missing ID and node-name ===
63 echo
65 run_qemu <<EOF
66 { "execute": "qmp_capabilities" }
67 { "execute": "blockdev-add",
68 "arguments": {
69 "driver": "$IMGFMT",
70 "file": {
71 "driver": "file",
72 "filename": "$TEST_IMG"
76 { "execute": "quit" }
77 EOF
79 echo
80 echo === Duplicate ID ===
81 echo
83 run_qemu -drive driver=$IMGFMT,id=disk,node-name=test-node,file="$TEST_IMG" <<EOF
84 { "execute": "qmp_capabilities" }
85 { "execute": "blockdev-add",
86 "arguments": {
87 "driver": "$IMGFMT",
88 "node-name": "disk",
89 "file": {
90 "driver": "null-co"
94 { "execute": "blockdev-add",
95 "arguments": {
96 "driver": "$IMGFMT",
97 "node-name": "test-node",
98 "file": {
99 "driver": "null-co"
103 { "execute": "quit" }
106 echo
107 echo === aio=native without O_DIRECT ===
108 echo
110 # Skip this test if AIO is not enabled in this build
111 run_qemu_filter_aio()
113 run_qemu "$@" | \
114 sed -e 's/is not supported in this build/it requires cache.direct=on, which was not specified/'
117 run_qemu_filter_aio <<EOF
118 { "execute": "qmp_capabilities" }
119 { "execute": "blockdev-add",
120 "arguments": {
121 "driver": "$IMGFMT",
122 "node-name": "disk",
123 "file": {
124 "driver": "file",
125 "filename": "$TEST_IMG",
126 "aio": "native"
130 { "execute": "quit" }
133 echo
134 echo === Encrypted image QCow ===
135 echo
137 _make_test_img --object secret,id=sec0,data=123456 -o encryption=on,encrypt.key-secret=sec0 $size
138 run_qemu <<EOF
139 { "execute": "qmp_capabilities" }
140 { "execute": "object-add",
141 "arguments": {
142 "qom-type": "secret",
143 "id": "sec0",
144 "props": {
145 "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 "props": {
178 "data": "123456"
182 { "execute": "blockdev-add",
183 "arguments": {
184 "driver": "$IMGFMT",
185 "node-name": "disk",
186 "file": {
187 "driver": "file",
188 "filename": "$TEST_IMG"
190 "encrypt": {
191 "format": "luks",
192 "key-secret": "sec0"
196 { "execute": "quit" }
199 echo
200 echo === Missing driver ===
201 echo
203 _make_test_img --object secret,id=sec0,data=123456 -o encryption=on,encrypt.key-secret=sec0 $size
204 run_qemu -S <<EOF
205 { "execute": "qmp_capabilities" }
206 { "execute": "blockdev-add",
207 "arguments": {
208 "node-name": "disk"
211 { "execute": "quit" }
214 # success, all done
215 echo "*** done"
216 rm -f $seq.full
217 status=0