qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

Merge remote-tracking branch 'remotes/philmd-gitlab/tags/python-next-20200207' into staging

- Python 3 cleanups:
. Remove text about Python 2 in qemu-deprecated (Thomas)
. Remove shebang header (Paolo, Philippe)
. scripts/checkpatch.pl now allows Python 3 interpreter (Philippe)
. Explicit usage of Python 3 interpreter in scripts (Philippe)
. Fix Python scripts permissions (Paolo, Philippe)
. Drop 'from __future__ import print_function' (Paolo)
. Specify minimum python requirements in ReadTheDocs configuration (Alex)
- Test UNIX/EXEC transports with migration (Oksana)
- Added extract_from_rpm helper, improved extract_from_deb (Liam)
- Allow to use other serial consoles than default one (Philippe)
- Various improvements in QEMUMonitorProtocol (Wainer)
- Fix kvm_available() on ppc64le (Wainer)

# gpg: Signature made Fri 07 Feb 2020 15:01:56 GMT
# gpg: using RSA key FAABE75E12917221DCFD6BB2E3E32C2CDEADC0DE
# gpg: Good signature from "Philippe Mathieu-Daudé (F4BUG) <f4bug@amsat.org>" [full]
# Primary key fingerprint: FAAB E75E 1291 7221 DCFD 6BB2 E3E3 2C2C DEAD C0DE

* remotes/philmd-gitlab/tags/python-next-20200207: (46 commits)
.readthedocs.yml: specify some minimum python requirements
drop "from __future__ import print_function"
make all Python scripts executable
scripts/signrom: remove Python 2 support, add shebang
tests/qemu-iotests/check: Only check for Python 3 interpreter
scripts: Explicit usage of Python 3 (scripts without __main__)
tests/qemu-iotests: Explicit usage of Python3 (scripts without __main__)
tests/vm: Remove shebang header
tests/acceptance: Remove shebang header
scripts/tracetool: Remove shebang header
scripts/minikconf: Explicit usage of Python 3
scripts: Explicit usage of Python 3 (scripts with __main__)
tests: Explicit usage of Python 3
tests/qemu-iotests: Explicit usage of Python 3 (scripts with __main__)
tests/qemu-iotests/check: Allow use of python3 interpreter
scripts/checkpatch.pl: Only allow Python 3 interpreter
tests/acceptance/migration: Default to -nodefaults
tests/acceptance/migration: Add the 'migration' tag
tests/acceptance/migration: Test EXEC transport when migrating
tests/acceptance/migration: Test UNIX transport when migrating
...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

