ati-vga: Fix check for blt outside vram
[qemu/ar7.git] / tests / qemu-iotests / 207
blobdfd3c51bd1dc6a07dc817454fb01817e102419dd
1 #!/usr/bin/env python
3 # Test ssh image creation
5 # Copyright (C) 2018 Red Hat, Inc.
7 # Creator/Owner: Kevin Wolf <kwolf@redhat.com>
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 2 of the License, or
12 # (at your option) any later version.
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program. If not, see <http://www.gnu.org/licenses/>.
23 import iotests
24 import subprocess
25 import re
27 iotests.verify_image_format(supported_fmts=['raw'])
28 iotests.verify_protocol(supported=['ssh'])
30 def filter_hash(qmsg):
31 def _filter(key, value):
32 if key == 'hash' and re.match('[0-9a-f]+', value):
33 return 'HASH'
34 return value
35 return iotests.filter_qmp(qmsg, _filter)
37 def blockdev_create(vm, options):
38 result = vm.qmp_log('blockdev-create', job_id='job0', options=options,
39 filters=[iotests.filter_qmp_testfiles, filter_hash])
41 if 'return' in result:
42 assert result['return'] == {}
43 vm.run_job('job0')
44 iotests.log("")
46 with iotests.FilePath('t.img') as disk_path, \
47 iotests.VM() as vm:
49 remote_path = iotests.remote_filename(disk_path)
52 # Successful image creation (defaults)
54 iotests.log("=== Successful image creation (defaults) ===")
55 iotests.log("")
57 vm.launch()
58 blockdev_create(vm, { 'driver': 'ssh',
59 'location': {
60 'path': disk_path,
61 'server': {
62 'host': '127.0.0.1',
63 'port': '22'
66 'size': 4194304 })
67 vm.shutdown()
69 iotests.img_info_log(remote_path, filter_path=disk_path)
70 iotests.log("")
71 iotests.img_info_log(disk_path)
74 # Test host-key-check options
76 iotests.log("=== Test host-key-check options ===")
77 iotests.log("")
79 vm.launch()
80 blockdev_create(vm, { 'driver': 'ssh',
81 'location': {
82 'path': disk_path,
83 'server': {
84 'host': '127.0.0.1',
85 'port': '22'
87 'host-key-check': {
88 'mode': 'none'
91 'size': 8388608 })
92 vm.shutdown()
94 iotests.img_info_log(remote_path, filter_path=disk_path)
96 vm.launch()
97 blockdev_create(vm, { 'driver': 'ssh',
98 'location': {
99 'path': disk_path,
100 'server': {
101 'host': '127.0.0.1',
102 'port': '22'
104 'host-key-check': {
105 'mode': 'known_hosts'
108 'size': 4194304 })
109 vm.shutdown()
111 iotests.img_info_log(remote_path, filter_path=disk_path)
113 md5_key = subprocess.check_output(
114 'ssh-keyscan -t rsa 127.0.0.1 2>/dev/null | grep -v "\\^#" | ' +
115 'cut -d" " -f3 | base64 -d | md5sum -b | cut -d" " -f1',
116 shell=True).rstrip().decode('ascii')
118 vm.launch()
119 blockdev_create(vm, { 'driver': 'ssh',
120 'location': {
121 'path': disk_path,
122 'server': {
123 'host': '127.0.0.1',
124 'port': '22'
126 'host-key-check': {
127 'mode': 'hash',
128 'type': 'md5',
129 'hash': 'wrong',
132 'size': 2097152 })
133 blockdev_create(vm, { 'driver': 'ssh',
134 'location': {
135 'path': disk_path,
136 'server': {
137 'host': '127.0.0.1',
138 'port': '22'
140 'host-key-check': {
141 'mode': 'hash',
142 'type': 'md5',
143 'hash': md5_key,
146 'size': 8388608 })
147 vm.shutdown()
149 iotests.img_info_log(remote_path, filter_path=disk_path)
151 sha1_key = subprocess.check_output(
152 'ssh-keyscan -t rsa 127.0.0.1 2>/dev/null | grep -v "\\^#" | ' +
153 'cut -d" " -f3 | base64 -d | sha1sum -b | cut -d" " -f1',
154 shell=True).rstrip().decode('ascii')
156 vm.launch()
157 blockdev_create(vm, { 'driver': 'ssh',
158 'location': {
159 'path': disk_path,
160 'server': {
161 'host': '127.0.0.1',
162 'port': '22'
164 'host-key-check': {
165 'mode': 'hash',
166 'type': 'sha1',
167 'hash': 'wrong',
170 'size': 2097152 })
171 blockdev_create(vm, { 'driver': 'ssh',
172 'location': {
173 'path': disk_path,
174 'server': {
175 'host': '127.0.0.1',
176 'port': '22'
178 'host-key-check': {
179 'mode': 'hash',
180 'type': 'sha1',
181 'hash': sha1_key,
184 'size': 4194304 })
185 vm.shutdown()
187 iotests.img_info_log(remote_path, filter_path=disk_path)
190 # Invalid path and user
192 iotests.log("=== Invalid path and user ===")
193 iotests.log("")
195 vm.launch()
196 blockdev_create(vm, { 'driver': 'ssh',
197 'location': {
198 'path': '/this/is/not/an/existing/path',
199 'server': {
200 'host': '127.0.0.1',
201 'port': '22'
203 'host-key-check': {
204 'mode': 'none'
207 'size': 4194304 })
208 blockdev_create(vm, { 'driver': 'ssh',
209 'location': {
210 'path': disk_path,
211 'user': 'invalid user',
212 'server': {
213 'host': '127.0.0.1',
214 'port': '22'
216 'host-key-check': {
217 'mode': 'none'
220 'size': 4194304 })
221 vm.shutdown()