+563 -365
+20
.readthedocs.yml
··· 1 + # .readthedocs.yml 2 + # Read the Docs configuration file 3 + # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details 4 + 5 + # Required 6 + version: 2 7 + 8 + # Build documentation in the docs/ directory with Sphinx 9 + sphinx: 10 + configuration: docs/conf.py 11 + 12 + # We want all the document formats 13 + formats: all 14 + 15 + # For consistency, we require that QEMU's Sphinx extensions 16 + # run with at least the same minimum version of Python that 17 + # we require for other Python in our codebase (our conf.py 18 + # enforces this, and some code needs it.) 19 + python: 20 + version: 3.5
+2 -1
.travis.yml
··· 313 313 # Acceptance (Functional) tests 314 314 - name: "GCC check-acceptance" 315 315 env: 316 - - CONFIG="--target-list=x86_64-softmmu,mips-softmmu,mips64el-softmmu,aarch64-softmmu,arm-softmmu,s390x-softmmu,alpha-softmmu,ppc-softmmu,ppc64-softmmu,m68k-softmmu,sparc-softmmu" 316 + - CONFIG="--target-list=aarch64-softmmu,alpha-softmmu,arm-softmmu,m68k-softmmu,microblaze-softmmu,mips-softmmu,mips64el-softmmu,nios2-softmmu,or1k-softmmu,ppc-softmmu,ppc64-softmmu,s390x-softmmu,sparc-softmmu,x86_64-softmmu,xtensa-softmmu" 317 317 - TEST_CMD="make check-acceptance" 318 318 after_script: 319 319 - python3 -c 'import json; r = json.load(open("tests/results/latest/results.json")); [print(t["logfile"]) for t in r["tests"] if t["status"] not in ("PASS", "SKIP")]' | xargs cat ··· 323 323 - python3-pil 324 324 - python3-pip 325 325 - python3.5-venv 326 + - rpm2cpio 326 327 - tesseract-ocr 327 328 - tesseract-ocr-eng 328 329
+2 -1
python/qemu/accel.py
··· 24 24 # support which often includes its 32 bit cousin. 25 25 ADDITIONAL_ARCHES = { 26 26 "x86_64" : "i386", 27 - "aarch64" : "armhf" 27 + "aarch64" : "armhf", 28 + "ppc64le" : "ppc64", 28 29 } 29 30 30 31 def list_accel(qemu_bin):
+9 -1
python/qemu/machine.py
··· 112 112 self._sock_dir = sock_dir 113 113 self._launched = False 114 114 self._machine = None 115 + self._console_index = 0 115 116 self._console_set = False 116 117 self._console_device_type = None 117 118 self._console_address = None ··· 241 242 'chardev=mon,mode=control']) 242 243 if self._machine is not None: 243 244 args.extend(['-machine', self._machine]) 245 + for i in range(self._console_index): 246 + args.extend(['-serial', 'null']) 244 247 if self._console_set: 245 248 self._console_address = os.path.join(self._sock_dir, 246 249 self._name + "-console.sock") ··· 527 530 """ 528 531 self._machine = machine_type 529 532 530 - def set_console(self, device_type=None): 533 + def set_console(self, device_type=None, console_index=0): 531 534 """ 532 535 Sets the device type for a console device 533 536 ··· 548 551 chardev:console" command line argument will 549 552 be used instead, resorting to the machine's 550 553 default device type. 554 + @param console_index: the index of the console device to use. 555 + If not zero, the command line will create 556 + 'index - 1' consoles and connect them to 557 + the 'null' backing character device. 551 558 """ 552 559 self._console_set = True 553 560 self._console_device_type = device_type 561 + self._console_index = console_index 554 562 555 563 @property 556 564 def console_socket(self):
+72 -27
python/qemu/qmp.py
··· 1 - # QEMU Monitor Protocol Python class 2 - # 1 + """ QEMU Monitor Protocol Python class """ 3 2 # Copyright (C) 2009, 2010 Red Hat Inc. 4 3 # 5 4 # Authors: ··· 15 14 16 15 17 16 class QMPError(Exception): 18 - pass 17 + """ 18 + QMP base exception 19 + """ 19 20 20 21 21 22 class QMPConnectError(QMPError): 22 - pass 23 + """ 24 + QMP connection exception 25 + """ 23 26 24 27 25 28 class QMPCapabilitiesError(QMPError): 26 - pass 29 + """ 30 + QMP negotiate capabilities exception 31 + """ 27 32 28 33 29 34 class QMPTimeoutError(QMPError): 30 - pass 35 + """ 36 + QMP timeout exception 37 + """ 31 38 32 39 33 - class QEMUMonitorProtocol(object): 40 + class QEMUMonitorProtocol: 41 + """ 42 + Provide an API to connect to QEMU via QEMU Monitor Protocol (QMP) and then 43 + allow to handle commands and events. 44 + """ 34 45 35 46 #: Logger object for debugging messages 36 47 logger = logging.getLogger('QMP') 37 - #: Socket's error class 38 - error = socket.error 39 - #: Socket's timeout 40 - timeout = socket.timeout 41 48 42 49 def __init__(self, address, server=False): 43 50 """ ··· 47 54 or a tuple in the form ( address, port ) for a TCP 48 55 connection 49 56 @param server: server mode listens on the socket (bool) 50 - @raise socket.error on socket connection errors 57 + @raise OSError on socket connection errors 51 58 @note No connection is established, this is done by the connect() or 52 59 accept() methods 53 60 """ ··· 73 80 raise QMPConnectError 74 81 # Greeting seems ok, negotiate capabilities 75 82 resp = self.cmd('qmp_capabilities') 76 - if "return" in resp: 83 + if resp and "return" in resp: 77 84 return greeting 78 85 raise QMPCapabilitiesError 79 86 ··· 81 88 while True: 82 89 data = self.__sockfile.readline() 83 90 if not data: 84 - return 91 + return None 85 92 resp = json.loads(data) 86 93 if 'event' in resp: 87 94 self.logger.debug("<<< %s", resp) ··· 107 114 self.__sock.setblocking(0) 108 115 try: 109 116 self.__json_read() 110 - except socket.error as err: 111 - if err[0] == errno.EAGAIN: 117 + except OSError as err: 118 + if err.errno == errno.EAGAIN: 112 119 # No data available 113 120 pass 114 121 self.__sock.setblocking(1) ··· 128 135 raise QMPConnectError("Error while reading from socket") 129 136 self.__sock.settimeout(None) 130 137 138 + def __enter__(self): 139 + # Implement context manager enter function. 140 + return self 141 + 142 + def __exit__(self, exc_type, exc_value, exc_traceback): 143 + # Implement context manager exit function. 144 + self.close() 145 + return False 146 + 131 147 def connect(self, negotiate=True): 132 148 """ 133 149 Connect to the QMP Monitor and perform capabilities negotiation. 134 150 135 - @return QMP greeting dict 136 - @raise socket.error on socket connection errors 151 + @return QMP greeting dict, or None if negotiate is false 152 + @raise OSError on socket connection errors 137 153 @raise QMPConnectError if the greeting is not received 138 154 @raise QMPCapabilitiesError if fails to negotiate capabilities 139 155 """ ··· 141 157 self.__sockfile = self.__sock.makefile() 142 158 if negotiate: 143 159 return self.__negotiate_capabilities() 160 + return None 144 161 145 - def accept(self): 162 + def accept(self, timeout=15.0): 146 163 """ 147 164 Await connection from QMP Monitor and perform capabilities negotiation. 148 165 166 + @param timeout: timeout in seconds (nonnegative float number, or 167 + None). The value passed will set the behavior of the 168 + underneath QMP socket as described in [1]. Default value 169 + is set to 15.0. 149 170 @return QMP greeting dict 150 - @raise socket.error on socket connection errors 171 + @raise OSError on socket connection errors 151 172 @raise QMPConnectError if the greeting is not received 152 173 @raise QMPCapabilitiesError if fails to negotiate capabilities 174 + 175 + [1] 176 + https://docs.python.org/3/library/socket.html#socket.socket.settimeout 153 177 """ 154 - self.__sock.settimeout(15) 178 + self.__sock.settimeout(timeout) 155 179 self.__sock, _ = self.__sock.accept() 156 180 self.__sockfile = self.__sock.makefile() 157 181 return self.__negotiate_capabilities() ··· 167 191 self.logger.debug(">>> %s", qmp_cmd) 168 192 try: 169 193 self.__sock.sendall(json.dumps(qmp_cmd).encode('utf-8')) 170 - except socket.error as err: 171 - if err[0] == errno.EPIPE: 172 - return 173 - raise socket.error(err) 194 + except OSError as err: 195 + if err.errno == errno.EPIPE: 196 + return None 197 + raise err 174 198 resp = self.__json_read() 175 199 self.logger.debug("<<< %s", resp) 176 200 return resp ··· 243 267 self.__events = [] 244 268 245 269 def close(self): 246 - self.__sock.close() 247 - self.__sockfile.close() 270 + """ 271 + Close the socket and socket file. 272 + """ 273 + if self.__sock: 274 + self.__sock.close() 275 + if self.__sockfile: 276 + self.__sockfile.close() 248 277 249 278 def settimeout(self, timeout): 279 + """ 280 + Set the socket timeout. 281 + 282 + @param timeout (float): timeout in seconds, or None. 283 + @note This is a wrap around socket.settimeout 284 + """ 250 285 self.__sock.settimeout(timeout) 251 286 252 287 def get_sock_fd(self): 288 + """ 289 + Get the socket file descriptor. 290 + 291 + @return The file descriptor number. 292 + """ 253 293 return self.__sock.fileno() 254 294 255 295 def is_scm_available(self): 296 + """ 297 + Check if the socket allows for SCM_RIGHTS. 298 + 299 + @return True if SCM_RIGHTS is available, otherwise False. 300 + """ 256 301 return self.__sock.family == socket.AF_UNIX
-8
qemu-deprecated.texi
··· 320 320 Silently ignored options can be confusing, so this combination of 321 321 options will be made an error in future versions. 322 322 323 - @section Build system 324 - 325 - @subsection Python 2 support (since 4.1.0) 326 - 327 - In the future, QEMU will require Python 3 to be available at 328 - build time. Support for Python 2 in scripts shipped with QEMU 329 - is deprecated. 330 - 331 323 @section Backwards compatibility 332 324 333 325 @subsection Runnability guarantee of CPU models (since 4.1.0)
+1 -2
scripts/analyse-9p-simpletrace.py
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # Pretty print 9p simpletrace log 3 3 # Usage: ./analyse-9p-simpletrace <trace-events> <trace-pid> 4 4 # 5 5 # Author: Harsh Prateek Bora 6 - from __future__ import print_function 7 6 import os 8 7 import simpletrace 9 8
+1 -2
scripts/analyse-locks-simpletrace.py
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # -*- coding: utf-8 -*- 3 3 # 4 4 # Analyse lock events and compute statistics ··· 6 6 # Author: Alex Bennée <alex.bennee@linaro.org> 7 7 # 8 8 9 - from __future__ import print_function 10 9 import simpletrace 11 10 import argparse 12 11 import numpy as np
+6
scripts/checkpatch.pl
··· 1460 1460 } 1461 1461 } 1462 1462 1463 + # Only allow Python 3 interpreter 1464 + if ($realline == 1 && 1465 + $line =~ /^\+#!\ *\/usr\/bin\/(?:env )?python$/) { 1466 + ERROR("please use python3 interpreter\n" . $herecurr); 1467 + } 1468 + 1463 1469 # Accept git diff extended headers as valid patches 1464 1470 if ($line =~ /^(?:rename|copy) (?:from|to) [\w\/\.\-]+\s*$/) { 1465 1471 $is_patch = 1;
+1 -1
scripts/decodetree.py
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # Copyright (c) 2018 Linaro Limited 3 3 # 4 4 # This library is free software; you can redistribute it and/or
+1 -2
scripts/device-crash-test
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Copyright (c) 2017 Red Hat Inc 4 4 # ··· 23 23 Run QEMU with all combinations of -machine and -device types, 24 24 check for crashes and unexpected errors. 25 25 """ 26 - from __future__ import print_function 27 26 28 27 import os 29 28 import sys
-1
scripts/dump-guest-memory.py
··· 12 12 This work is licensed under the terms of the GNU GPL, version 2 or later. See 13 13 the COPYING file in the top-level directory. 14 14 """ 15 - from __future__ import print_function 16 15 17 16 import ctypes 18 17 import struct
+1 -2
scripts/kvm/kvm_flightrecorder
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # KVM Flight Recorder - ring buffer tracing script 4 4 # ··· 32 32 # consuming CPU cycles. No disk I/O is performed since the ring buffer holds a 33 33 # fixed-size in-memory trace. 34 34 35 - from __future__ import print_function 36 35 import sys 37 36 import os 38 37
-1
scripts/kvm/vmxcap
··· 10 10 # This work is licensed under the terms of the GNU GPL, version 2. See 11 11 # the COPYING file in the top-level directory. 12 12 13 - from __future__ import print_function 14 13 MSR_IA32_VMX_BASIC = 0x480 15 14 MSR_IA32_VMX_PINBASED_CTLS = 0x481 16 15 MSR_IA32_VMX_PROCBASED_CTLS = 0x482
+1 -1
scripts/minikconf.py
··· 1 + #!/usr/bin/env python3 1 2 # 2 3 # Mini-Kconfig parser 3 4 # ··· 10 11 # or, at your option, any later version. See the COPYING file in 11 12 # the top-level directory. 12 13 13 - from __future__ import print_function 14 14 import os 15 15 import sys 16 16 import re
-1
scripts/modules/module_block.py
··· 10 10 # This work is licensed under the terms of the GNU GPL, version 2. 11 11 # See the COPYING file in the top-level directory. 12 12 13 - from __future__ import print_function 14 13 import sys 15 14 import os 16 15
+1 -2
scripts/qapi-gen.py
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # QAPI generator 3 3 # 4 4 # This work is licensed under the terms of the GNU GPL, version 2 or later. 5 5 # See the COPYING file in the top-level directory. 6 6 7 - from __future__ import print_function 8 7 9 8 import argparse 10 9 import re
-1
scripts/qapi/doc.py
··· 4 4 # See the COPYING file in the top-level directory. 5 5 """This script produces the documentation of a qapi schema in texinfo format""" 6 6 7 - from __future__ import print_function 8 7 import re 9 8 from qapi.gen import QAPIGenDoc, QAPISchemaVisitor 10 9
+1 -2
scripts/qmp/qemu-ga-client
··· 1 - #!/usr/bin/python 1 + #!/usr/bin/env python3 2 2 3 3 # QEMU Guest Agent Client 4 4 # ··· 36 36 # See also: https://wiki.qemu.org/Features/QAPI/GuestAgent 37 37 # 38 38 39 - from __future__ import print_function 40 39 import os 41 40 import sys 42 41 import base64
+1 -2
scripts/qmp/qmp
··· 1 - #!/usr/bin/python 1 + #!/usr/bin/env python3 2 2 # 3 3 # QMP command line tool 4 4 # ··· 10 10 # This work is licensed under the terms of the GNU GPLv2 or later. 11 11 # See the COPYING file in the top-level directory. 12 12 13 - from __future__ import print_function 14 13 import sys, os 15 14 from qmp import QEMUMonitorProtocol 16 15
+1 -2
scripts/qmp/qmp-shell
··· 1 - #!/usr/bin/python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Low-level QEMU shell on top of QMP. 4 4 # ··· 65 65 # which will echo back the properly formatted JSON-compliant QMP that is being 66 66 # sent to QEMU, which is useful for debugging and documentation generation. 67 67 68 - from __future__ import print_function 69 68 import json 70 69 import ast 71 70 import readline
+1 -1
scripts/qmp/qom-fuse
··· 1 - #!/usr/bin/python 1 + #!/usr/bin/env python3 2 2 ## 3 3 # QEMU Object Model test tools 4 4 #
-1
scripts/qmp/qom-get
··· 11 11 # the COPYING file in the top-level directory. 12 12 ## 13 13 14 - from __future__ import print_function 15 14 import sys 16 15 import os 17 16 from qmp import QEMUMonitorProtocol
-1
scripts/qmp/qom-list
··· 11 11 # the COPYING file in the top-level directory. 12 12 ## 13 13 14 - from __future__ import print_function 15 14 import sys 16 15 import os 17 16 from qmp import QEMUMonitorProtocol
-1
scripts/qmp/qom-set
··· 11 11 # the COPYING file in the top-level directory. 12 12 ## 13 13 14 - from __future__ import print_function 15 14 import sys 16 15 import os 17 16 from qmp import QEMUMonitorProtocol
-1
scripts/qmp/qom-tree
··· 13 13 # the COPYING file in the top-level directory. 14 14 ## 15 15 16 - from __future__ import print_function 17 16 import sys 18 17 import os 19 18 from qmp import QEMUMonitorProtocol
+1 -1
scripts/render_block_graph.py
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Render Qemu Block Graph 4 4 #
+1 -2
scripts/replay-dump.py
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # -*- coding: utf-8 -*- 3 3 # 4 4 # Dump the contents of a recorded execution stream ··· 18 18 # You should have received a copy of the GNU Lesser General Public 19 19 # License along with this library; if not, see <http://www.gnu.org/licenses/>. 20 20 21 - from __future__ import print_function 22 21 import argparse 23 22 import struct 24 23 from collections import namedtuple
+3 -8
scripts/signrom.py
··· 1 - from __future__ import print_function 1 + #!/usr/bin/env python3 2 + 2 3 # 3 4 # Option ROM signing utility 4 5 # ··· 44 45 45 46 checksum = 0 46 47 for b in data: 47 - # catch Python 2 vs. 3 differences 48 - if isinstance(b, int): 49 - checksum += b 50 - else: 51 - checksum += ord(b) 52 - checksum = (256 - checksum) % 256 48 + checksum = (checksum - b) & 255 53 49 54 - # Python 3 no longer allows chr(checksum) 55 50 fout.write(struct.pack('B', checksum)) 56 51 57 52 fin.close()
+1 -2
scripts/simpletrace.py
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Pretty-printer for simple trace backend binary trace files 4 4 # ··· 9 9 # 10 10 # For help see docs/devel/tracing.txt 11 11 12 - from __future__ import print_function 13 12 import struct 14 13 import inspect 15 14 from tracetool import read_events, Event
+1 -1
scripts/tracetool.py
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # -*- coding: utf-8 -*- 3 3 4 4 """
-1
scripts/tracetool/__init__.py
··· 1 - #!/usr/bin/env python 2 1 # -*- coding: utf-8 -*- 3 2 4 3 """
-1
scripts/tracetool/backend/__init__.py
··· 1 - #!/usr/bin/env python 2 1 # -*- coding: utf-8 -*- 3 2 4 3 """
-1
scripts/tracetool/backend/dtrace.py
··· 1 - #!/usr/bin/env python 2 1 # -*- coding: utf-8 -*- 3 2 4 3 """
-1
scripts/tracetool/backend/ftrace.py
··· 1 - #!/usr/bin/env python 2 1 # -*- coding: utf-8 -*- 3 2 4 3 """
-1
scripts/tracetool/backend/log.py
··· 1 - #!/usr/bin/env python 2 1 # -*- coding: utf-8 -*- 3 2 4 3 """
-1
scripts/tracetool/backend/simple.py
··· 1 - #!/usr/bin/env python 2 1 # -*- coding: utf-8 -*- 3 2 4 3 """
-1
scripts/tracetool/backend/syslog.py
··· 1 - #!/usr/bin/env python 2 1 # -*- coding: utf-8 -*- 3 2 4 3 """
-1
scripts/tracetool/backend/ust.py
··· 1 - #!/usr/bin/env python 2 1 # -*- coding: utf-8 -*- 3 2 4 3 """
-1
scripts/tracetool/format/__init__.py
··· 1 - #!/usr/bin/env python 2 1 # -*- coding: utf-8 -*- 3 2 4 3 """
-1
scripts/tracetool/format/c.py
··· 1 - #!/usr/bin/env python 2 1 # -*- coding: utf-8 -*- 3 2 4 3 """
-1
scripts/tracetool/format/d.py
··· 1 - #!/usr/bin/env python 2 1 # -*- coding: utf-8 -*- 3 2 4 3 """
-1
scripts/tracetool/format/h.py
··· 1 - #!/usr/bin/env python 2 1 # -*- coding: utf-8 -*- 3 2 4 3 """
-1
scripts/tracetool/format/log_stap.py
··· 1 - #!/usr/bin/env python 2 1 # -*- coding: utf-8 -*- 3 2 4 3 """
-1
scripts/tracetool/format/simpletrace_stap.py
··· 1 - #!/usr/bin/env python 2 1 # -*- coding: utf-8 -*- 3 2 4 3 """
-1
scripts/tracetool/format/stap.py
··· 1 - #!/usr/bin/env python 2 1 # -*- coding: utf-8 -*- 3 2 4 3 """
-1
scripts/tracetool/format/tcg_h.py
··· 1 - #!/usr/bin/env python 2 1 # -*- coding: utf-8 -*- 3 2 4 3 """
-1
scripts/tracetool/format/tcg_helper_c.py
··· 1 - #!/usr/bin/env python 2 1 # -*- coding: utf-8 -*- 3 2 4 3 """
-1
scripts/tracetool/format/tcg_helper_h.py
··· 1 - #!/usr/bin/env python 2 1 # -*- coding: utf-8 -*- 3 2 4 3 """
-1
scripts/tracetool/format/tcg_helper_wrapper_h.py
··· 1 - #!/usr/bin/env python 2 1 # -*- coding: utf-8 -*- 3 2 4 3 """
-1
scripts/tracetool/format/ust_events_c.py
··· 1 - #!/usr/bin/env python 2 1 # -*- coding: utf-8 -*- 3 2 4 3 """
-1
scripts/tracetool/format/ust_events_h.py
··· 1 - #!/usr/bin/env python 2 1 # -*- coding: utf-8 -*- 3 2 4 3 """
-1
scripts/tracetool/transform.py
··· 1 - #!/usr/bin/env python 2 1 # -*- coding: utf-8 -*- 3 2 4 3 """
-1
scripts/tracetool/vcpu.py
··· 1 - #!/usr/bin/env python 2 1 # -*- coding: utf-8 -*- 3 2 4 3 """
+1 -2
scripts/vmstate-static-checker.py
··· 1 - #!/usr/bin/python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Compares vmstate information stored in JSON format, obtained from 4 4 # the -dump-vmstate QEMU command. ··· 19 19 # You should have received a copy of the GNU General Public License along 20 20 # with this program; if not, see <http://www.gnu.org/licenses/>. 21 21 22 - from __future__ import print_function 23 22 import argparse 24 23 import json 25 24 import sys
+45 -14
tests/acceptance/avocado_qemu/__init__.py
··· 55 55 return qemu_bin_from_src_dir_path 56 56 57 57 58 - def wait_for_console_pattern(test, success_message, failure_message=None): 59 - """ 60 - Waits for messages to appear on the console, while logging the content 61 - 62 - :param test: an Avocado test containing a VM that will have its console 63 - read and probed for a success or failure message 64 - :type test: :class:`avocado_qemu.Test` 65 - :param success_message: if this message appears, test succeeds 66 - :param failure_message: if this message appears, test fails 67 - """ 58 + def _console_interaction(test, success_message, failure_message, 59 + send_string, keep_sending=False): 60 + assert not keep_sending or send_string 68 61 console = test.vm.console_socket.makefile() 69 62 console_logger = logging.getLogger('console') 70 63 while True: 64 + if send_string: 65 + test.vm.console_socket.sendall(send_string.encode()) 66 + if not keep_sending: 67 + send_string = None # send only once 71 68 msg = console.readline().strip() 72 69 if not msg: 73 70 continue ··· 79 76 fail = 'Failure message found in console: %s' % failure_message 80 77 test.fail(fail) 81 78 79 + def interrupt_interactive_console_until_pattern(test, success_message, 80 + failure_message=None, 81 + interrupt_string='\r'): 82 + """ 83 + Keep sending a string to interrupt a console prompt, while logging the 84 + console output. Typical use case is to break a boot loader prompt, such: 85 + 86 + Press a key within 5 seconds to interrupt boot process. 87 + 5 88 + 4 89 + 3 90 + 2 91 + 1 92 + Booting default image... 93 + 94 + :param test: an Avocado test containing a VM that will have its console 95 + read and probed for a success or failure message 96 + :type test: :class:`avocado_qemu.Test` 97 + :param success_message: if this message appears, test succeeds 98 + :param failure_message: if this message appears, test fails 99 + :param interrupt_string: a string to send to the console before trying 100 + to read a new line 101 + """ 102 + _console_interaction(test, success_message, failure_message, 103 + interrupt_string, True) 104 + 105 + def wait_for_console_pattern(test, success_message, failure_message=None): 106 + """ 107 + Waits for messages to appear on the console, while logging the content 108 + 109 + :param test: an Avocado test containing a VM that will have its console 110 + read and probed for a success or failure message 111 + :type test: :class:`avocado_qemu.Test` 112 + :param success_message: if this message appears, test succeeds 113 + :param failure_message: if this message appears, test fails 114 + """ 115 + _console_interaction(test, success_message, failure_message, None) 82 116 83 117 def exec_command_and_wait_for_pattern(test, command, 84 118 success_message, failure_message=None): ··· 94 128 :param success_message: if this message appears, test succeeds 95 129 :param failure_message: if this message appears, test fails 96 130 """ 97 - command += '\r' 98 - test.vm.console_socket.sendall(command.encode()) 99 - wait_for_console_pattern(test, success_message, failure_message) 100 - 131 + _console_interaction(test, success_message, failure_message, command + '\r') 101 132 102 133 class Test(avocado.Test): 103 134 def _get_unique_tag_val(self, tag_name):
+121 -3
tests/acceptance/boot_linux_console.py
··· 40 40 Extracts a file from a deb package into the test workdir 41 41 42 42 :param deb: path to the deb archive 43 - :param file: path within the deb archive of the file to be extracted 43 + :param path: path within the deb archive of the file to be extracted 44 44 :returns: path of the extracted file 45 45 """ 46 46 cwd = os.getcwd() ··· 49 49 process.run("ar x %s %s" % (deb, file_path)) 50 50 archive.extract(file_path, self.workdir) 51 51 os.chdir(cwd) 52 - return self.workdir + path 52 + # Return complete path to extracted file. Because callers to 53 + # extract_from_deb() specify 'path' with a leading slash, it is 54 + # necessary to use os.path.relpath() as otherwise os.path.join() 55 + # interprets it as an absolute path and drops the self.workdir part. 56 + return os.path.normpath(os.path.join(self.workdir, 57 + os.path.relpath(path, '/'))) 58 + 59 + def extract_from_rpm(self, rpm, path): 60 + """ 61 + Extracts a file from an RPM package into the test workdir. 62 + 63 + :param rpm: path to the rpm archive 64 + :param path: path within the rpm archive of the file to be extracted 65 + needs to be a relative path (starting with './') because 66 + cpio(1), which is used to extract the file, expects that. 67 + :returns: path of the extracted file 68 + """ 69 + cwd = os.getcwd() 70 + os.chdir(self.workdir) 71 + process.run("rpm2cpio %s | cpio -id %s" % (rpm, path), shell=True) 72 + os.chdir(cwd) 73 + return os.path.normpath(os.path.join(self.workdir, path)) 53 74 54 75 def test_x86_64_pc(self): 55 76 """ ··· 304 325 :avocado: tags=arch:arm 305 326 :avocado: tags=machine:emcraft-sf2 306 327 :avocado: tags=endian:little 328 + :avocado: tags=u-boot 307 329 """ 308 330 uboot_url = ('https://raw.githubusercontent.com/' 309 331 'Subbaraya-Sundeep/qemu-test-binaries/' ··· 519 541 520 542 self.vm.set_console() 521 543 kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0' 522 - self.vm.add_args('-vga', 'std', 544 + self.vm.add_args('-nodefaults', 523 545 '-kernel', uncompressed_kernel, 524 546 '-append', kernel_command_line) 525 547 self.vm.launch() ··· 568 590 self.wait_for_console_pattern(console_pattern) 569 591 console_pattern = 'No filesystem could mount root' 570 592 self.wait_for_console_pattern(console_pattern) 593 + 594 + def do_test_advcal_2018(self, day, tar_hash, kernel_name): 595 + tar_url = ('https://www.qemu-advent-calendar.org' 596 + '/2018/download/day' + day + '.tar.xz') 597 + file_path = self.fetch_asset(tar_url, asset_hash=tar_hash) 598 + archive.extract(file_path, self.workdir) 599 + self.vm.set_console() 600 + self.vm.add_args('-kernel', 601 + self.workdir + '/day' + day + '/' + kernel_name) 602 + self.vm.launch() 603 + self.wait_for_console_pattern('QEMU advent calendar') 604 + 605 + def test_arm_vexpressa9(self): 606 + """ 607 + :avocado: tags=arch:arm 608 + :avocado: tags=machine:vexpress-a9 609 + """ 610 + tar_hash = '32b7677ce8b6f1471fb0059865f451169934245b' 611 + self.vm.add_args('-dtb', self.workdir + '/day16/vexpress-v2p-ca9.dtb') 612 + self.do_test_advcal_2018('16', tar_hash, 'winter.zImage') 613 + 614 + def test_m68k_mcf5208evb(self): 615 + """ 616 + :avocado: tags=arch:m68k 617 + :avocado: tags=machine:mcf5208evb 618 + """ 619 + tar_hash = 'ac688fd00561a2b6ce1359f9ff6aa2b98c9a570c' 620 + self.do_test_advcal_2018('07', tar_hash, 'sanity-clause.elf') 621 + 622 + def test_microblaze_s3adsp1800(self): 623 + """ 624 + :avocado: tags=arch:microblaze 625 + :avocado: tags=machine:petalogix-s3adsp1800 626 + """ 627 + tar_hash = '08bf3e3bfb6b6c7ce1e54ab65d54e189f2caf13f' 628 + self.do_test_advcal_2018('17', tar_hash, 'ballerina.bin') 629 + 630 + def test_or1k_sim(self): 631 + """ 632 + :avocado: tags=arch:or1k 633 + :avocado: tags=machine:or1k-sim 634 + """ 635 + tar_hash = '20334cdaf386108c530ff0badaecc955693027dd' 636 + self.do_test_advcal_2018('20', tar_hash, 'vmlinux') 637 + 638 + def test_nios2_10m50(self): 639 + """ 640 + :avocado: tags=arch:nios2 641 + :avocado: tags=machine:10m50-ghrd 642 + """ 643 + tar_hash = 'e4251141726c412ac0407c5a6bceefbbff018918' 644 + self.do_test_advcal_2018('14', tar_hash, 'vmlinux.elf') 645 + 646 + def test_ppc64_e500(self): 647 + """ 648 + :avocado: tags=arch:ppc64 649 + :avocado: tags=machine:ppce500 650 + """ 651 + tar_hash = '6951d86d644b302898da2fd701739c9406527fe1' 652 + self.vm.add_args('-cpu', 'e5500') 653 + self.do_test_advcal_2018('19', tar_hash, 'uImage') 654 + 655 + def test_ppc_g3beige(self): 656 + """ 657 + :avocado: tags=arch:ppc 658 + :avocado: tags=machine:g3beige 659 + """ 660 + tar_hash = 'e0b872a5eb8fdc5bed19bd43ffe863900ebcedfc' 661 + self.vm.add_args('-M', 'graphics=off') 662 + self.do_test_advcal_2018('15', tar_hash, 'invaders.elf') 663 + 664 + def test_ppc_mac99(self): 665 + """ 666 + :avocado: tags=arch:ppc 667 + :avocado: tags=machine:mac99 668 + """ 669 + tar_hash = 'e0b872a5eb8fdc5bed19bd43ffe863900ebcedfc' 670 + self.vm.add_args('-M', 'graphics=off') 671 + self.do_test_advcal_2018('15', tar_hash, 'invaders.elf') 672 + 673 + def test_sparc_ss20(self): 674 + """ 675 + :avocado: tags=arch:sparc 676 + :avocado: tags=machine:SS-20 677 + """ 678 + tar_hash = 'b18550d5d61c7615d989a06edace051017726a9f' 679 + self.do_test_advcal_2018('11', tar_hash, 'zImage.elf') 680 + 681 + def test_xtensa_lx60(self): 682 + """ 683 + :avocado: tags=arch:xtensa 684 + :avocado: tags=machine:lx60 685 + """ 686 + tar_hash = '49e88d9933742f0164b60839886c9739cb7a0d34' 687 + self.vm.add_args('-cpu', 'dc233c') 688 + self.do_test_advcal_2018('02', tar_hash, 'santas-sleigh-ride.elf')
+42 -15
tests/acceptance/migration.py
··· 10 10 # later. See the COPYING file in the top-level directory. 11 11 12 12 13 + import tempfile 13 14 from avocado_qemu import Test 15 + from avocado import skipUnless 14 16 15 17 from avocado.utils import network 16 18 from avocado.utils import wait 19 + from avocado.utils.path import find_command 17 20 18 21 19 22 class Migration(Test): 23 + """ 24 + :avocado: tags=migration 25 + """ 20 26 21 27 timeout = 10 22 28 ··· 24 30 def migration_finished(vm): 25 31 return vm.command('query-migrate')['status'] in ('completed', 'failed') 26 32 33 + def assert_migration(self, src_vm, dst_vm): 34 + wait.wait_for(self.migration_finished, 35 + timeout=self.timeout, 36 + step=0.1, 37 + args=(src_vm,)) 38 + self.assertEqual(src_vm.command('query-migrate')['status'], 'completed') 39 + self.assertEqual(dst_vm.command('query-migrate')['status'], 'completed') 40 + self.assertEqual(dst_vm.command('query-status')['status'], 'running') 41 + self.assertEqual(src_vm.command('query-status')['status'],'postmigrate') 42 + 43 + def do_migrate(self, dest_uri, src_uri=None): 44 + dest_vm = self.get_vm('-incoming', dest_uri) 45 + dest_vm.add_args('-nodefaults') 46 + dest_vm.launch() 47 + if src_uri is None: 48 + src_uri = dest_uri 49 + source_vm = self.get_vm() 50 + source_vm.add_args('-nodefaults') 51 + source_vm.launch() 52 + source_vm.qmp('migrate', uri=src_uri) 53 + self.assert_migration(source_vm, dest_vm) 54 + 27 55 def _get_free_port(self): 28 56 port = network.find_free_port() 29 57 if port is None: ··· 32 60 33 61 34 62 def test_migration_with_tcp_localhost(self): 35 - source_vm = self.get_vm() 36 63 dest_uri = 'tcp:localhost:%u' % self._get_free_port() 37 - dest_vm = self.get_vm('-incoming', dest_uri) 38 - dest_vm.launch() 39 - source_vm.launch() 40 - source_vm.qmp('migrate', uri=dest_uri) 41 - wait.wait_for( 42 - self.migration_finished, 43 - timeout=self.timeout, 44 - step=0.1, 45 - args=(source_vm,) 46 - ) 47 - self.assertEqual(dest_vm.command('query-migrate')['status'], 'completed') 48 - self.assertEqual(source_vm.command('query-migrate')['status'], 'completed') 49 - self.assertEqual(dest_vm.command('query-status')['status'], 'running') 50 - self.assertEqual(source_vm.command('query-status')['status'], 'postmigrate') 64 + self.do_migrate(dest_uri) 65 + 66 + def test_migration_with_unix(self): 67 + with tempfile.TemporaryDirectory(prefix='socket_') as socket_path: 68 + dest_uri = 'unix:%s/qemu-test.sock' % socket_path 69 + self.do_migrate(dest_uri) 70 + 71 + @skipUnless(find_command('nc', default=False), "'nc' command not found") 72 + def test_migration_with_exec(self): 73 + """ 74 + The test works for both netcat-traditional and netcat-openbsd packages 75 + """ 76 + free_port = self._get_free_port() 77 + dest_uri = 'exec:nc -l localhost %u' % free_port
+1
tests/acceptance/version.py
··· 17 17 :avocado: tags=quick 18 18 """ 19 19 def test_qmp_human_info_version(self): 20 + self.vm.add_args('-nodefaults') 20 21 self.vm.launch() 21 22 res = self.vm.command('human-monitor-command', 22 23 command_line='info version')
+144
tests/acceptance/virtio_check_params.py
··· 1 + # 2 + # Test virtio-scsi and virtio-blk queue settings for all machine types 3 + # 4 + # Copyright (c) 2019 Virtuozzo International GmbH 5 + # 6 + # This program is free software; you can redistribute it and/or modify 7 + # it under the terms of the GNU General Public License as published by 8 + # the Free Software Foundation; either version 2 of the License, or 9 + # (at your option) any later version. 10 + # 11 + # This program is distributed in the hope that it will be useful, 12 + # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 + # GNU General Public License for more details. 15 + # 16 + # You should have received a copy of the GNU General Public License 17 + # along with this program. If not, see <http://www.gnu.org/licenses/>. 18 + # 19 + 20 + import sys 21 + import os 22 + import re 23 + import logging 24 + 25 + sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) 26 + from qemu.machine import QEMUMachine 27 + from avocado_qemu import Test 28 + from avocado import skip 29 + 30 + #list of machine types and virtqueue properties to test 31 + VIRTIO_SCSI_PROPS = {'seg_max_adjust': 'seg_max_adjust'} 32 + VIRTIO_BLK_PROPS = {'seg_max_adjust': 'seg-max-adjust'} 33 + 34 + DEV_TYPES = {'virtio-scsi-pci': VIRTIO_SCSI_PROPS, 35 + 'virtio-blk-pci': VIRTIO_BLK_PROPS} 36 + 37 + VM_DEV_PARAMS = {'virtio-scsi-pci': ['-device', 'virtio-scsi-pci,id=scsi0'], 38 + 'virtio-blk-pci': ['-device', 39 + 'virtio-blk-pci,id=scsi0,drive=drive0', 40 + '-drive', 41 + 'driver=null-co,id=drive0,if=none']} 42 + 43 + 44 + class VirtioMaxSegSettingsCheck(Test): 45 + @staticmethod 46 + def make_pattern(props): 47 + pattern_items = ['{0} = \w+'.format(prop) for prop in props] 48 + return '|'.join(pattern_items) 49 + 50 + def query_virtqueue(self, vm, dev_type_name): 51 + query_ok = False 52 + error = None 53 + props = None 54 + 55 + output = vm.command('human-monitor-command', 56 + command_line = 'info qtree') 57 + props_list = DEV_TYPES[dev_type_name].values(); 58 + pattern = self.make_pattern(props_list) 59 + res = re.findall(pattern, output) 60 + 61 + if len(res) != len(props_list): 62 + props_list = set(props_list) 63 + res = set(res) 64 + not_found = props_list.difference(res) 65 + not_found = ', '.join(not_found) 66 + error = '({0}): The following properties not found: {1}'\ 67 + .format(dev_type_name, not_found) 68 + else: 69 + query_ok = True 70 + props = dict() 71 + for prop in res: 72 + p = prop.split(' = ') 73 + props[p[0]] = p[1] 74 + return query_ok, props, error 75 + 76 + def check_mt(self, mt, dev_type_name): 77 + mt['device'] = dev_type_name # Only for the debug() call. 78 + logger = logging.getLogger('machine') 79 + logger.debug(mt) 80 + with QEMUMachine(self.qemu_bin) as vm: 81 + vm.set_machine(mt["name"]) 82 + vm.add_args('-nodefaults') 83 + for s in VM_DEV_PARAMS[dev_type_name]: 84 + vm.add_args(s) 85 + try: 86 + vm.launch() 87 + query_ok, props, error = self.query_virtqueue(vm, dev_type_name) 88 + except: 89 + query_ok = False 90 + error = sys.exc_info()[0] 91 + 92 + if not query_ok: 93 + self.fail('machine type {0}: {1}'.format(mt['name'], error)) 94 + 95 + for prop_name, prop_val in props.items(): 96 + expected_val = mt[prop_name] 97 + self.assertEqual(expected_val, prop_val) 98 + 99 + @staticmethod 100 + def seg_max_adjust_enabled(mt): 101 + # machine types >= 5.0 should have seg_max_adjust = true 102 + # others seg_max_adjust = false 103 + mt = mt.split("-") 104 + 105 + # machine types with one line name and name like pc-x.x 106 + if len(mt) <= 2: 107 + return False 108 + 109 + # machine types like pc-<chip_name>-x.x[.x] 110 + ver = mt[2] 111 + ver = ver.split("."); 112 + 113 + # versions >= 5.0 goes with seg_max_adjust enabled 114 + major = int(ver[0]) 115 + 116 + if major >= 5: 117 + return True 118 + return False 119 + 120 + @skip("break multi-arch CI") 121 + def test_machine_types(self): 122 + # collect all machine types except 'none', 'isapc', 'microvm' 123 + with QEMUMachine(self.qemu_bin) as vm: 124 + vm.launch() 125 + machines = [m['name'] for m in vm.command('query-machines')] 126 + vm.shutdown() 127 + machines.remove('none') 128 + machines.remove('isapc') 129 + machines.remove('microvm') 130 + 131 + for dev_type in DEV_TYPES: 132 + # create the list of machine types and their parameters. 133 + mtypes = list() 134 + for m in machines: 135 + if self.seg_max_adjust_enabled(m): 136 + enabled = 'true' 137 + else: 138 + enabled = 'false' 139 + mtypes.append({'name': m, 140 + DEV_TYPES[dev_type]['seg_max_adjust']: enabled}) 141 + 142 + # test each machine type for a device type 143 + for mt in mtypes: 144 + self.check_mt(mt, dev_type)
-134
tests/acceptance/virtio_seg_max_adjust.py
··· 1 - #!/usr/bin/env python 2 - # 3 - # Test virtio-scsi and virtio-blk queue settings for all machine types 4 - # 5 - # Copyright (c) 2019 Virtuozzo International GmbH 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 - import sys 22 - import os 23 - import re 24 - 25 - sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) 26 - from qemu.machine import QEMUMachine 27 - from avocado_qemu import Test 28 - 29 - #list of machine types and virtqueue properties to test 30 - VIRTIO_SCSI_PROPS = {'seg_max_adjust': 'seg_max_adjust'} 31 - VIRTIO_BLK_PROPS = {'seg_max_adjust': 'seg-max-adjust'} 32 - 33 - DEV_TYPES = {'virtio-scsi-pci': VIRTIO_SCSI_PROPS, 34 - 'virtio-blk-pci': VIRTIO_BLK_PROPS} 35 - 36 - VM_DEV_PARAMS = {'virtio-scsi-pci': ['-device', 'virtio-scsi-pci,id=scsi0'], 37 - 'virtio-blk-pci': ['-device', 38 - 'virtio-blk-pci,id=scsi0,drive=drive0', 39 - '-drive', 40 - 'driver=null-co,id=drive0,if=none']} 41 - 42 - 43 - class VirtioMaxSegSettingsCheck(Test): 44 - @staticmethod 45 - def make_pattern(props): 46 - pattern_items = ['{0} = \w+'.format(prop) for prop in props] 47 - return '|'.join(pattern_items) 48 - 49 - def query_virtqueue(self, vm, dev_type_name): 50 - query_ok = False 51 - error = None 52 - props = None 53 - 54 - output = vm.command('human-monitor-command', 55 - command_line = 'info qtree') 56 - props_list = DEV_TYPES[dev_type_name].values(); 57 - pattern = self.make_pattern(props_list) 58 - res = re.findall(pattern, output) 59 - 60 - if len(res) != len(props_list): 61 - props_list = set(props_list) 62 - res = set(res) 63 - not_found = props_list.difference(res) 64 - not_found = ', '.join(not_found) 65 - error = '({0}): The following properties not found: {1}'\ 66 - .format(dev_type_name, not_found) 67 - else: 68 - query_ok = True 69 - props = dict() 70 - for prop in res: 71 - p = prop.split(' = ') 72 - props[p[0]] = p[1] 73 - return query_ok, props, error 74 - 75 - def check_mt(self, mt, dev_type_name): 76 - with QEMUMachine(self.qemu_bin) as vm: 77 - vm.set_machine(mt["name"]) 78 - for s in VM_DEV_PARAMS[dev_type_name]: 79 - vm.add_args(s) 80 - vm.launch() 81 - query_ok, props, error = self.query_virtqueue(vm, dev_type_name) 82 - 83 - if not query_ok: 84 - self.fail('machine type {0}: {1}'.format(mt['name'], error)) 85 - 86 - for prop_name, prop_val in props.items(): 87 - expected_val = mt[prop_name] 88 - self.assertEqual(expected_val, prop_val) 89 - 90 - @staticmethod 91 - def seg_max_adjust_enabled(mt): 92 - # machine types >= 5.0 should have seg_max_adjust = true 93 - # others seg_max_adjust = false 94 - mt = mt.split("-") 95 - 96 - # machine types with one line name and name like pc-x.x 97 - if len(mt) <= 2: 98 - return False 99 - 100 - # machine types like pc-<chip_name>-x.x[.x] 101 - ver = mt[2] 102 - ver = ver.split("."); 103 - 104 - # versions >= 5.0 goes with seg_max_adjust enabled 105 - major = int(ver[0]) 106 - 107 - if major >= 5: 108 - return True 109 - return False 110 - 111 - def test_machine_types(self): 112 - # collect all machine types except 'none', 'isapc', 'microvm' 113 - with QEMUMachine(self.qemu_bin) as vm: 114 - vm.launch() 115 - machines = [m['name'] for m in vm.command('query-machines')] 116 - vm.shutdown() 117 - machines.remove('none') 118 - machines.remove('isapc') 119 - machines.remove('microvm') 120 - 121 - for dev_type in DEV_TYPES: 122 - # create the list of machine types and their parameters. 123 - mtypes = list() 124 - for m in machines: 125 - if self.seg_max_adjust_enabled(m): 126 - enabled = 'true' 127 - else: 128 - enabled = 'false' 129 - mtypes.append({'name': m, 130 - DEV_TYPES[dev_type]['seg_max_adjust']: enabled}) 131 - 132 - # test each machine type for a device type 133 - for mt in mtypes: 134 - self.check_mt(mt, dev_type)
-1
tests/acceptance/x86_cpu_model_versions.py
··· 1 - #!/usr/bin/env python 2 1 # 3 2 # Basic validation of x86 versioned CPU models and CPU model aliases 4 3 #
+1 -2
tests/docker/travis.py
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Travis YAML config parser 4 4 # ··· 11 11 # or (at your option) any later version. See the COPYING file in 12 12 # the top-level directory. 13 13 14 - from __future__ import print_function 15 14 import sys 16 15 import yaml 17 16 import itertools
-1
tests/guest-debug/test-gdbstub.py
··· 1 - from __future__ import print_function 2 1 # 3 2 # This script needs to be run on startup 4 3 # qemu -kernel ${KERNEL} -s -S
-1
tests/migration/guestperf/engine.py
··· 1 - from __future__ import print_function 2 1 # 3 2 # Migration test main engine 4 3 #
-1
tests/migration/guestperf/plot.py
··· 1 - from __future__ import print_function 2 1 # 3 2 # Migration test graph plotting 4 3 #
-1
tests/migration/guestperf/shell.py
··· 1 - from __future__ import print_function 2 1 # 3 2 # Migration test command line shell integration 4 3 #
+1 -2
tests/qapi-schema/test-qapi.py
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # QAPI parser test harness 4 4 # ··· 11 11 # See the COPYING file in the top-level directory. 12 12 # 13 13 14 - from __future__ import print_function 15 14 16 15 import argparse 17 16 import difflib
+1 -1
tests/qemu-iotests/030
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Tests for image streaming. 4 4 #
+1 -1
tests/qemu-iotests/040
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Tests for image block commit. 4 4 #
+1 -1
tests/qemu-iotests/041
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Tests for image mirroring. 4 4 #
+1 -1
tests/qemu-iotests/044
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Tests growing a large refcount table. 4 4 #
+1 -1
tests/qemu-iotests/045
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Tests for fdsets and getfd. 4 4 #
+1 -1
tests/qemu-iotests/055
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Tests for drive-backup and blockdev-backup 4 4 #
+1 -1
tests/qemu-iotests/056
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Tests for drive-backup 4 4 #
+1 -1
tests/qemu-iotests/057
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Tests for internal snapshot. 4 4 #
+1 -1
tests/qemu-iotests/065
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Test for additional information emitted by qemu-img info on qcow2 4 4 # images
+1 -1
tests/qemu-iotests/093
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Tests for IO throttling 4 4 #
+1 -1
tests/qemu-iotests/096
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Test that snapshots move the throttling configuration to the active 4 4 # layer
+1 -1
tests/qemu-iotests/118
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Test case for the QMP 'change' command and all other associated 4 4 # commands
+1 -1
tests/qemu-iotests/124
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Tests for incremental drive-backup 4 4 #
+1 -1
tests/qemu-iotests/129
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Tests that "bdrv_drain_all" doesn't drain block jobs 4 4 #
+1 -1
tests/qemu-iotests/132
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Test mirror with unmap 4 4 #
+1 -1
tests/qemu-iotests/136
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Tests for block device statistics 4 4 #
+1 -1
tests/qemu-iotests/139
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Test cases for the QMP 'blockdev-del' command 4 4 #
+1 -1
tests/qemu-iotests/147
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Test case for NBD's blockdev-add interface 4 4 #
+1 -1
tests/qemu-iotests/148
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Test the rate limit of QMP events 4 4 #
+1 -2
tests/qemu-iotests/149
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Copyright (C) 2016 Red Hat, Inc. 4 4 # ··· 20 20 # Exercise the QEMU 'luks' block driver to validate interoperability 21 21 # with the Linux dm-crypt + cryptsetup implementation 22 22 23 - from __future__ import print_function 24 23 import subprocess 25 24 import os 26 25 import os.path
+1 -1
tests/qemu-iotests/151
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Tests for active mirroring 4 4 #
+1 -1
tests/qemu-iotests/152
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Tests for drive-mirror with source size unaligned to granularity 4 4 #
+1 -1
tests/qemu-iotests/155
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Test whether the backing BDSs are correct after completion of a 4 4 # mirror block job; in "existing" modes (drive-mirror with
+1 -1
tests/qemu-iotests/163
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Tests for shrinking images 4 4 #
+1 -2
tests/qemu-iotests/165
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Tests for persistent dirty bitmaps. 4 4 # ··· 18 18 # along with this program. If not, see <http://www.gnu.org/licenses/>. 19 19 # 20 20 21 - from __future__ import print_function 22 21 import os 23 22 import re 24 23 import iotests
+1 -1
tests/qemu-iotests/169
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Tests for dirty bitmaps migration. 4 4 #
+1 -1
tests/qemu-iotests/194
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Copyright (C) 2017 Red Hat, Inc. 4 4 #
+1 -1
tests/qemu-iotests/196
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Test clearing unknown autoclear_features flag by qcow2 after 4 4 # migration. This test mimics migration to older qemu.
+1 -1
tests/qemu-iotests/199
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Tests for dirty bitmaps postcopy migration. 4 4 #
+1 -1
tests/qemu-iotests/202
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Copyright (C) 2017 Red Hat, Inc. 4 4 #
+1 -1
tests/qemu-iotests/203
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Copyright (C) 2017 Red Hat, Inc. 4 4 #
+1 -1
tests/qemu-iotests/205
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Tests for qmp command nbd-server-remove. 4 4 #
+1 -1
tests/qemu-iotests/206
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Test qcow2 and file image creation 4 4 #
+1 -1
tests/qemu-iotests/207
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Test ssh image creation 4 4 #
+1 -1
tests/qemu-iotests/208
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Copyright (C) 2018 Red Hat, Inc. 4 4 #
+1 -1
tests/qemu-iotests/209
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Tests for NBD BLOCK_STATUS extension 4 4 #
+1 -1
tests/qemu-iotests/210
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Test luks and file image creation 4 4 #
+1 -1
tests/qemu-iotests/211
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Test VDI and file image creation 4 4 #
+1 -1
tests/qemu-iotests/212
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Test parallels and file image creation 4 4 #
+1 -1
tests/qemu-iotests/213
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Test vhdx and file image creation 4 4 #
+1 -1
tests/qemu-iotests/216
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Copy-on-read tests using a COR filter node 4 4 #
+1 -1
tests/qemu-iotests/218
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # This test covers what happens when a mirror block job is cancelled 4 4 # in various phases of its existence.
+1 -1
tests/qemu-iotests/219
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Copyright (C) 2018 Red Hat, Inc. 4 4 #
+1 -1
tests/qemu-iotests/222
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # This test covers the basic fleecing workflow, which provides a 4 4 # point-in-time snapshot of a node that can be queried over NBD.
+1 -1
tests/qemu-iotests/224
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Test json:{} filenames with qemu-internal BDSs 4 4 # (the one of commit, to be precise)
+1 -1
tests/qemu-iotests/228
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Test for when a backing file is considered overridden (thus, a 4 4 # json:{} filename is generated for the overlay) and when it is not
+1 -1
tests/qemu-iotests/234
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Copyright (C) 2018 Red Hat, Inc. 4 4 #
+1 -1
tests/qemu-iotests/235
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Simple mirror test 4 4 #
+1 -1
tests/qemu-iotests/236
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Test bitmap merges. 4 4 #
+1 -1
tests/qemu-iotests/237
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Test vmdk and file image creation 4 4 #
+1 -1
tests/qemu-iotests/238
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Regression test for throttle group member unregister segfault with iothread 4 4 #
+1 -1
tests/qemu-iotests/242
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Test for qcow2 bitmap printed information 4 4 #
+1 -1
tests/qemu-iotests/245
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Test cases for the QMP 'x-blockdev-reopen' command 4 4 #
+1 -1
tests/qemu-iotests/246
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Test persistent bitmap resizing. 4 4 #
+1 -1
tests/qemu-iotests/248
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Test resume mirror after auto pause on ENOSPC 4 4 #
+1 -1
tests/qemu-iotests/254
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Test external snapshot with bitmap copying and moving. 4 4 #
+1 -1
tests/qemu-iotests/255
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Test commit job graph modifications while requests are active 4 4 #
+1 -1
tests/qemu-iotests/256
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Test incremental/backup across iothread contexts 4 4 #
+1 -1
tests/qemu-iotests/257
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Test bitmap-sync backups (incremental, differential, and partials) 4 4 #
+1 -1
tests/qemu-iotests/258
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Very specific tests for adjacent commit/stream block jobs 4 4 #
+1 -1
tests/qemu-iotests/260
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Tests for temporary external snapshot when we have bitmaps. 4 4 #
+1 -1
tests/qemu-iotests/262
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Copyright (C) 2019 Red Hat, Inc. 4 4 #
+1 -1
tests/qemu-iotests/264
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Test nbd reconnect 4 4 #
+1 -1
tests/qemu-iotests/266
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Test VPC and file image creation 4 4 #
+1 -1
tests/qemu-iotests/277
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Test NBD client reconnection 4 4 #
+1 -1
tests/qemu-iotests/280
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Copyright (C) 2019 Red Hat, Inc. 4 4 #
+1 -1
tests/qemu-iotests/281
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Test cases for blockdev + IOThread interactions 4 4 #
+1 -1
tests/qemu-iotests/283
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Test for backup-top filter permission activation failure 4 4 #
+1 -1
tests/qemu-iotests/check
··· 846 846 847 847 start=$(_wallclock) 848 848 849 - if [ "$(head -n 1 "$source_iotests/$seq")" == "#!/usr/bin/env python" ]; then 849 + if [ "$(head -n 1 "$source_iotests/$seq")" == "#!/usr/bin/env python3" ]; then 850 850 if $python_usable; then 851 851 run_command="$PYTHON $seq" 852 852 else
-1
tests/qemu-iotests/iotests.py
··· 1 - from __future__ import print_function 2 1 # Common utilities and Python wrappers for qemu-iotests 3 2 # 4 3 # Copyright (C) 2012 IBM Corp.
+1 -2
tests/qemu-iotests/nbd-fault-injector.py
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # NBD server - fault injection utility 3 3 # 4 4 # Configuration file syntax: ··· 43 43 # This work is licensed under the terms of the GNU GPL, version 2 or later. 44 44 # See the COPYING file in the top-level directory. 45 45 46 - from __future__ import print_function 47 46 import sys 48 47 import socket 49 48 import struct
+1 -2
tests/qemu-iotests/qcow2.py
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 3 - from __future__ import print_function 4 3 import sys 5 4 import struct 6 5 import string
+1 -2
tests/qemu-iotests/qed.py
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Tool to manipulate QED image files 4 4 # ··· 10 10 # This work is licensed under the terms of the GNU GPL, version 2 or later. 11 11 # See the COPYING file in the top-level directory. 12 12 13 - from __future__ import print_function 14 13 import sys 15 14 import struct 16 15 import random
-2
tests/vm/basevm.py
··· 1 - #!/usr/bin/env python 2 1 # 3 2 # VM testing base class 4 3 # ··· 12 11 # the COPYING file in the top-level directory. 13 12 # 14 13 15 - from __future__ import print_function 16 14 import os 17 15 import re 18 16 import sys
+1 -1
tests/vm/centos
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # CentOS image 4 4 #
+1 -1
tests/vm/fedora
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Fedora VM image 4 4 #
+1 -1
tests/vm/freebsd
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # FreeBSD VM image 4 4 #
+1 -1
tests/vm/netbsd
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # NetBSD VM image 4 4 #
+1 -1
tests/vm/openbsd
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # OpenBSD VM image 4 4 #
+1 -1
tests/vm/ubuntu.i386
··· 1 - #!/usr/bin/env python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Ubuntu i386 image 4 4 #