From 10e163c0395f5c9460ec2f2fe7947a1d056cda30 Mon Sep 17 00:00:00 2001 From: Wainer dos Santos Moschetta Date: Fri, 27 Dec 2019 10:40:57 -0300 Subject: [PATCH 01/46] python/qemu: qmp: Replace socket.error with OSError MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The socket.error is deprecated from Python 3.3, instead it is made a link to OSError. This change replaces the occurences of socket.error with OSError. Signed-off-by: Wainer dos Santos Moschetta Reviewed-by: John Snow Message-Id: <20191227134101.244496-2-wainersm@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- python/qemu/qmp.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/python/qemu/qmp.py b/python/qemu/qmp.py index 5c8cf6a056..8c6c9847d0 100644 --- a/python/qemu/qmp.py +++ b/python/qemu/qmp.py @@ -47,7 +47,7 @@ class QEMUMonitorProtocol(object): or a tuple in the form ( address, port ) for a TCP connection @param server: server mode listens on the socket (bool) - @raise socket.error on socket connection errors + @raise OSError on socket connection errors @note No connection is established, this is done by the connect() or accept() methods """ @@ -107,8 +107,8 @@ class QEMUMonitorProtocol(object): self.__sock.setblocking(0) try: self.__json_read() - except socket.error as err: - if err[0] == errno.EAGAIN: + except OSError as err: + if err.errno == errno.EAGAIN: # No data available pass self.__sock.setblocking(1) @@ -133,7 +133,7 @@ class QEMUMonitorProtocol(object): Connect to the QMP Monitor and perform capabilities negotiation. @return QMP greeting dict - @raise socket.error on socket connection errors + @raise OSError on socket connection errors @raise QMPConnectError if the greeting is not received @raise QMPCapabilitiesError if fails to negotiate capabilities """ @@ -147,7 +147,7 @@ class QEMUMonitorProtocol(object): Await connection from QMP Monitor and perform capabilities negotiation. @return QMP greeting dict - @raise socket.error on socket connection errors + @raise OSError on socket connection errors @raise QMPConnectError if the greeting is not received @raise QMPCapabilitiesError if fails to negotiate capabilities """ @@ -167,10 +167,10 @@ class QEMUMonitorProtocol(object): self.logger.debug(">>> %s", qmp_cmd) try: self.__sock.sendall(json.dumps(qmp_cmd).encode('utf-8')) - except socket.error as err: - if err[0] == errno.EPIPE: + except OSError as err: + if err.errno == errno.EPIPE: return - raise socket.error(err) + raise err resp = self.__json_read() self.logger.debug("<<< %s", resp) return resp From a0a261e47252f2b7b44cbb0999cdafeb6b01bdbb Mon Sep 17 00:00:00 2001 From: Wainer dos Santos Moschetta Date: Fri, 27 Dec 2019 10:40:58 -0300 Subject: [PATCH 02/46] python/qemu: Delint the qmp module MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This clean up the pylint-3 report on qmp: ************* Module qemu.qmp python/qemu/qmp.py:1:0: C0111: Missing module docstring (missing-docstring) python/qemu/qmp.py:17:0: C0111: Missing class docstring (missing-docstring) python/qemu/qmp.py:21:0: C0111: Missing class docstring (missing-docstring) python/qemu/qmp.py:25:0: C0111: Missing class docstring (missing-docstring) python/qemu/qmp.py:29:0: C0111: Missing class docstring (missing-docstring) python/qemu/qmp.py:33:0: C0111: Missing class docstring (missing-docstring) python/qemu/qmp.py:33:0: R0205: Class 'QEMUMonitorProtocol' inherits from object, can be safely removed from bases in python3 (useless-object-inheritance) python/qemu/qmp.py:80:4: R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements) python/qemu/qmp.py:131:4: R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements) python/qemu/qmp.py:159:4: R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements) python/qemu/qmp.py:245:4: C0111: Missing method docstring (missing-docstring) python/qemu/qmp.py:249:4: C0111: Missing method docstring (missing-docstring) python/qemu/qmp.py:252:4: C0111: Missing method docstring (missing-docstring) python/qemu/qmp.py:255:4: C0111: Missing method docstring (missing-docstring) Signed-off-by: Wainer dos Santos Moschetta Reviewed-by: John Snow Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20191227134101.244496-3-wainersm@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- python/qemu/qmp.py | 51 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 41 insertions(+), 10 deletions(-) diff --git a/python/qemu/qmp.py b/python/qemu/qmp.py index 8c6c9847d0..f4e04a6683 100644 --- a/python/qemu/qmp.py +++ b/python/qemu/qmp.py @@ -1,5 +1,4 @@ -# QEMU Monitor Protocol Python class -# +""" QEMU Monitor Protocol Python class """ # Copyright (C) 2009, 2010 Red Hat Inc. # # Authors: @@ -15,22 +14,34 @@ import logging class QMPError(Exception): - pass + """ + QMP base exception + """ class QMPConnectError(QMPError): - pass + """ + QMP connection exception + """ class QMPCapabilitiesError(QMPError): - pass + """ + QMP negotiate capabilities exception + """ class QMPTimeoutError(QMPError): - pass + """ + QMP timeout exception + """ -class QEMUMonitorProtocol(object): +class QEMUMonitorProtocol: + """ + Provide an API to connect to QEMU via QEMU Monitor Protocol (QMP) and then + allow to handle commands and events. + """ #: Logger object for debugging messages logger = logging.getLogger('QMP') @@ -81,7 +92,7 @@ class QEMUMonitorProtocol(object): while True: data = self.__sockfile.readline() if not data: - return + return None resp = json.loads(data) if 'event' in resp: self.logger.debug("<<< %s", resp) @@ -132,7 +143,7 @@ class QEMUMonitorProtocol(object): """ Connect to the QMP Monitor and perform capabilities negotiation. - @return QMP greeting dict + @return QMP greeting dict, or None if negotiate is false @raise OSError on socket connection errors @raise QMPConnectError if the greeting is not received @raise QMPCapabilitiesError if fails to negotiate capabilities @@ -141,6 +152,7 @@ class QEMUMonitorProtocol(object): self.__sockfile = self.__sock.makefile() if negotiate: return self.__negotiate_capabilities() + return None def accept(self): """ @@ -169,7 +181,7 @@ class QEMUMonitorProtocol(object): self.__sock.sendall(json.dumps(qmp_cmd).encode('utf-8')) except OSError as err: if err.errno == errno.EPIPE: - return + return None raise err resp = self.__json_read() self.logger.debug("<<< %s", resp) @@ -243,14 +255,33 @@ class QEMUMonitorProtocol(object): self.__events = [] def close(self): + """ + Close the socket and socket file. + """ self.__sock.close() self.__sockfile.close() def settimeout(self, timeout): + """ + Set the socket timeout. + + @param timeout (float): timeout in seconds, or None. + @note This is a wrap around socket.settimeout + """ self.__sock.settimeout(timeout) def get_sock_fd(self): + """ + Get the socket file descriptor. + + @return The file descriptor number. + """ return self.__sock.fileno() def is_scm_available(self): + """ + Check if the socket allows for SCM_RIGHTS. + + @return True if SCM_RIGHTS is available, otherwise False. + """ return self.__sock.family == socket.AF_UNIX From 54aafc2fc65231871e744308705c4aa6d283a22d Mon Sep 17 00:00:00 2001 From: Wainer dos Santos Moschetta Date: Tue, 4 Feb 2020 11:11:09 -0300 Subject: [PATCH 03/46] python/qemu: qmp: Make accept()'s timeout configurable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently the timeout of QEMUMonitorProtocol.accept() is hard-coded to 15.0 seconds. This added the parameter `timeout` so the value can be configured by the user. Signed-off-by: Wainer dos Santos Moschetta Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: John Snow Message-Id: <20200204141111.3207-4-wainersm@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- python/qemu/qmp.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/python/qemu/qmp.py b/python/qemu/qmp.py index f4e04a6683..0e07d80e2a 100644 --- a/python/qemu/qmp.py +++ b/python/qemu/qmp.py @@ -154,16 +154,23 @@ class QEMUMonitorProtocol: return self.__negotiate_capabilities() return None - def accept(self): + def accept(self, timeout=15.0): """ Await connection from QMP Monitor and perform capabilities negotiation. + @param timeout: timeout in seconds (nonnegative float number, or + None). The value passed will set the behavior of the + underneath QMP socket as described in [1]. Default value + is set to 15.0. @return QMP greeting dict @raise OSError on socket connection errors @raise QMPConnectError if the greeting is not received @raise QMPCapabilitiesError if fails to negotiate capabilities + + [1] + https://docs.python.org/3/library/socket.html#socket.socket.settimeout """ - self.__sock.settimeout(15) + self.__sock.settimeout(timeout) self.__sock, _ = self.__sock.accept() self.__sockfile = self.__sock.makefile() return self.__negotiate_capabilities() From 07608e807d4e7bd2daa7fe154bd9dc2235c1a323 Mon Sep 17 00:00:00 2001 From: Wainer dos Santos Moschetta Date: Tue, 4 Feb 2020 11:11:10 -0300 Subject: [PATCH 04/46] python/qemu: qmp: Make QEMUMonitorProtocol a context manager MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This implement the __enter__ and __exit__ functions on QEMUMonitorProtocol class so that it can be used on 'with' statement and the resources will be free up on block end: with QEMUMonitorProtocol(socket_path) as qmp: qmp.connect() qmp.command('query-status') Signed-off-by: Wainer dos Santos Moschetta Reviewed-by: John Snow Message-Id: <20200204141111.3207-5-wainersm@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- python/qemu/qmp.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/python/qemu/qmp.py b/python/qemu/qmp.py index 0e07d80e2a..486a566da0 100644 --- a/python/qemu/qmp.py +++ b/python/qemu/qmp.py @@ -139,6 +139,15 @@ class QEMUMonitorProtocol: raise QMPConnectError("Error while reading from socket") self.__sock.settimeout(None) + def __enter__(self): + # Implement context manager enter function. + return self + + def __exit__(self, exc_type, exc_value, exc_traceback): + # Implement context manager exit function. + self.close() + return False + def connect(self, negotiate=True): """ Connect to the QMP Monitor and perform capabilities negotiation. @@ -265,8 +274,10 @@ class QEMUMonitorProtocol: """ Close the socket and socket file. """ - self.__sock.close() - self.__sockfile.close() + if self.__sock: + self.__sock.close() + if self.__sockfile: + self.__sockfile.close() def settimeout(self, timeout): """ From 50d189c97ab8ed3de80d0ed22a867e1d5361fd02 Mon Sep 17 00:00:00 2001 From: Wainer dos Santos Moschetta Date: Fri, 27 Dec 2019 10:41:01 -0300 Subject: [PATCH 05/46] python/qemu: qmp: Remove unnused attributes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `error` and `timeout` attributes in QEMUMonitorProtocol are not used, so this delete them. Signed-off-by: Wainer dos Santos Moschetta Reviewed-by: John Snow Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20191227134101.244496-6-wainersm@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- python/qemu/qmp.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/python/qemu/qmp.py b/python/qemu/qmp.py index 486a566da0..4b9a362240 100644 --- a/python/qemu/qmp.py +++ b/python/qemu/qmp.py @@ -45,10 +45,6 @@ class QEMUMonitorProtocol: #: Logger object for debugging messages logger = logging.getLogger('QMP') - #: Socket's error class - error = socket.error - #: Socket's timeout - timeout = socket.timeout def __init__(self, address, server=False): """ From 51aa9d127d4ecaaaf6dfa10da130e3974b0e5286 Mon Sep 17 00:00:00 2001 From: Wainer dos Santos Moschetta Date: Wed, 5 Feb 2020 15:32:46 -0500 Subject: [PATCH 06/46] python/qemu: accel: Fix kvm_available() on ppc64le MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On ppc64le, the accel.kvm_available() check may wrongly return False because the host arch (as returned by os.uname[4]) and the target arch (ppc64) mismatch. In order to solve this it is added an ppc64le -> ppc64 mapping which is used as an fallback verification. Fixes: 53a049d7d78e5ccf6d4c0d7 Signed-off-by: Wainer dos Santos Moschetta Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20200205203250.30526-5-wainersm@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- python/qemu/accel.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/qemu/accel.py b/python/qemu/accel.py index 0b38ddf0ab..36ae85791e 100644 --- a/python/qemu/accel.py +++ b/python/qemu/accel.py @@ -24,7 +24,8 @@ LOG = logging.getLogger(__name__) # support which often includes its 32 bit cousin. ADDITIONAL_ARCHES = { "x86_64" : "i386", - "aarch64" : "armhf" + "aarch64" : "armhf", + "ppc64le" : "ppc64", } def list_accel(qemu_bin): From a1e8bd2f5c2a7b42b243c9422f3a86e530665e9f Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Thu, 9 Jan 2020 10:51:16 +0100 Subject: [PATCH 07/46] qemu-deprecated: Remove text about Python 2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Python 2 support has been removed, so we should now also remove the announcement text for the deprecation. Signed-off-by: Thomas Huth Reviewed by: Aleksandar Markovic Reviewed-by: John Snow Message-Id: <20200109095116.18201-1-thuth@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- qemu-deprecated.texi | 8 -------- 1 file changed, 8 deletions(-) diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi index ea3e10bde3..97668edf92 100644 --- a/qemu-deprecated.texi +++ b/qemu-deprecated.texi @@ -351,14 +351,6 @@ they have no effect when used with @option{-n} to skip image creation. Silently ignored options can be confusing, so this combination of options will be made an error in future versions. -@section Build system - -@subsection Python 2 support (since 4.1.0) - -In the future, QEMU will require Python 3 to be available at -build time. Support for Python 2 in scripts shipped with QEMU -is deprecated. - @section Backwards compatibility @subsection Runnability guarantee of CPU models (since 4.1.0) From 52c68b8abb614a744fd1d2099bbb3768a6aad8ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Doktor?= Date: Mon, 20 Jan 2020 08:12:02 +0100 Subject: [PATCH 08/46] python: Treat None-return of greeting cmd MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In case qemu process dies the "monitor.cmd" returns None which gets passed to the "__negotiate_capabilities" and leads to unhandled exception. Let's only check the resp in case it has a value. Signed-off-by: Lukáš Doktor Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Wainer dos Santos Moschetta Message-Id: <20200120071202.30646-1-ldoktor@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- python/qemu/qmp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/qemu/qmp.py b/python/qemu/qmp.py index 4b9a362240..f40586eedd 100644 --- a/python/qemu/qmp.py +++ b/python/qemu/qmp.py @@ -80,7 +80,7 @@ class QEMUMonitorProtocol: raise QMPConnectError # Greeting seems ok, negotiate capabilities resp = self.cmd('qmp_capabilities') - if "return" in resp: + if resp and "return" in resp: return greeting raise QMPCapabilitiesError From 746f244d9720233f42a5a5745e28a4fac9fe8395 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Tue, 21 Jan 2020 00:51:56 +0100 Subject: [PATCH 09/46] python/qemu/machine: Allow to use other serial consoles than default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently the QEMU Python module limits the QEMUMachine class to use the first serial console. Some machines/guest might use another console than the first one as the 'boot console'. For example the Raspberry Pi uses the second (AUX) console. To be able to use the Nth console as default, we simply need to connect all the N - 1 consoles to the null chardev. Add an index argument, so we can use a specific serial console as default. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Liam Merwick Tested-by: Liam Merwick Reviewed-by: Wainer dos Santos Moschetta Message-Id: <20200120235159.18510-5-f4bug@amsat.org> [PMD: zero-initialize _console_index in __init__()] Signed-off-by: Philippe Mathieu-Daudé --- python/qemu/machine.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/python/qemu/machine.py b/python/qemu/machine.py index 734efd8536..183d8f3d38 100644 --- a/python/qemu/machine.py +++ b/python/qemu/machine.py @@ -112,6 +112,7 @@ class QEMUMachine(object): self._sock_dir = sock_dir self._launched = False self._machine = None + self._console_index = 0 self._console_set = False self._console_device_type = None self._console_address = None @@ -241,6 +242,8 @@ class QEMUMachine(object): 'chardev=mon,mode=control']) if self._machine is not None: args.extend(['-machine', self._machine]) + for i in range(self._console_index): + args.extend(['-serial', 'null']) if self._console_set: self._console_address = os.path.join(self._sock_dir, self._name + "-console.sock") @@ -527,7 +530,7 @@ class QEMUMachine(object): """ self._machine = machine_type - def set_console(self, device_type=None): + def set_console(self, device_type=None, console_index=0): """ Sets the device type for a console device @@ -548,9 +551,14 @@ class QEMUMachine(object): chardev:console" command line argument will be used instead, resorting to the machine's default device type. + @param console_index: the index of the console device to use. + If not zero, the command line will create + 'index - 1' consoles and connect them to + the 'null' backing character device. """ self._console_set = True self._console_device_type = device_type + self._console_index = console_index @property def console_socket(self): From a91ba1d3ef321bd7e1d7fd0a90e3f74dad4f5826 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Tue, 21 Jan 2020 00:51:54 +0100 Subject: [PATCH 10/46] Acceptance tests: Extract _console_interaction() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since we are going to re-use the code shared between wait_for_console_pattern() and exec_command_and_wait_for_pattern(), extract the common part into a local function. Tested-by: Niek Linnenbank Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Liam Merwick Tested-by: Liam Merwick Reviewed-by: Wainer dos Santos Moschetta Message-Id: <20200120235159.18510-3-f4bug@amsat.org> Signed-off-by: Philippe Mathieu-Daudé --- tests/acceptance/avocado_qemu/__init__.py | 31 +++++++++++++---------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py index 6618ea67c1..0a50fcf2be 100644 --- a/tests/acceptance/avocado_qemu/__init__.py +++ b/tests/acceptance/avocado_qemu/__init__.py @@ -55,19 +55,14 @@ def pick_default_qemu_bin(arch=None): return qemu_bin_from_src_dir_path -def wait_for_console_pattern(test, success_message, failure_message=None): - """ - Waits for messages to appear on the console, while logging the content - - :param test: an Avocado test containing a VM that will have its console - read and probed for a success or failure message - :type test: :class:`avocado_qemu.Test` - :param success_message: if this message appears, test succeeds - :param failure_message: if this message appears, test fails - """ +def _console_interaction(test, success_message, failure_message, + send_string): console = test.vm.console_socket.makefile() console_logger = logging.getLogger('console') while True: + if send_string: + test.vm.console_socket.sendall(send_string.encode()) + send_string = None # send only once msg = console.readline().strip() if not msg: continue @@ -79,6 +74,17 @@ def wait_for_console_pattern(test, success_message, failure_message=None): fail = 'Failure message found in console: %s' % failure_message test.fail(fail) +def wait_for_console_pattern(test, success_message, failure_message=None): + """ + Waits for messages to appear on the console, while logging the content + + :param test: an Avocado test containing a VM that will have its console + read and probed for a success or failure message + :type test: :class:`avocado_qemu.Test` + :param success_message: if this message appears, test succeeds + :param failure_message: if this message appears, test fails + """ + _console_interaction(test, success_message, failure_message, None) def exec_command_and_wait_for_pattern(test, command, success_message, failure_message=None): @@ -94,10 +100,7 @@ def exec_command_and_wait_for_pattern(test, command, :param success_message: if this message appears, test succeeds :param failure_message: if this message appears, test fails """ - command += '\r' - test.vm.console_socket.sendall(command.encode()) - wait_for_console_pattern(test, success_message, failure_message) - + _console_interaction(test, success_message, failure_message, command + '\r') class Test(avocado.Test): def _get_unique_tag_val(self, tag_name): From 647eb26a6c356e8fc1b5e36d0db047c25c1eafd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Tue, 21 Jan 2020 00:51:55 +0100 Subject: [PATCH 11/46] Acceptance tests: Add interrupt_interactive_console_until_pattern() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We need a function to interrupt interactive consoles. Example: Interrupt U-Boot to set different environment values. Tested-by: Niek Linnenbank Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Liam Merwick Tested-by: Liam Merwick Reviewed-by: Wainer dos Santos Moschetta Message-Id: <20200120235159.18510-4-f4bug@amsat.org> Signed-off-by: Philippe Mathieu-Daudé --- tests/acceptance/avocado_qemu/__init__.py | 32 +++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py index 0a50fcf2be..d4358eb431 100644 --- a/tests/acceptance/avocado_qemu/__init__.py +++ b/tests/acceptance/avocado_qemu/__init__.py @@ -56,13 +56,15 @@ def pick_default_qemu_bin(arch=None): def _console_interaction(test, success_message, failure_message, - send_string): + send_string, keep_sending=False): + assert not keep_sending or send_string console = test.vm.console_socket.makefile() console_logger = logging.getLogger('console') while True: if send_string: test.vm.console_socket.sendall(send_string.encode()) - send_string = None # send only once + if not keep_sending: + send_string = None # send only once msg = console.readline().strip() if not msg: continue @@ -74,6 +76,32 @@ def _console_interaction(test, success_message, failure_message, fail = 'Failure message found in console: %s' % failure_message test.fail(fail) +def interrupt_interactive_console_until_pattern(test, success_message, + failure_message=None, + interrupt_string='\r'): + """ + Keep sending a string to interrupt a console prompt, while logging the + console output. Typical use case is to break a boot loader prompt, such: + + Press a key within 5 seconds to interrupt boot process. + 5 + 4 + 3 + 2 + 1 + Booting default image... + + :param test: an Avocado test containing a VM that will have its console + read and probed for a success or failure message + :type test: :class:`avocado_qemu.Test` + :param success_message: if this message appears, test succeeds + :param failure_message: if this message appears, test fails + :param interrupt_string: a string to send to the console before trying + to read a new line + """ + _console_interaction(test, success_message, failure_message, + interrupt_string, True) + def wait_for_console_pattern(test, success_message, failure_message=None): """ Waits for messages to appear on the console, while logging the content From 8a837088928401f2daf7b41a5230361f183c1794 Mon Sep 17 00:00:00 2001 From: Liam Merwick Date: Wed, 5 Feb 2020 14:56:02 +0000 Subject: [PATCH 12/46] travis.yml: install rpm2cpio for acceptance tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The extract_from_rpm() method added for the PVH acceptance tests needs rpm2cpio to extract a vmlinux binary from an RPM. Signed-off-by: Liam Merwick Reviewed-by: Stefano Garzarella Reviewed-by: Philippe Mathieu-Daudé Message-Id: <1580914565-19675-4-git-send-email-liam.merwick@oracle.com> Signed-off-by: Philippe Mathieu-Daudé --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 6c0ec6cf69..54e1d12762 100644 --- a/.travis.yml +++ b/.travis.yml @@ -323,6 +323,7 @@ matrix: - python3-pil - python3-pip - python3.5-venv + - rpm2cpio - tesseract-ocr - tesseract-ocr-eng From 76a901d295fcb1984ba0ddc9cc334d922e35f7c7 Mon Sep 17 00:00:00 2001 From: Liam Merwick Date: Wed, 5 Feb 2020 14:56:03 +0000 Subject: [PATCH 13/46] tests/boot_linux_console: add extract_from_rpm method MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a method to extract a specified file from an RPM to the test's working directory and return the path to the extracted file. Signed-off-by: Liam Merwick Reviewed-by: Stefano Garzarella Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Message-Id: <1580914565-19675-5-git-send-email-liam.merwick@oracle.com> [PMD: Rebased] Signed-off-by: Philippe Mathieu-Daudé --- tests/acceptance/boot_linux_console.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py index e40b84651b..16b7503b5f 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -51,6 +51,22 @@ class BootLinuxConsole(Test): os.chdir(cwd) return self.workdir + path + def extract_from_rpm(self, rpm, path): + """ + Extracts a file from an RPM package into the test workdir. + + :param rpm: path to the rpm archive + :param path: path within the rpm archive of the file to be extracted + needs to be a relative path (starting with './') because + cpio(1), which is used to extract the file, expects that. + :returns: path of the extracted file + """ + cwd = os.getcwd() + os.chdir(self.workdir) + process.run("rpm2cpio %s | cpio -id %s" % (rpm, path), shell=True) + os.chdir(cwd) + return os.path.normpath(os.path.join(self.workdir, path)) + def test_x86_64_pc(self): """ :avocado: tags=arch:x86_64 From 921a9f6db831fb299dcd5336b1861659b02c3964 Mon Sep 17 00:00:00 2001 From: Liam Merwick Date: Wed, 5 Feb 2020 14:56:05 +0000 Subject: [PATCH 14/46] tests/boot_linux_console: use os.path for filesystem paths MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change extract_from_deb() to use os.path routines to manipulate the filesystem path returned when extracting a file. Suggested-by: Wainer dos Santos Moschetta Signed-off-by: Liam Merwick Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Message-Id: <1580914565-19675-7-git-send-email-liam.merwick@oracle.com> Signed-off-by: Philippe Mathieu-Daudé --- tests/acceptance/boot_linux_console.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py index 16b7503b5f..dca0a940ab 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -49,7 +49,12 @@ class BootLinuxConsole(Test): process.run("ar x %s %s" % (deb, file_path)) archive.extract(file_path, self.workdir) os.chdir(cwd) - return self.workdir + path + # Return complete path to extracted file. Because callers to + # extract_from_deb() specify 'path' with a leading slash, it is + # necessary to use os.path.relpath() as otherwise os.path.join() + # interprets it as an absolute path and drops the self.workdir part. + return os.path.normpath(os.path.join(self.workdir, + os.path.relpath(path, '/'))) def extract_from_rpm(self, rpm, path): """ From 45260388727542264d2e09a9013a4e09c45dbe02 Mon Sep 17 00:00:00 2001 From: Liam Merwick Date: Mon, 27 Jan 2020 16:36:31 +0000 Subject: [PATCH 15/46] tests/boot_linux_console: fix extract_from_deb() comment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The second param in extract_from_deb() is 'path' not 'file' Signed-off-by: Liam Merwick Reviewed-by: Stefano Garzarella Reviewed-by: Wainer dos Santos Moschetta Reviewed-by: Philippe Mathieu-Daudé Message-Id: <1580142994-1836-4-git-send-email-liam.merwick@oracle.com> Signed-off-by: Philippe Mathieu-Daudé --- tests/acceptance/boot_linux_console.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py index dca0a940ab..d22cd67a6e 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -40,7 +40,7 @@ class BootLinuxConsole(Test): Extracts a file from a deb package into the test workdir :param deb: path to the deb archive - :param file: path within the deb archive of the file to be extracted + :param path: path within the deb archive of the file to be extracted :returns: path of the extracted file """ cwd = os.getcwd() From b6f0a43463a142f0052ddf08811e5845ce88cf24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Tue, 21 Jan 2020 00:51:59 +0100 Subject: [PATCH 16/46] tests/boot_linux_console: Tag Emcraft Smartfusion2 as running 'u-boot' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Avocado tags are handy to automatically select tests matching the tags. Since this test also runs U-Boot, tag it. We can run all the tests using U-Boot as once with: $ avocado --show=app run -t u-boot tests/acceptance/ JOB LOG : avocado/job-results/job-2020-01-21T00.16-ee9344e/job.log (1/3) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_emcraft_sf2: PASS (16.59 s) (2/3) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_raspi2_uboot: PASS (0.47 s) (3/3) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_aarch64_raspi3_uboot: PASS (2.43 s) RESULTS : PASS 3 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0 JOB TIME : 19.78 s Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Wainer dos Santos Moschetta Message-Id: <20200120235159.18510-8-f4bug@amsat.org> Signed-off-by: Philippe Mathieu-Daudé --- tests/acceptance/boot_linux_console.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py index d22cd67a6e..a6191ee410 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -325,6 +325,7 @@ class BootLinuxConsole(Test): :avocado: tags=arch:arm :avocado: tags=machine:emcraft-sf2 :avocado: tags=endian:little + :avocado: tags=u-boot """ uboot_url = ('https://raw.githubusercontent.com/' 'Subbaraya-Sundeep/qemu-test-binaries/' From b0065e1f197bfd104343911e352c89d8b7eba7b5 Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Fri, 24 Jan 2020 18:03:25 +0100 Subject: [PATCH 17/46] tests/acceptance: Add boot tests for some of the QEMU advent calendar images MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 2018 edition of the QEMU advent calendar 2018 featured Linux images for various non-x86 machines. We can use them for a boot tests in our acceptance test suite. Let's also make sure that we build the corresponding machines in Travis. Signed-off-by: Thomas Huth Reviewed-by: Liam Merwick Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Reviewed-by: Wainer dos Santos Moschetta Message-Id: <20200124170325.30072-1-thuth@redhat.com> [PMD: Rebased, --python=python3 parameter dropped in commit 5311cb12e] Signed-off-by: Philippe Mathieu-Daudé --- .travis.yml | 2 +- tests/acceptance/boot_linux_console.py | 96 ++++++++++++++++++++++++++ 2 files changed, 97 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 54e1d12762..5887055951 100644 --- a/.travis.yml +++ b/.travis.yml @@ -313,7 +313,7 @@ matrix: # Acceptance (Functional) tests - name: "GCC check-acceptance" env: - - 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" + - 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" - TEST_CMD="make check-acceptance" after_script: - 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 diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py index a6191ee410..a6ce917e45 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -590,3 +590,99 @@ class BootLinuxConsole(Test): self.wait_for_console_pattern(console_pattern) console_pattern = 'No filesystem could mount root' self.wait_for_console_pattern(console_pattern) + + def do_test_advcal_2018(self, day, tar_hash, kernel_name): + tar_url = ('https://www.qemu-advent-calendar.org' + '/2018/download/day' + day + '.tar.xz') + file_path = self.fetch_asset(tar_url, asset_hash=tar_hash) + archive.extract(file_path, self.workdir) + self.vm.set_console() + self.vm.add_args('-kernel', + self.workdir + '/day' + day + '/' + kernel_name) + self.vm.launch() + self.wait_for_console_pattern('QEMU advent calendar') + + def test_arm_vexpressa9(self): + """ + :avocado: tags=arch:arm + :avocado: tags=machine:vexpress-a9 + """ + tar_hash = '32b7677ce8b6f1471fb0059865f451169934245b' + self.vm.add_args('-dtb', self.workdir + '/day16/vexpress-v2p-ca9.dtb') + self.do_test_advcal_2018('16', tar_hash, 'winter.zImage') + + def test_m68k_mcf5208evb(self): + """ + :avocado: tags=arch:m68k + :avocado: tags=machine:mcf5208evb + """ + tar_hash = 'ac688fd00561a2b6ce1359f9ff6aa2b98c9a570c' + self.do_test_advcal_2018('07', tar_hash, 'sanity-clause.elf') + + def test_microblaze_s3adsp1800(self): + """ + :avocado: tags=arch:microblaze + :avocado: tags=machine:petalogix-s3adsp1800 + """ + tar_hash = '08bf3e3bfb6b6c7ce1e54ab65d54e189f2caf13f' + self.do_test_advcal_2018('17', tar_hash, 'ballerina.bin') + + def test_or1k_sim(self): + """ + :avocado: tags=arch:or1k + :avocado: tags=machine:or1k-sim + """ + tar_hash = '20334cdaf386108c530ff0badaecc955693027dd' + self.do_test_advcal_2018('20', tar_hash, 'vmlinux') + + def test_nios2_10m50(self): + """ + :avocado: tags=arch:nios2 + :avocado: tags=machine:10m50-ghrd + """ + tar_hash = 'e4251141726c412ac0407c5a6bceefbbff018918' + self.do_test_advcal_2018('14', tar_hash, 'vmlinux.elf') + + def test_ppc64_e500(self): + """ + :avocado: tags=arch:ppc64 + :avocado: tags=machine:ppce500 + """ + tar_hash = '6951d86d644b302898da2fd701739c9406527fe1' + self.vm.add_args('-cpu', 'e5500') + self.do_test_advcal_2018('19', tar_hash, 'uImage') + + def test_ppc_g3beige(self): + """ + :avocado: tags=arch:ppc + :avocado: tags=machine:g3beige + """ + tar_hash = 'e0b872a5eb8fdc5bed19bd43ffe863900ebcedfc' + self.vm.add_args('-M', 'graphics=off') + self.do_test_advcal_2018('15', tar_hash, 'invaders.elf') + + def test_ppc_mac99(self): + """ + :avocado: tags=arch:ppc + :avocado: tags=machine:mac99 + """ + tar_hash = 'e0b872a5eb8fdc5bed19bd43ffe863900ebcedfc' + self.vm.add_args('-M', 'graphics=off') + self.do_test_advcal_2018('15', tar_hash, 'invaders.elf') + + def test_sparc_ss20(self): + """ + :avocado: tags=arch:sparc + :avocado: tags=machine:SS-20 + """ + tar_hash = 'b18550d5d61c7615d989a06edace051017726a9f' + self.do_test_advcal_2018('11', tar_hash, 'zImage.elf') + + def test_xtensa_lx60(self): + """ + :avocado: tags=arch:xtensa + :avocado: tags=machine:lx60 + """ + tar_hash = '49e88d9933742f0164b60839886c9739cb7a0d34' + self.vm.add_args('-cpu', 'dc233c') + self.do_test_advcal_2018('02', tar_hash, 'santas-sleigh-ride.elf') From 47d4c6e696699337a7ec062f4f54f6c187a94034 Mon Sep 17 00:00:00 2001 From: Denis Plotnikov Date: Wed, 29 Jan 2020 22:23:31 +0100 Subject: [PATCH 18/46] tests: rename virtio_seg_max_adjust to virtio_check_params MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since, virtio_seg_max_adjust checks not only seg_max, but also virtqueue_size parameter, let's make the test more general and add new parameters to be checked there in the future. Signed-off-by: Denis Plotnikov Message-Id: <20200129140702.5411-5-dplotnikov@virtuozzo.com> Acked-by: Cornelia Huck Signed-off-by: Philippe Mathieu-Daudé --- .../{virtio_seg_max_adjust.py => virtio_check_params.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/acceptance/{virtio_seg_max_adjust.py => virtio_check_params.py} (100%) diff --git a/tests/acceptance/virtio_seg_max_adjust.py b/tests/acceptance/virtio_check_params.py similarity index 100% rename from tests/acceptance/virtio_seg_max_adjust.py rename to tests/acceptance/virtio_check_params.py From 0400937be151f6fe7f4fc0e3f0bbad43f623ef89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Wed, 29 Jan 2020 22:23:33 +0100 Subject: [PATCH 19/46] tests/acceptance/virtio_check_params: Improve exception logging MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20200129212345.20547-18-philmd@redhat.com> Reviewed-by: Eduardo Habkost Signed-off-by: Philippe Mathieu-Daudé --- tests/acceptance/virtio_check_params.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/acceptance/virtio_check_params.py b/tests/acceptance/virtio_check_params.py index 5458573138..270f69d092 100755 --- a/tests/acceptance/virtio_check_params.py +++ b/tests/acceptance/virtio_check_params.py @@ -77,8 +77,12 @@ class VirtioMaxSegSettingsCheck(Test): vm.set_machine(mt["name"]) for s in VM_DEV_PARAMS[dev_type_name]: vm.add_args(s) - vm.launch() - query_ok, props, error = self.query_virtqueue(vm, dev_type_name) + try: + vm.launch() + query_ok, props, error = self.query_virtqueue(vm, dev_type_name) + except: + query_ok = False + error = sys.exc_info()[0] if not query_ok: self.fail('machine type {0}: {1}'.format(mt['name'], error)) From e435f66bd33bd2e4847e6882918e1a016d757eab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Wed, 29 Jan 2020 22:23:34 +0100 Subject: [PATCH 20/46] tests/acceptance/virtio_check_params: List machine being tested MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add logging for easier debugging of failures: $ avocado --show=machine run tests/acceptance/virtio_check_params.py (1/1) tests/acceptance/virtio_check_params.py:VirtioMaxSegSettingsCheck.test_machine_types: machine: {'name': 'pc-i440fx-2.12', 'seg_max_adjust': 'false', 'device': 'virtio-scsi-pci'} machine: {'name': 'pc-i440fx-2.0', 'seg_max_adjust': 'false', 'device': 'virtio-scsi-pci'} machine: {'name': 'pc-q35-4.2', 'seg_max_adjust': 'false', 'device': 'virtio-scsi-pci'} machine: {'name': 'pc-i440fx-2.5', 'seg_max_adjust': 'false', 'device': 'virtio-scsi-pci'} machine: {'name': 'pc-i440fx-4.2', 'seg_max_adjust': 'false', 'device': 'virtio-scsi-pci'} ... Reviewed-by: Cornelia Huck Message-Id: <20200129212345.20547-19-philmd@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- tests/acceptance/virtio_check_params.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/acceptance/virtio_check_params.py b/tests/acceptance/virtio_check_params.py index 270f69d092..29e91bfa37 100755 --- a/tests/acceptance/virtio_check_params.py +++ b/tests/acceptance/virtio_check_params.py @@ -21,6 +21,7 @@ import sys import os import re +import logging sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) from qemu.machine import QEMUMachine @@ -73,6 +74,9 @@ class VirtioMaxSegSettingsCheck(Test): return query_ok, props, error def check_mt(self, mt, dev_type_name): + mt['device'] = dev_type_name # Only for the debug() call. + logger = logging.getLogger('machine') + logger.debug(mt) with QEMUMachine(self.qemu_bin) as vm: vm.set_machine(mt["name"]) for s in VM_DEV_PARAMS[dev_type_name]: From 77f50e826faeb5e7c511e9d99adfbd086ffbff4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Wed, 29 Jan 2020 22:23:40 +0100 Subject: [PATCH 21/46] tests/acceptance/virtio_check_params: Default to -nodefaults MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We don't need the default options to run this test. This fixes errors when running a binary built with --without-default-devices such: ERROR: qemu-system-s390x: Unknown device 'virtio-net-ccw' for bus 'virtual-css-bus' Reviewed-by: Thomas Huth Message-Id: <20200129212345.20547-25-philmd@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- tests/acceptance/virtio_check_params.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/acceptance/virtio_check_params.py b/tests/acceptance/virtio_check_params.py index 29e91bfa37..22792d4ec6 100755 --- a/tests/acceptance/virtio_check_params.py +++ b/tests/acceptance/virtio_check_params.py @@ -79,6 +79,7 @@ class VirtioMaxSegSettingsCheck(Test): logger.debug(mt) with QEMUMachine(self.qemu_bin) as vm: vm.set_machine(mt["name"]) + vm.add_args('-nodefaults') for s in VM_DEV_PARAMS[dev_type_name]: vm.add_args(s) try: From 2d6a6e238a2297d92a81eb3425fc8228614ada9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Thu, 6 Feb 2020 18:17:15 +0100 Subject: [PATCH 22/46] tests/acceptance/virtio_check_params: Disable the test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This test fails on various CI: - Using QEMU 4.0: tests/acceptance/x86_cpu_model_versions.py:X86CPUModelAliases.test_none_alias: ERROR: 'alias-of' (0.45 s) - On OSX Unexpected error in object_property_find() at qom/object.c:1201: qemu-system-x86_64: -device virtio-blk-pci,id=scsi0,drive=drive0: can't apply global virtio-blk-device.scsi=true: Property '.scsi' not found - When removing unavailable machine: VirtioMaxSegSettingsCheck.test_machine_types: ERROR: list.remove(x): x not in list (0.12 s) - Using Xen: xencall: error: Could not obtain handle on privileged command interface: No such file or directory xen be core: xen be core: can't open xen interface - On PPC: TestFail: machine type pseries-2.8: No Transactional Memory support in TCG, try appending -machine cap-htm=off - On S390X configured with --without-default-devices: ERROR: qemu-system-s390x: -device virtio-scsi-pci,id=scsi0: 'virtio-scsi-pci' is not a valid device model name Disable it for now. Cc: Denis Plotnikov Acked-by: Cornelia Huck Message-Id: <20200206171715.25041-1-philmd@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- tests/acceptance/virtio_check_params.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/acceptance/virtio_check_params.py b/tests/acceptance/virtio_check_params.py index 22792d4ec6..c3af8dbf9f 100755 --- a/tests/acceptance/virtio_check_params.py +++ b/tests/acceptance/virtio_check_params.py @@ -26,6 +26,7 @@ import logging sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) from qemu.machine import QEMUMachine from avocado_qemu import Test +from avocado import skip #list of machine types and virtqueue properties to test VIRTIO_SCSI_PROPS = {'seg_max_adjust': 'seg_max_adjust'} @@ -117,6 +118,7 @@ class VirtioMaxSegSettingsCheck(Test): return True return False + @skip("break multi-arch CI") def test_machine_types(self): # collect all machine types except 'none', 'isapc', 'microvm' with QEMUMachine(self.qemu_bin) as vm: From 1d77f1b14f9923dd511f07438ed2f778e3868f40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Wed, 29 Jan 2020 22:23:42 +0100 Subject: [PATCH 23/46] tests/acceptance/boot_linux_console: Do not use VGA on Clipper machine MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As we only read the serial console, we don't need to force a VGA display. This fixes when running a binary built with --without-default-devices: ERROR: qemu-system-alpha: standard VGA not available We also need the '-nodefaults' argument to avoid: ERROR: qemu-system-alpha: Unsupported NIC model: e1000 Reviewed-by: Thomas Huth Message-Id: <20200129212345.20547-27-philmd@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- tests/acceptance/boot_linux_console.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py index a6ce917e45..34d37eba3b 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -541,7 +541,7 @@ class BootLinuxConsole(Test): self.vm.set_console() kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0' - self.vm.add_args('-vga', 'std', + self.vm.add_args('-nodefaults', '-kernel', uncompressed_kernel, '-append', kernel_command_line) self.vm.launch() From b79e55f09b0b7c23517a3224b0e6953849e1b889 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Wed, 29 Jan 2020 22:23:44 +0100 Subject: [PATCH 24/46] tests/acceptance/version: Default to -nodefaults MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We don't need the default options to run this test. This fixes errors when running a binary built with --without-default-devices such: ERROR: qemu-system-arm: Unsupported NIC model: virtio-net-pci Reviewed-by: Thomas Huth Reviewed-by: Wainer dos Santos Moschetta Message-Id: <20200129212345.20547-29-philmd@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- tests/acceptance/version.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/acceptance/version.py b/tests/acceptance/version.py index 67c2192c93..79b923d4fc 100644 --- a/tests/acceptance/version.py +++ b/tests/acceptance/version.py @@ -17,6 +17,7 @@ class Version(Test): :avocado: tags=quick """ def test_qmp_human_info_version(self): + self.vm.add_args('-nodefaults') self.vm.launch() res = self.vm.command('human-monitor-command', command_line='info version') From d7c9a83344d955300262bba3d7c455a8cfd6f6e0 Mon Sep 17 00:00:00 2001 From: Oksana Vohchana Date: Mon, 3 Feb 2020 13:16:30 +0200 Subject: [PATCH 25/46] tests/acceptance/migration: Factor out assert_migration() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We are going to reuse this code when testing different transport methods, so factor it out first Signed-off-by: Oksana Vohchana Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20200203111631.18796-2-ovoshcha@redhat.com> [PMD: Split patch in 2, reworded subject and description] Signed-off-by: Philippe Mathieu-Daudé --- tests/acceptance/migration.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/tests/acceptance/migration.py b/tests/acceptance/migration.py index a44c1ae58f..3db733b1ce 100644 --- a/tests/acceptance/migration.py +++ b/tests/acceptance/migration.py @@ -24,6 +24,16 @@ class Migration(Test): def migration_finished(vm): return vm.command('query-migrate')['status'] in ('completed', 'failed') + def assert_migration(self, src_vm, dst_vm): + wait.wait_for(self.migration_finished, + timeout=self.timeout, + step=0.1, + args=(src_vm,)) + self.assertEqual(src_vm.command('query-migrate')['status'], 'completed') + self.assertEqual(dst_vm.command('query-migrate')['status'], 'completed') + self.assertEqual(dst_vm.command('query-status')['status'], 'running') + self.assertEqual(src_vm.command('query-status')['status'],'postmigrate') + def _get_free_port(self): port = network.find_free_port() if port is None: @@ -38,13 +48,4 @@ class Migration(Test): dest_vm.launch() source_vm.launch() source_vm.qmp('migrate', uri=dest_uri) - wait.wait_for( - self.migration_finished, - timeout=self.timeout, - step=0.1, - args=(source_vm,) - ) - self.assertEqual(dest_vm.command('query-migrate')['status'], 'completed') - self.assertEqual(source_vm.command('query-migrate')['status'], 'completed') - self.assertEqual(dest_vm.command('query-status')['status'], 'running') - self.assertEqual(source_vm.command('query-status')['status'], 'postmigrate') + self.assert_migration(source_vm, dest_vm) From 63adf16d4fc422405dd116829368c2480cbc67b5 Mon Sep 17 00:00:00 2001 From: Oksana Vohchana Date: Mon, 3 Feb 2020 13:16:30 +0200 Subject: [PATCH 26/46] tests/acceptance/migration: Factor out do_migrate() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We are going to reuse this code when testing different transport methods, so factor it out first. Signed-off-by: Oksana Vohchana Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20200203111631.18796-2-ovoshcha@redhat.com> [PMD: Split patch in 2, reworded subject and description] Signed-off-by: Philippe Mathieu-Daudé --- tests/acceptance/migration.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/tests/acceptance/migration.py b/tests/acceptance/migration.py index 3db733b1ce..03686d7de3 100644 --- a/tests/acceptance/migration.py +++ b/tests/acceptance/migration.py @@ -34,6 +34,16 @@ class Migration(Test): self.assertEqual(dst_vm.command('query-status')['status'], 'running') self.assertEqual(src_vm.command('query-status')['status'],'postmigrate') + def do_migrate(self, dest_uri, src_uri=None): + source_vm = self.get_vm() + dest_vm = self.get_vm('-incoming', dest_uri) + dest_vm.launch() + if src_uri is None: + src_uri = dest_uri + source_vm.launch() + source_vm.qmp('migrate', uri=src_uri) + self.assert_migration(source_vm, dest_vm) + def _get_free_port(self): port = network.find_free_port() if port is None: @@ -42,10 +52,5 @@ class Migration(Test): def test_migration_with_tcp_localhost(self): - source_vm = self.get_vm() dest_uri = 'tcp:localhost:%u' % self._get_free_port() - dest_vm = self.get_vm('-incoming', dest_uri) - dest_vm.launch() - source_vm.launch() - source_vm.qmp('migrate', uri=dest_uri) - self.assert_migration(source_vm, dest_vm) + self.do_migrate(dest_uri) From b2cf8d470476348b21e8e51fc8d53c3435da244a Mon Sep 17 00:00:00 2001 From: Oksana Vohchana Date: Mon, 3 Feb 2020 13:16:31 +0200 Subject: [PATCH 27/46] tests/acceptance/migration: Test UNIX transport when migrating MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Along with VM migration via TCP, we can use migration through the UNIX transport protocol Signed-off-by: Oksana Vohchana Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20200203111631.18796-3-ovoshcha@redhat.com> [PMD: Split patch in 2, reworded subject and description] Signed-off-by: Philippe Mathieu-Daudé --- tests/acceptance/migration.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/acceptance/migration.py b/tests/acceptance/migration.py index 03686d7de3..9eebc36b8f 100644 --- a/tests/acceptance/migration.py +++ b/tests/acceptance/migration.py @@ -10,6 +10,7 @@ # later. See the COPYING file in the top-level directory. +import tempfile from avocado_qemu import Test from avocado.utils import network @@ -54,3 +55,8 @@ class Migration(Test): def test_migration_with_tcp_localhost(self): dest_uri = 'tcp:localhost:%u' % self._get_free_port() self.do_migrate(dest_uri) + + def test_migration_with_unix(self): + with tempfile.TemporaryDirectory(prefix='socket_') as socket_path: + dest_uri = 'unix:%s/qemu-test.sock' % socket_path + self.do_migrate(dest_uri) From 2e768cb682bfe34cf535def50bba90281ea35c88 Mon Sep 17 00:00:00 2001 From: Oksana Vohchana Date: Mon, 3 Feb 2020 13:16:31 +0200 Subject: [PATCH 28/46] tests/acceptance/migration: Test EXEC transport when migrating MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Along with VM migration via TCP, we can use migration through the EXEC transport protocol Signed-off-by: Oksana Vohchana Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20200203111631.18796-3-ovoshcha@redhat.com> [PMD: Split patch in 2, reworded subject and description] Signed-off-by: Philippe Mathieu-Daudé --- tests/acceptance/migration.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/acceptance/migration.py b/tests/acceptance/migration.py index 9eebc36b8f..41b13b9e0d 100644 --- a/tests/acceptance/migration.py +++ b/tests/acceptance/migration.py @@ -12,9 +12,11 @@ import tempfile from avocado_qemu import Test +from avocado import skipUnless from avocado.utils import network from avocado.utils import wait +from avocado.utils.path import find_command class Migration(Test): @@ -60,3 +62,11 @@ class Migration(Test): with tempfile.TemporaryDirectory(prefix='socket_') as socket_path: dest_uri = 'unix:%s/qemu-test.sock' % socket_path self.do_migrate(dest_uri) + + @skipUnless(find_command('nc', default=False), "'nc' command not found") + def test_migration_with_exec(self): + """ + The test works for both netcat-traditional and netcat-openbsd packages + """ + free_port = self._get_free_port() + dest_uri = 'exec:nc -l localhost %u' % free_port From a09186494321f7307b14ac1d80aea515ea88bbe3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Tue, 4 Feb 2020 17:33:04 +0100 Subject: [PATCH 29/46] tests/acceptance/migration: Add the 'migration' tag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit By using an Avocado tag, we can run all tests described by that tag as once: $ avocado --show=app run -t migration tests/acceptance/ JOB ID : 165477737509503fcfa6d7108057a0a18f2a6559 JOB LOG : avocado/job-results/job-2020-02-04T17.29-1654777/job.log (1/3) tests/acceptance/migration.py:Migration.test_migration_with_tcp_localhost: PASS (0.38 s) (2/3) tests/acceptance/migration.py:Migration.test_migration_with_unix: PASS (0.33 s) (3/3) tests/acceptance/migration.py:Migration.test_migration_with_exec: PASS (0.07 s) RESULTS : PASS 3 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0 Reviewed-by: Wainer dos Santos Moschetta Message-Id: <20200204163304.14616-1-philmd@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- tests/acceptance/migration.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/acceptance/migration.py b/tests/acceptance/migration.py index 41b13b9e0d..b342cabe07 100644 --- a/tests/acceptance/migration.py +++ b/tests/acceptance/migration.py @@ -20,6 +20,9 @@ from avocado.utils.path import find_command class Migration(Test): + """ + :avocado: tags=migration + """ timeout = 10 From 5427ecd4aba2858e3ba2a433ccf1c81d66d0218f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Wed, 29 Jan 2020 22:23:43 +0100 Subject: [PATCH 30/46] tests/acceptance/migration: Default to -nodefaults MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We don't need the default options to run this test. This fixes errors when running a binary built with --without-default-devices such: ERROR: qemu-system-arm: Unsupported NIC model: virtio-net-pci Reviewed-by: Thomas Huth Reviewed-by: Wainer dos Santos Moschetta Message-Id: <20200129212345.20547-28-philmd@redhat.com> [PMD: Rebased] Signed-off-by: Philippe Mathieu-Daudé --- tests/acceptance/migration.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/acceptance/migration.py b/tests/acceptance/migration.py index b342cabe07..a8367ca023 100644 --- a/tests/acceptance/migration.py +++ b/tests/acceptance/migration.py @@ -41,11 +41,13 @@ class Migration(Test): self.assertEqual(src_vm.command('query-status')['status'],'postmigrate') def do_migrate(self, dest_uri, src_uri=None): - source_vm = self.get_vm() dest_vm = self.get_vm('-incoming', dest_uri) + dest_vm.add_args('-nodefaults') dest_vm.launch() if src_uri is None: src_uri = dest_uri + source_vm = self.get_vm() + source_vm.add_args('-nodefaults') source_vm.launch() source_vm.qmp('migrate', uri=src_uri) self.assert_migration(source_vm, dest_vm) From bc7f3b0b0d33fb58272a98c862dc9a1fa913fcd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Thu, 30 Jan 2020 17:32:21 +0100 Subject: [PATCH 31/46] scripts/checkpatch.pl: Only allow Python 3 interpreter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since commit ddf9069963 QEMU requires Python >= 3.5. PEP 0394 [*] states that 'python3' should be available and that 'python' is optional. To avoid problem with unsupported versions, enforce the shebang interpreter to Python 3. [*] https://www.python.org/dev/peps/pep-0394/ Reported-by: John Snow Acked-by: Paolo Bonzini Message-Id: <20200130163232.10446-2-philmd@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- scripts/checkpatch.pl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 3aef6e3dfe..ce43a306f8 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -1460,6 +1460,12 @@ sub process { } } +# Only allow Python 3 interpreter + if ($realline == 1 && + $line =~ /^\+#!\ *\/usr\/bin\/(?:env )?python$/) { + ERROR("please use python3 interpreter\n" . $herecurr); + } + # Accept git diff extended headers as valid patches if ($line =~ /^(?:rename|copy) (?:from|to) [\w\/\.\-]+\s*$/) { $is_patch = 1; From 15b015690b62c7c463fa6f5cdb2bc669749eefc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Thu, 30 Jan 2020 17:32:22 +0100 Subject: [PATCH 32/46] tests/qemu-iotests/check: Allow use of python3 interpreter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As we want to enforce a unique and explicit Python 3 interpreter, we need let this script handle 'python3' too. Suggested-by: Kevin Wolf Acked-by: Paolo Bonzini Message-Id: <20200130163232.10446-3-philmd@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- tests/qemu-iotests/check | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check index fff5fa956a..1789ada52e 100755 --- a/tests/qemu-iotests/check +++ b/tests/qemu-iotests/check @@ -846,7 +846,8 @@ do start=$(_wallclock) - if [ "$(head -n 1 "$source_iotests/$seq")" == "#!/usr/bin/env python" ]; then + if [ "$(head -n 1 "$source_iotests/$seq" | sed 's/3$//')" \ + == "#!/usr/bin/env python" ]; then if $python_usable; then run_command="$PYTHON $seq" else From 903cb1bf398666014180d00711e2c1a9ffdadd5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Thu, 30 Jan 2020 17:32:23 +0100 Subject: [PATCH 33/46] tests/qemu-iotests: Explicit usage of Python 3 (scripts with __main__) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use the program search path to find the Python 3 interpreter. Patch created mechanically by running: $ sed -i "s,^#\!/usr/bin/\(env\ \)\?python$,#\!/usr/bin/env python3," \ $(git grep -l 'if __name__.*__main__') Reported-by: Vladimir Sementsov-Ogievskiy Suggested-by: Daniel P. Berrangé Suggested-by: Stefan Hajnoczi Acked-by: Stefan Hajnoczi Acked-by: Paolo Bonzini Message-Id: <20200130163232.10446-4-philmd@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- tests/qemu-iotests/030 | 2 +- tests/qemu-iotests/040 | 2 +- tests/qemu-iotests/041 | 2 +- tests/qemu-iotests/044 | 2 +- tests/qemu-iotests/045 | 2 +- tests/qemu-iotests/055 | 2 +- tests/qemu-iotests/056 | 2 +- tests/qemu-iotests/057 | 2 +- tests/qemu-iotests/065 | 2 +- tests/qemu-iotests/093 | 2 +- tests/qemu-iotests/096 | 2 +- tests/qemu-iotests/118 | 2 +- tests/qemu-iotests/124 | 2 +- tests/qemu-iotests/129 | 2 +- tests/qemu-iotests/132 | 2 +- tests/qemu-iotests/136 | 2 +- tests/qemu-iotests/139 | 2 +- tests/qemu-iotests/147 | 2 +- tests/qemu-iotests/148 | 2 +- tests/qemu-iotests/151 | 2 +- tests/qemu-iotests/152 | 2 +- tests/qemu-iotests/155 | 2 +- tests/qemu-iotests/163 | 2 +- tests/qemu-iotests/165 | 2 +- tests/qemu-iotests/169 | 2 +- tests/qemu-iotests/196 | 2 +- tests/qemu-iotests/199 | 2 +- tests/qemu-iotests/205 | 2 +- tests/qemu-iotests/245 | 2 +- tests/qemu-iotests/257 | 2 +- tests/qemu-iotests/258 | 2 +- tests/qemu-iotests/281 | 2 +- tests/qemu-iotests/nbd-fault-injector.py | 2 +- tests/qemu-iotests/qcow2.py | 2 +- tests/qemu-iotests/qed.py | 2 +- 35 files changed, 35 insertions(+), 35 deletions(-) diff --git a/tests/qemu-iotests/030 b/tests/qemu-iotests/030 index 0990681c1e..aa911d266a 100755 --- a/tests/qemu-iotests/030 +++ b/tests/qemu-iotests/030 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Tests for image streaming. # diff --git a/tests/qemu-iotests/040 b/tests/qemu-iotests/040 index 74f62c3c4a..2e7ee0e84f 100755 --- a/tests/qemu-iotests/040 +++ b/tests/qemu-iotests/040 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Tests for image block commit. # diff --git a/tests/qemu-iotests/041 b/tests/qemu-iotests/041 index 0181f7a9b6..43556b9727 100755 --- a/tests/qemu-iotests/041 +++ b/tests/qemu-iotests/041 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Tests for image mirroring. # diff --git a/tests/qemu-iotests/044 b/tests/qemu-iotests/044 index 8b2afa2a11..7e99ea7c68 100755 --- a/tests/qemu-iotests/044 +++ b/tests/qemu-iotests/044 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Tests growing a large refcount table. # diff --git a/tests/qemu-iotests/045 b/tests/qemu-iotests/045 index 01cc038884..5acc89099c 100755 --- a/tests/qemu-iotests/045 +++ b/tests/qemu-iotests/045 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Tests for fdsets and getfd. # diff --git a/tests/qemu-iotests/055 b/tests/qemu-iotests/055 index c732a112d6..82b9f5f47d 100755 --- a/tests/qemu-iotests/055 +++ b/tests/qemu-iotests/055 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Tests for drive-backup and blockdev-backup # diff --git a/tests/qemu-iotests/056 b/tests/qemu-iotests/056 index f39287c162..f73fc74457 100755 --- a/tests/qemu-iotests/056 +++ b/tests/qemu-iotests/056 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Tests for drive-backup # diff --git a/tests/qemu-iotests/057 b/tests/qemu-iotests/057 index 9fbba759b6..a8b4bb60e0 100755 --- a/tests/qemu-iotests/057 +++ b/tests/qemu-iotests/057 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Tests for internal snapshot. # diff --git a/tests/qemu-iotests/065 b/tests/qemu-iotests/065 index 5b21eb96bd..6426474271 100755 --- a/tests/qemu-iotests/065 +++ b/tests/qemu-iotests/065 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test for additional information emitted by qemu-img info on qcow2 # images diff --git a/tests/qemu-iotests/093 b/tests/qemu-iotests/093 index f03fa24a07..32ded11430 100755 --- a/tests/qemu-iotests/093 +++ b/tests/qemu-iotests/093 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Tests for IO throttling # diff --git a/tests/qemu-iotests/096 b/tests/qemu-iotests/096 index ab9cb47822..5915f92786 100755 --- a/tests/qemu-iotests/096 +++ b/tests/qemu-iotests/096 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test that snapshots move the throttling configuration to the active # layer diff --git a/tests/qemu-iotests/118 b/tests/qemu-iotests/118 index e20080e9a6..adc8a848b5 100755 --- a/tests/qemu-iotests/118 +++ b/tests/qemu-iotests/118 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test case for the QMP 'change' command and all other associated # commands diff --git a/tests/qemu-iotests/124 b/tests/qemu-iotests/124 index d3e851e1ae..3705cbb6b3 100755 --- a/tests/qemu-iotests/124 +++ b/tests/qemu-iotests/124 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Tests for incremental drive-backup # diff --git a/tests/qemu-iotests/129 b/tests/qemu-iotests/129 index cd6b9e9ce7..b0da4a5541 100755 --- a/tests/qemu-iotests/129 +++ b/tests/qemu-iotests/129 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Tests that "bdrv_drain_all" doesn't drain block jobs # diff --git a/tests/qemu-iotests/132 b/tests/qemu-iotests/132 index 0f2a106c81..39ea43067e 100755 --- a/tests/qemu-iotests/132 +++ b/tests/qemu-iotests/132 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test mirror with unmap # diff --git a/tests/qemu-iotests/136 b/tests/qemu-iotests/136 index 012ea111ac..d59400c9fc 100755 --- a/tests/qemu-iotests/136 +++ b/tests/qemu-iotests/136 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Tests for block device statistics # diff --git a/tests/qemu-iotests/139 b/tests/qemu-iotests/139 index cbb5a76530..6b1a444364 100755 --- a/tests/qemu-iotests/139 +++ b/tests/qemu-iotests/139 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test cases for the QMP 'blockdev-del' command # diff --git a/tests/qemu-iotests/147 b/tests/qemu-iotests/147 index 2b6f859a09..f4b0a11dba 100755 --- a/tests/qemu-iotests/147 +++ b/tests/qemu-iotests/147 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test case for NBD's blockdev-add interface # diff --git a/tests/qemu-iotests/148 b/tests/qemu-iotests/148 index 8c11c53cba..90931948e3 100755 --- a/tests/qemu-iotests/148 +++ b/tests/qemu-iotests/148 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test the rate limit of QMP events # diff --git a/tests/qemu-iotests/151 b/tests/qemu-iotests/151 index 76ae265cc1..f2df72c29c 100755 --- a/tests/qemu-iotests/151 +++ b/tests/qemu-iotests/151 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Tests for active mirroring # diff --git a/tests/qemu-iotests/152 b/tests/qemu-iotests/152 index 732bf5f062..cc2ea09654 100755 --- a/tests/qemu-iotests/152 +++ b/tests/qemu-iotests/152 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Tests for drive-mirror with source size unaligned to granularity # diff --git a/tests/qemu-iotests/155 b/tests/qemu-iotests/155 index e19485911c..e35b1d534b 100755 --- a/tests/qemu-iotests/155 +++ b/tests/qemu-iotests/155 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test whether the backing BDSs are correct after completion of a # mirror block job; in "existing" modes (drive-mirror with diff --git a/tests/qemu-iotests/163 b/tests/qemu-iotests/163 index d94728e080..5a3cc840a5 100755 --- a/tests/qemu-iotests/163 +++ b/tests/qemu-iotests/163 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Tests for shrinking images # diff --git a/tests/qemu-iotests/165 b/tests/qemu-iotests/165 index 951ea011a2..b60a803dae 100755 --- a/tests/qemu-iotests/165 +++ b/tests/qemu-iotests/165 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Tests for persistent dirty bitmaps. # diff --git a/tests/qemu-iotests/169 b/tests/qemu-iotests/169 index 9656a7f620..2c5a132aa3 100755 --- a/tests/qemu-iotests/169 +++ b/tests/qemu-iotests/169 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Tests for dirty bitmaps migration. # diff --git a/tests/qemu-iotests/196 b/tests/qemu-iotests/196 index 92fe9244f8..e8fcf37273 100755 --- a/tests/qemu-iotests/196 +++ b/tests/qemu-iotests/196 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test clearing unknown autoclear_features flag by qcow2 after # migration. This test mimics migration to older qemu. diff --git a/tests/qemu-iotests/199 b/tests/qemu-iotests/199 index a2c8ecab5a..40774eed74 100755 --- a/tests/qemu-iotests/199 +++ b/tests/qemu-iotests/199 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Tests for dirty bitmaps postcopy migration. # diff --git a/tests/qemu-iotests/205 b/tests/qemu-iotests/205 index 4bb2c21e8b..43432cb599 100755 --- a/tests/qemu-iotests/205 +++ b/tests/qemu-iotests/205 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Tests for qmp command nbd-server-remove. # diff --git a/tests/qemu-iotests/245 b/tests/qemu-iotests/245 index d12b253065..489bf78bd0 100644 --- a/tests/qemu-iotests/245 +++ b/tests/qemu-iotests/245 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test cases for the QMP 'x-blockdev-reopen' command # diff --git a/tests/qemu-iotests/257 b/tests/qemu-iotests/257 index a9828251cf..004a433b8b 100755 --- a/tests/qemu-iotests/257 +++ b/tests/qemu-iotests/257 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test bitmap-sync backups (incremental, differential, and partials) # diff --git a/tests/qemu-iotests/258 b/tests/qemu-iotests/258 index b84cf02254..091755a45c 100755 --- a/tests/qemu-iotests/258 +++ b/tests/qemu-iotests/258 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Very specific tests for adjacent commit/stream block jobs # diff --git a/tests/qemu-iotests/281 b/tests/qemu-iotests/281 index 269d583b2c..0bf973bca6 100755 --- a/tests/qemu-iotests/281 +++ b/tests/qemu-iotests/281 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test cases for blockdev + IOThread interactions # diff --git a/tests/qemu-iotests/nbd-fault-injector.py b/tests/qemu-iotests/nbd-fault-injector.py index 7e2dab6ea4..b158dd65a2 100755 --- a/tests/qemu-iotests/nbd-fault-injector.py +++ b/tests/qemu-iotests/nbd-fault-injector.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # NBD server - fault injection utility # # Configuration file syntax: diff --git a/tests/qemu-iotests/qcow2.py b/tests/qemu-iotests/qcow2.py index 91e4420b9f..1c4fa2b09f 100755 --- a/tests/qemu-iotests/qcow2.py +++ b/tests/qemu-iotests/qcow2.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from __future__ import print_function import sys diff --git a/tests/qemu-iotests/qed.py b/tests/qemu-iotests/qed.py index 8adaaf46c4..36bca1de23 100755 --- a/tests/qemu-iotests/qed.py +++ b/tests/qemu-iotests/qed.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Tool to manipulate QED image files # From c88ee46cdb9888fbe9ea45c174743d6f7544b737 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Thu, 30 Jan 2020 17:32:24 +0100 Subject: [PATCH 34/46] tests: Explicit usage of Python 3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use the program search path to find the Python 3 interpreter. Patch created mechanically by running: $ sed -i "s,^#\!/usr/bin/\(env\ \)\?python$,#\!/usr/bin/env python3," \ $(git grep -l 'if __name__.*__main__') Reported-by: Vladimir Sementsov-Ogievskiy Suggested-by: Daniel P. Berrangé Suggested-by: Stefan Hajnoczi Acked-by: Stefan Hajnoczi Acked-by: Paolo Bonzini Message-Id: <20200130163232.10446-5-philmd@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- tests/docker/travis.py | 2 +- tests/qapi-schema/test-qapi.py | 2 +- tests/vm/centos | 2 +- tests/vm/fedora | 2 +- tests/vm/freebsd | 2 +- tests/vm/netbsd | 2 +- tests/vm/openbsd | 2 +- tests/vm/ubuntu.i386 | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/docker/travis.py b/tests/docker/travis.py index e1433012bd..62fccc5ebb 100755 --- a/tests/docker/travis.py +++ b/tests/docker/travis.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Travis YAML config parser # diff --git a/tests/qapi-schema/test-qapi.py b/tests/qapi-schema/test-qapi.py index bad14edb47..503fb8ad25 100755 --- a/tests/qapi-schema/test-qapi.py +++ b/tests/qapi-schema/test-qapi.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # QAPI parser test harness # diff --git a/tests/vm/centos b/tests/vm/centos index f2f0befd84..a41ff109eb 100755 --- a/tests/vm/centos +++ b/tests/vm/centos @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # CentOS image # diff --git a/tests/vm/fedora b/tests/vm/fedora index 8e270fc0f0..4d7d6049f4 100755 --- a/tests/vm/fedora +++ b/tests/vm/fedora @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Fedora VM image # diff --git a/tests/vm/freebsd b/tests/vm/freebsd index 33a736298a..fb54334696 100755 --- a/tests/vm/freebsd +++ b/tests/vm/freebsd @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # FreeBSD VM image # diff --git a/tests/vm/netbsd b/tests/vm/netbsd index ec6f3563b2..c5069a45f4 100755 --- a/tests/vm/netbsd +++ b/tests/vm/netbsd @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # NetBSD VM image # diff --git a/tests/vm/openbsd b/tests/vm/openbsd index d6173506f7..22cd9513dd 100755 --- a/tests/vm/openbsd +++ b/tests/vm/openbsd @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # OpenBSD VM image # diff --git a/tests/vm/ubuntu.i386 b/tests/vm/ubuntu.i386 index 3834cd7a8d..48e9cb1ad3 100755 --- a/tests/vm/ubuntu.i386 +++ b/tests/vm/ubuntu.i386 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Ubuntu i386 image # From 3d004a371e88a7454eb8ab8c19e6b0bd067b34cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Thu, 30 Jan 2020 17:32:25 +0100 Subject: [PATCH 35/46] scripts: Explicit usage of Python 3 (scripts with __main__) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use the program search path to find the Python 3 interpreter. Patch created mechanically by running: $ sed -i "s,^#\!/usr/bin/\(env\ \)\?python$,#\!/usr/bin/env python3," \ $(git grep -l 'if __name__.*__main__') Reported-by: Vladimir Sementsov-Ogievskiy Suggested-by: Daniel P. Berrangé Suggested-by: Stefan Hajnoczi Reviewed-by: Juan Quintela Acked-by: Stefan Hajnoczi Acked-by: Paolo Bonzini Message-Id: <20200130163232.10446-6-philmd@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- scripts/analyse-locks-simpletrace.py | 2 +- scripts/decodetree.py | 2 +- scripts/device-crash-test | 2 +- scripts/kvm/kvm_flightrecorder | 2 +- scripts/qapi-gen.py | 2 +- scripts/qmp/qemu-ga-client | 2 +- scripts/qmp/qmp | 2 +- scripts/qmp/qmp-shell | 2 +- scripts/qmp/qom-fuse | 2 +- scripts/render_block_graph.py | 2 +- scripts/replay-dump.py | 2 +- scripts/simpletrace.py | 2 +- scripts/tracetool.py | 2 +- scripts/vmstate-static-checker.py | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) diff --git a/scripts/analyse-locks-simpletrace.py b/scripts/analyse-locks-simpletrace.py index 7d9b574300..9c263d6e79 100755 --- a/scripts/analyse-locks-simpletrace.py +++ b/scripts/analyse-locks-simpletrace.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Analyse lock events and compute statistics diff --git a/scripts/decodetree.py b/scripts/decodetree.py index d8c59cab60..2a8f2b6e06 100755 --- a/scripts/decodetree.py +++ b/scripts/decodetree.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright (c) 2018 Linaro Limited # # This library is free software; you can redistribute it and/or diff --git a/scripts/device-crash-test b/scripts/device-crash-test index 15f213a6cd..25ee968b66 100755 --- a/scripts/device-crash-test +++ b/scripts/device-crash-test @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (c) 2017 Red Hat Inc # diff --git a/scripts/kvm/kvm_flightrecorder b/scripts/kvm/kvm_flightrecorder index 54a56745e4..1391a84409 100755 --- a/scripts/kvm/kvm_flightrecorder +++ b/scripts/kvm/kvm_flightrecorder @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # KVM Flight Recorder - ring buffer tracing script # diff --git a/scripts/qapi-gen.py b/scripts/qapi-gen.py index f93f3c7c23..c7b0070db2 100755 --- a/scripts/qapi-gen.py +++ b/scripts/qapi-gen.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # QAPI generator # # This work is licensed under the terms of the GNU GPL, version 2 or later. diff --git a/scripts/qmp/qemu-ga-client b/scripts/qmp/qemu-ga-client index 30cf8a9a0d..e4568aff68 100755 --- a/scripts/qmp/qemu-ga-client +++ b/scripts/qmp/qemu-ga-client @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python3 # QEMU Guest Agent Client # diff --git a/scripts/qmp/qmp b/scripts/qmp/qmp index 6cb46fdae2..f85a14a627 100755 --- a/scripts/qmp/qmp +++ b/scripts/qmp/qmp @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python3 # # QMP command line tool # diff --git a/scripts/qmp/qmp-shell b/scripts/qmp/qmp-shell index f1cddeafbc..9e122ad0c6 100755 --- a/scripts/qmp/qmp-shell +++ b/scripts/qmp/qmp-shell @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python3 # # Low-level QEMU shell on top of QMP. # diff --git a/scripts/qmp/qom-fuse b/scripts/qmp/qom-fuse index 4d85970a78..6bada2c33d 100755 --- a/scripts/qmp/qom-fuse +++ b/scripts/qmp/qom-fuse @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python3 ## # QEMU Object Model test tools # diff --git a/scripts/render_block_graph.py b/scripts/render_block_graph.py index 656f0388ad..409b4321f2 100755 --- a/scripts/render_block_graph.py +++ b/scripts/render_block_graph.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Render Qemu Block Graph # diff --git a/scripts/replay-dump.py b/scripts/replay-dump.py index ee7fda2638..0cdae879b7 100755 --- a/scripts/replay-dump.py +++ b/scripts/replay-dump.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Dump the contents of a recorded execution stream diff --git a/scripts/simpletrace.py b/scripts/simpletrace.py index 45485b864b..2bc043112a 100755 --- a/scripts/simpletrace.py +++ b/scripts/simpletrace.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Pretty-printer for simple trace backend binary trace files # diff --git a/scripts/tracetool.py b/scripts/tracetool.py index 3beaa66bd8..264cc9eecc 100755 --- a/scripts/tracetool.py +++ b/scripts/tracetool.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ diff --git a/scripts/vmstate-static-checker.py b/scripts/vmstate-static-checker.py index f8b7b8f772..d44dedd9e9 100755 --- a/scripts/vmstate-static-checker.py +++ b/scripts/vmstate-static-checker.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python3 # # Compares vmstate information stored in JSON format, obtained from # the -dump-vmstate QEMU command. From b92e7dae2b2626c0afc8ac980660b2ffc3e35bf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Thu, 30 Jan 2020 17:32:26 +0100 Subject: [PATCH 36/46] scripts/minikconf: Explicit usage of Python 3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use the program search path to find the Python 3 interpreter. Patch created manually after running: $ git grep -l 'if __name__.*__main__' \ | xargs grep -LF '#!/usr/bin/env python3' Reported-by: Vladimir Sementsov-Ogievskiy Suggested-by: Daniel P. Berrangé Suggested-by: Stefan Hajnoczi Acked-by: Stefan Hajnoczi Acked-by: Paolo Bonzini Message-Id: <20200130163232.10446-7-philmd@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- scripts/minikconf.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/minikconf.py b/scripts/minikconf.py index 40ae1989e1..377d6228b9 100644 --- a/scripts/minikconf.py +++ b/scripts/minikconf.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 # # Mini-Kconfig parser # From 91aef87a2b8afb333934b02ce2d0d64a3fe11874 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Thu, 30 Jan 2020 17:32:28 +0100 Subject: [PATCH 37/46] scripts/tracetool: Remove shebang header MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patch created mechanically by running: $ chmod 644 $(git grep -lF '#!/usr/bin/env python' \ | xargs grep -L 'if __name__.*__main__') $ sed -i "/^#\!\/usr\/bin\/\(env\ \)\?python.\?$/d" \ $(git grep -lF '#!/usr/bin/env python' \ | xargs grep -L 'if __name__.*__main__') Reported-by: Vladimir Sementsov-Ogievskiy Suggested-by: Stefan Hajnoczi Acked-by: Stefan Hajnoczi Acked-by: Paolo Bonzini Message-Id: <20200130163232.10446-9-philmd@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- scripts/tracetool/__init__.py | 1 - scripts/tracetool/backend/__init__.py | 1 - scripts/tracetool/backend/dtrace.py | 1 - scripts/tracetool/backend/ftrace.py | 1 - scripts/tracetool/backend/log.py | 1 - scripts/tracetool/backend/simple.py | 1 - scripts/tracetool/backend/syslog.py | 1 - scripts/tracetool/backend/ust.py | 1 - scripts/tracetool/format/__init__.py | 1 - scripts/tracetool/format/c.py | 1 - scripts/tracetool/format/d.py | 1 - scripts/tracetool/format/h.py | 1 - scripts/tracetool/format/log_stap.py | 1 - scripts/tracetool/format/simpletrace_stap.py | 1 - scripts/tracetool/format/stap.py | 1 - scripts/tracetool/format/tcg_h.py | 1 - scripts/tracetool/format/tcg_helper_c.py | 1 - scripts/tracetool/format/tcg_helper_h.py | 1 - scripts/tracetool/format/tcg_helper_wrapper_h.py | 1 - scripts/tracetool/format/ust_events_c.py | 1 - scripts/tracetool/format/ust_events_h.py | 1 - scripts/tracetool/transform.py | 1 - scripts/tracetool/vcpu.py | 1 - 23 files changed, 23 deletions(-) diff --git a/scripts/tracetool/__init__.py b/scripts/tracetool/__init__.py index 44c118bc2a..13d29f1e42 100644 --- a/scripts/tracetool/__init__.py +++ b/scripts/tracetool/__init__.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- """ diff --git a/scripts/tracetool/backend/__init__.py b/scripts/tracetool/backend/__init__.py index 259c6a6531..54cab2c4de 100644 --- a/scripts/tracetool/backend/__init__.py +++ b/scripts/tracetool/backend/__init__.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- """ diff --git a/scripts/tracetool/backend/dtrace.py b/scripts/tracetool/backend/dtrace.py index c2f3a4e5a8..638990db79 100644 --- a/scripts/tracetool/backend/dtrace.py +++ b/scripts/tracetool/backend/dtrace.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- """ diff --git a/scripts/tracetool/backend/ftrace.py b/scripts/tracetool/backend/ftrace.py index 92f71b28f9..e9844dd335 100644 --- a/scripts/tracetool/backend/ftrace.py +++ b/scripts/tracetool/backend/ftrace.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- """ diff --git a/scripts/tracetool/backend/log.py b/scripts/tracetool/backend/log.py index 33c95af8e9..23b274c0fd 100644 --- a/scripts/tracetool/backend/log.py +++ b/scripts/tracetool/backend/log.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- """ diff --git a/scripts/tracetool/backend/simple.py b/scripts/tracetool/backend/simple.py index c2fd1c24c4..b650c262b5 100644 --- a/scripts/tracetool/backend/simple.py +++ b/scripts/tracetool/backend/simple.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- """ diff --git a/scripts/tracetool/backend/syslog.py b/scripts/tracetool/backend/syslog.py index 668fb73fee..1373a90192 100644 --- a/scripts/tracetool/backend/syslog.py +++ b/scripts/tracetool/backend/syslog.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- """ diff --git a/scripts/tracetool/backend/ust.py b/scripts/tracetool/backend/ust.py index 280cb7c106..a772a3b53b 100644 --- a/scripts/tracetool/backend/ust.py +++ b/scripts/tracetool/backend/ust.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- """ diff --git a/scripts/tracetool/format/__init__.py b/scripts/tracetool/format/__init__.py index cf6e0e2da5..aba2f7a441 100644 --- a/scripts/tracetool/format/__init__.py +++ b/scripts/tracetool/format/__init__.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- """ diff --git a/scripts/tracetool/format/c.py b/scripts/tracetool/format/c.py index 31207961b0..78af8aff72 100644 --- a/scripts/tracetool/format/c.py +++ b/scripts/tracetool/format/c.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- """ diff --git a/scripts/tracetool/format/d.py b/scripts/tracetool/format/d.py index c7cb2a93a6..d3980b914b 100644 --- a/scripts/tracetool/format/d.py +++ b/scripts/tracetool/format/d.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- """ diff --git a/scripts/tracetool/format/h.py b/scripts/tracetool/format/h.py index 5596b304e6..83e1a2f355 100644 --- a/scripts/tracetool/format/h.py +++ b/scripts/tracetool/format/h.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- """ diff --git a/scripts/tracetool/format/log_stap.py b/scripts/tracetool/format/log_stap.py index 9ab0cf2cce..b486beb672 100644 --- a/scripts/tracetool/format/log_stap.py +++ b/scripts/tracetool/format/log_stap.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- """ diff --git a/scripts/tracetool/format/simpletrace_stap.py b/scripts/tracetool/format/simpletrace_stap.py index 57b04061cf..4f4633b4e6 100644 --- a/scripts/tracetool/format/simpletrace_stap.py +++ b/scripts/tracetool/format/simpletrace_stap.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- """ diff --git a/scripts/tracetool/format/stap.py b/scripts/tracetool/format/stap.py index e8ef3e762d..8fc808f2ef 100644 --- a/scripts/tracetool/format/stap.py +++ b/scripts/tracetool/format/stap.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- """ diff --git a/scripts/tracetool/format/tcg_h.py b/scripts/tracetool/format/tcg_h.py index 1651cc3f71..0180e3d76c 100644 --- a/scripts/tracetool/format/tcg_h.py +++ b/scripts/tracetool/format/tcg_h.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- """ diff --git a/scripts/tracetool/format/tcg_helper_c.py b/scripts/tracetool/format/tcg_helper_c.py index 1b3522a716..6527b69afd 100644 --- a/scripts/tracetool/format/tcg_helper_c.py +++ b/scripts/tracetool/format/tcg_helper_c.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- """ diff --git a/scripts/tracetool/format/tcg_helper_h.py b/scripts/tracetool/format/tcg_helper_h.py index 6b184b641b..98ebe52f18 100644 --- a/scripts/tracetool/format/tcg_helper_h.py +++ b/scripts/tracetool/format/tcg_helper_h.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- """ diff --git a/scripts/tracetool/format/tcg_helper_wrapper_h.py b/scripts/tracetool/format/tcg_helper_wrapper_h.py index ff53447512..6adeab74df 100644 --- a/scripts/tracetool/format/tcg_helper_wrapper_h.py +++ b/scripts/tracetool/format/tcg_helper_wrapper_h.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- """ diff --git a/scripts/tracetool/format/ust_events_c.py b/scripts/tracetool/format/ust_events_c.py index 264784cdf2..deced9533d 100644 --- a/scripts/tracetool/format/ust_events_c.py +++ b/scripts/tracetool/format/ust_events_c.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- """ diff --git a/scripts/tracetool/format/ust_events_h.py b/scripts/tracetool/format/ust_events_h.py index b14054ac01..6ce559f6cc 100644 --- a/scripts/tracetool/format/ust_events_h.py +++ b/scripts/tracetool/format/ust_events_h.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- """ diff --git a/scripts/tracetool/transform.py b/scripts/tracetool/transform.py index 2ca9286046..8fd4dcf20d 100644 --- a/scripts/tracetool/transform.py +++ b/scripts/tracetool/transform.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- """ diff --git a/scripts/tracetool/vcpu.py b/scripts/tracetool/vcpu.py index 452c7f589d..0b104e4f15 100644 --- a/scripts/tracetool/vcpu.py +++ b/scripts/tracetool/vcpu.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- """ From 273954e78284aa394b9920a4cf5a19f036616154 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Thu, 30 Jan 2020 17:32:27 +0100 Subject: [PATCH 38/46] tests/acceptance: Remove shebang header MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patch created mechanically by running: $ chmod 644 $(git grep -lF '#!/usr/bin/env python' \ | xargs grep -L 'if __name__.*__main__') $ sed -i "/^#\!\/usr\/bin\/\(env\ \)\?python.\?$/d" \ $(git grep -lF '#!/usr/bin/env python' \ | xargs grep -L 'if __name__.*__main__') Reported-by: Vladimir Sementsov-Ogievskiy Suggested-by: Stefan Hajnoczi Reviewed-by: Wainer dos Santos Moschetta Acked-by: Stefan Hajnoczi Acked-by: Paolo Bonzini Message-Id: <20200130163232.10446-8-philmd@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- tests/acceptance/virtio_check_params.py | 1 - tests/acceptance/x86_cpu_model_versions.py | 1 - 2 files changed, 2 deletions(-) mode change 100755 => 100644 tests/acceptance/virtio_check_params.py diff --git a/tests/acceptance/virtio_check_params.py b/tests/acceptance/virtio_check_params.py old mode 100755 new mode 100644 index c3af8dbf9f..87e6c839d1 --- a/tests/acceptance/virtio_check_params.py +++ b/tests/acceptance/virtio_check_params.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # # Test virtio-scsi and virtio-blk queue settings for all machine types # diff --git a/tests/acceptance/x86_cpu_model_versions.py b/tests/acceptance/x86_cpu_model_versions.py index 90558d9a71..01ff614ec2 100644 --- a/tests/acceptance/x86_cpu_model_versions.py +++ b/tests/acceptance/x86_cpu_model_versions.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # # Basic validation of x86 versioned CPU models and CPU model aliases # From 629d5edfaa92a145a3f7df34bd30612f0ada9ef5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Thu, 30 Jan 2020 17:32:29 +0100 Subject: [PATCH 39/46] tests/vm: Remove shebang header MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patch created mechanically by running: $ chmod 644 $(git grep -lF '#!/usr/bin/env python' \ | xargs grep -L 'if __name__.*__main__') $ sed -i "/^#\!\/usr\/bin\/\(env\ \)\?python.\?$/d" \ $(git grep -lF '#!/usr/bin/env python' \ | xargs grep -L 'if __name__.*__main__') Reported-by: Vladimir Sementsov-Ogievskiy Suggested-by: Stefan Hajnoczi Acked-by: Stefan Hajnoczi Acked-by: Paolo Bonzini Message-Id: <20200130163232.10446-10-philmd@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- tests/vm/basevm.py | 1 - 1 file changed, 1 deletion(-) mode change 100755 => 100644 tests/vm/basevm.py diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py old mode 100755 new mode 100644 index ed5dd4f3d0..30714fa1a8 --- a/tests/vm/basevm.py +++ b/tests/vm/basevm.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # # VM testing base class # From 7c4775260807f1428484a5cebc7bc360c46a872d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Thu, 30 Jan 2020 17:32:30 +0100 Subject: [PATCH 40/46] tests/qemu-iotests: Explicit usage of Python3 (scripts without __main__) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use the program search path to find the Python 3 interpreter. Patch created mechanically by running: $ sed -i "s,^#\!/usr/bin/\(env\ \)\?python$,#\!/usr/bin/env python3," \ $(git grep -lF '#!/usr/bin/env python' \ | xargs grep -L 'if __name__.*__main__') Reported-by: Vladimir Sementsov-Ogievskiy Suggested-by: Daniel P. Berrangé Suggested-by: Stefan Hajnoczi Acked-by: Stefan Hajnoczi Acked-by: Paolo Bonzini Message-Id: <20200130163232.10446-11-philmd@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- tests/qemu-iotests/149 | 2 +- tests/qemu-iotests/194 | 2 +- tests/qemu-iotests/202 | 2 +- tests/qemu-iotests/203 | 2 +- tests/qemu-iotests/206 | 2 +- tests/qemu-iotests/207 | 2 +- tests/qemu-iotests/208 | 2 +- tests/qemu-iotests/209 | 2 +- tests/qemu-iotests/210 | 2 +- tests/qemu-iotests/211 | 2 +- tests/qemu-iotests/212 | 2 +- tests/qemu-iotests/213 | 2 +- tests/qemu-iotests/216 | 2 +- tests/qemu-iotests/218 | 2 +- tests/qemu-iotests/219 | 2 +- tests/qemu-iotests/222 | 2 +- tests/qemu-iotests/224 | 2 +- tests/qemu-iotests/228 | 2 +- tests/qemu-iotests/234 | 2 +- tests/qemu-iotests/235 | 2 +- tests/qemu-iotests/236 | 2 +- tests/qemu-iotests/237 | 2 +- tests/qemu-iotests/238 | 2 +- tests/qemu-iotests/242 | 2 +- tests/qemu-iotests/246 | 2 +- tests/qemu-iotests/248 | 2 +- tests/qemu-iotests/254 | 2 +- tests/qemu-iotests/255 | 2 +- tests/qemu-iotests/256 | 2 +- tests/qemu-iotests/260 | 2 +- tests/qemu-iotests/262 | 2 +- tests/qemu-iotests/264 | 2 +- tests/qemu-iotests/266 | 2 +- tests/qemu-iotests/277 | 2 +- tests/qemu-iotests/280 | 2 +- tests/qemu-iotests/283 | 2 +- 36 files changed, 36 insertions(+), 36 deletions(-) diff --git a/tests/qemu-iotests/149 b/tests/qemu-iotests/149 index 8ab42e94c6..0a7b765d07 100755 --- a/tests/qemu-iotests/149 +++ b/tests/qemu-iotests/149 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (C) 2016 Red Hat, Inc. # diff --git a/tests/qemu-iotests/194 b/tests/qemu-iotests/194 index 72e47e8833..9dc1bd3510 100755 --- a/tests/qemu-iotests/194 +++ b/tests/qemu-iotests/194 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (C) 2017 Red Hat, Inc. # diff --git a/tests/qemu-iotests/202 b/tests/qemu-iotests/202 index 581ca34d79..920a8683ef 100755 --- a/tests/qemu-iotests/202 +++ b/tests/qemu-iotests/202 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (C) 2017 Red Hat, Inc. # diff --git a/tests/qemu-iotests/203 b/tests/qemu-iotests/203 index 4874a1a0d8..49eff5d405 100755 --- a/tests/qemu-iotests/203 +++ b/tests/qemu-iotests/203 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (C) 2017 Red Hat, Inc. # diff --git a/tests/qemu-iotests/206 b/tests/qemu-iotests/206 index 9f16a7df8d..e2b50ae24d 100755 --- a/tests/qemu-iotests/206 +++ b/tests/qemu-iotests/206 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test qcow2 and file image creation # diff --git a/tests/qemu-iotests/207 b/tests/qemu-iotests/207 index 812ab34e47..3d9c1208ca 100755 --- a/tests/qemu-iotests/207 +++ b/tests/qemu-iotests/207 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test ssh image creation # diff --git a/tests/qemu-iotests/208 b/tests/qemu-iotests/208 index 546eb1de3e..1c3fc8c7fd 100755 --- a/tests/qemu-iotests/208 +++ b/tests/qemu-iotests/208 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (C) 2018 Red Hat, Inc. # diff --git a/tests/qemu-iotests/209 b/tests/qemu-iotests/209 index e0f464bcbe..65c1a1e70a 100755 --- a/tests/qemu-iotests/209 +++ b/tests/qemu-iotests/209 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Tests for NBD BLOCK_STATUS extension # diff --git a/tests/qemu-iotests/210 b/tests/qemu-iotests/210 index 4ca0fe26ef..e49896e23d 100755 --- a/tests/qemu-iotests/210 +++ b/tests/qemu-iotests/210 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test luks and file image creation # diff --git a/tests/qemu-iotests/211 b/tests/qemu-iotests/211 index 8834ebfe85..163994d559 100755 --- a/tests/qemu-iotests/211 +++ b/tests/qemu-iotests/211 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test VDI and file image creation # diff --git a/tests/qemu-iotests/212 b/tests/qemu-iotests/212 index 8f3ccc7b15..800f92dd84 100755 --- a/tests/qemu-iotests/212 +++ b/tests/qemu-iotests/212 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test parallels and file image creation # diff --git a/tests/qemu-iotests/213 b/tests/qemu-iotests/213 index 3fc8dc6eaa..1eee45276a 100755 --- a/tests/qemu-iotests/213 +++ b/tests/qemu-iotests/213 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test vhdx and file image creation # diff --git a/tests/qemu-iotests/216 b/tests/qemu-iotests/216 index 3c0ae54b44..372f042d3e 100755 --- a/tests/qemu-iotests/216 +++ b/tests/qemu-iotests/216 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copy-on-read tests using a COR filter node # diff --git a/tests/qemu-iotests/218 b/tests/qemu-iotests/218 index 2554d84581..1325ba9eaa 100755 --- a/tests/qemu-iotests/218 +++ b/tests/qemu-iotests/218 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # This test covers what happens when a mirror block job is cancelled # in various phases of its existence. diff --git a/tests/qemu-iotests/219 b/tests/qemu-iotests/219 index 655f54d881..b8774770c4 100755 --- a/tests/qemu-iotests/219 +++ b/tests/qemu-iotests/219 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (C) 2018 Red Hat, Inc. # diff --git a/tests/qemu-iotests/222 b/tests/qemu-iotests/222 index 3f9f934ad8..bf1718e179 100644 --- a/tests/qemu-iotests/222 +++ b/tests/qemu-iotests/222 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # This test covers the basic fleecing workflow, which provides a # point-in-time snapshot of a node that can be queried over NBD. diff --git a/tests/qemu-iotests/224 b/tests/qemu-iotests/224 index b4dfaa639f..e91fb26fd8 100755 --- a/tests/qemu-iotests/224 +++ b/tests/qemu-iotests/224 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test json:{} filenames with qemu-internal BDSs # (the one of commit, to be precise) diff --git a/tests/qemu-iotests/228 b/tests/qemu-iotests/228 index 9a50afd205..64bc82ee23 100755 --- a/tests/qemu-iotests/228 +++ b/tests/qemu-iotests/228 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test for when a backing file is considered overridden (thus, a # json:{} filename is generated for the overlay) and when it is not diff --git a/tests/qemu-iotests/234 b/tests/qemu-iotests/234 index 59a7f949ec..324c1549fd 100755 --- a/tests/qemu-iotests/234 +++ b/tests/qemu-iotests/234 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (C) 2018 Red Hat, Inc. # diff --git a/tests/qemu-iotests/235 b/tests/qemu-iotests/235 index 3d7533980d..760826128e 100755 --- a/tests/qemu-iotests/235 +++ b/tests/qemu-iotests/235 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Simple mirror test # diff --git a/tests/qemu-iotests/236 b/tests/qemu-iotests/236 index 79a6381f8e..8ce927a16c 100755 --- a/tests/qemu-iotests/236 +++ b/tests/qemu-iotests/236 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test bitmap merges. # diff --git a/tests/qemu-iotests/237 b/tests/qemu-iotests/237 index a2242a4736..50ba364a3e 100755 --- a/tests/qemu-iotests/237 +++ b/tests/qemu-iotests/237 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test vmdk and file image creation # diff --git a/tests/qemu-iotests/238 b/tests/qemu-iotests/238 index e5ac2b2ff8..d4e060228c 100755 --- a/tests/qemu-iotests/238 +++ b/tests/qemu-iotests/238 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Regression test for throttle group member unregister segfault with iothread # diff --git a/tests/qemu-iotests/242 b/tests/qemu-iotests/242 index c176e92da6..97617876bc 100755 --- a/tests/qemu-iotests/242 +++ b/tests/qemu-iotests/242 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test for qcow2 bitmap printed information # diff --git a/tests/qemu-iotests/246 b/tests/qemu-iotests/246 index b0997a392f..59a216a839 100755 --- a/tests/qemu-iotests/246 +++ b/tests/qemu-iotests/246 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test persistent bitmap resizing. # diff --git a/tests/qemu-iotests/248 b/tests/qemu-iotests/248 index f26b4bb2aa..68c374692e 100755 --- a/tests/qemu-iotests/248 +++ b/tests/qemu-iotests/248 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test resume mirror after auto pause on ENOSPC # diff --git a/tests/qemu-iotests/254 b/tests/qemu-iotests/254 index 09584f3f7d..ee66c986db 100755 --- a/tests/qemu-iotests/254 +++ b/tests/qemu-iotests/254 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test external snapshot with bitmap copying and moving. # diff --git a/tests/qemu-iotests/255 b/tests/qemu-iotests/255 index 0ba03d9e61..4a4818bafb 100755 --- a/tests/qemu-iotests/255 +++ b/tests/qemu-iotests/255 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test commit job graph modifications while requests are active # diff --git a/tests/qemu-iotests/256 b/tests/qemu-iotests/256 index c594a43205..e34074c83e 100755 --- a/tests/qemu-iotests/256 +++ b/tests/qemu-iotests/256 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test incremental/backup across iothread contexts # diff --git a/tests/qemu-iotests/260 b/tests/qemu-iotests/260 index 4f6082c9d2..30c0de380d 100755 --- a/tests/qemu-iotests/260 +++ b/tests/qemu-iotests/260 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Tests for temporary external snapshot when we have bitmaps. # diff --git a/tests/qemu-iotests/262 b/tests/qemu-iotests/262 index bbcb5260a6..8835dce7be 100755 --- a/tests/qemu-iotests/262 +++ b/tests/qemu-iotests/262 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (C) 2019 Red Hat, Inc. # diff --git a/tests/qemu-iotests/264 b/tests/qemu-iotests/264 index 131366422b..879123a343 100755 --- a/tests/qemu-iotests/264 +++ b/tests/qemu-iotests/264 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test nbd reconnect # diff --git a/tests/qemu-iotests/266 b/tests/qemu-iotests/266 index c353cf88ee..91bdf8729e 100755 --- a/tests/qemu-iotests/266 +++ b/tests/qemu-iotests/266 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test VPC and file image creation # diff --git a/tests/qemu-iotests/277 b/tests/qemu-iotests/277 index 1f72dca2d4..04aa15a3d5 100755 --- a/tests/qemu-iotests/277 +++ b/tests/qemu-iotests/277 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test NBD client reconnection # diff --git a/tests/qemu-iotests/280 b/tests/qemu-iotests/280 index 85e9114c5e..69288fdd0e 100755 --- a/tests/qemu-iotests/280 +++ b/tests/qemu-iotests/280 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (C) 2019 Red Hat, Inc. # diff --git a/tests/qemu-iotests/283 b/tests/qemu-iotests/283 index 293e557bd9..55b7cff953 100644 --- a/tests/qemu-iotests/283 +++ b/tests/qemu-iotests/283 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test for backup-top filter permission activation failure # From d2cdbd54db6e5976d02d7a2c48cb49915d34086d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Thu, 30 Jan 2020 17:32:31 +0100 Subject: [PATCH 41/46] scripts: Explicit usage of Python 3 (scripts without __main__) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use the program search path to find the Python 3 interpreter. Patch created mechanically by running: $ sed -i "s,^#\!/usr/bin/\(env\ \)\?python$,#\!/usr/bin/env python3," \ $(git grep -lF '#!/usr/bin/env python' \ | xargs grep -L 'if __name__.*__main__') Reported-by: Vladimir Sementsov-Ogievskiy Suggested-by: Daniel P. Berrangé Suggested-by: Stefan Hajnoczi Acked-by: Stefan Hajnoczi Acked-by: Paolo Bonzini Message-Id: <20200130163232.10446-12-philmd@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- scripts/analyse-9p-simpletrace.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/analyse-9p-simpletrace.py b/scripts/analyse-9p-simpletrace.py index 710e01adba..f20050fddd 100755 --- a/scripts/analyse-9p-simpletrace.py +++ b/scripts/analyse-9p-simpletrace.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Pretty print 9p simpletrace log # Usage: ./analyse-9p-simpletrace # From 351aa2706e1d19e2ad878e5d9333ca9e9825d0cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Thu, 30 Jan 2020 17:32:32 +0100 Subject: [PATCH 42/46] tests/qemu-iotests/check: Only check for Python 3 interpreter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All the iotests Python scripts have been converted to search for the Python 3 interpreter. Update the ./check script accordingly. Acked-by: Stefan Hajnoczi Acked-by: Paolo Bonzini Message-Id: <20200130163232.10446-13-philmd@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- tests/qemu-iotests/check | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check index 1789ada52e..f7a2d3d6c3 100755 --- a/tests/qemu-iotests/check +++ b/tests/qemu-iotests/check @@ -846,8 +846,7 @@ do start=$(_wallclock) - if [ "$(head -n 1 "$source_iotests/$seq" | sed 's/3$//')" \ - == "#!/usr/bin/env python" ]; then + if [ "$(head -n 1 "$source_iotests/$seq")" == "#!/usr/bin/env python3" ]; then if $python_usable; then run_command="$PYTHON $seq" else From b38c2458d4ccbabbfdf1beb9df483b609a9513f8 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 4 Feb 2020 17:00:28 +0100 Subject: [PATCH 43/46] scripts/signrom: remove Python 2 support, add shebang MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Philippe Mathieu-Daudé Signed-off-by: Paolo Bonzini Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20200204160028.16211-1-pbonzini@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- scripts/signrom.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/scripts/signrom.py b/scripts/signrom.py index 313ee28a17..9be5dab1cf 100644 --- a/scripts/signrom.py +++ b/scripts/signrom.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + from __future__ import print_function # # Option ROM signing utility @@ -44,14 +46,8 @@ fout.write(data) checksum = 0 for b in data: - # catch Python 2 vs. 3 differences - if isinstance(b, int): - checksum += b - else: - checksum += ord(b) -checksum = (256 - checksum) % 256 + checksum = (checksum - b) & 255 -# Python 3 no longer allows chr(checksum) fout.write(struct.pack('B', checksum)) fin.close() From 6dd360ce3fd599ec373fa1206e850ee106a8e710 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 4 Feb 2020 17:02:37 +0100 Subject: [PATCH 44/46] make all Python scripts executable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Scripts that have a Python shebang are meant to be executed directly from the shell; give them 755 permissions. Cc: Philippe Mathieu-Daudé Signed-off-by: Paolo Bonzini Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20200204160237.16889-1-pbonzini@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- scripts/minikconf.py | 0 scripts/signrom.py | 0 tests/qemu-iotests/222 | 0 tests/qemu-iotests/245 | 0 4 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 scripts/minikconf.py mode change 100644 => 100755 scripts/signrom.py mode change 100644 => 100755 tests/qemu-iotests/222 mode change 100644 => 100755 tests/qemu-iotests/245 diff --git a/scripts/minikconf.py b/scripts/minikconf.py old mode 100644 new mode 100755 diff --git a/scripts/signrom.py b/scripts/signrom.py old mode 100644 new mode 100755 diff --git a/tests/qemu-iotests/222 b/tests/qemu-iotests/222 old mode 100644 new mode 100755 diff --git a/tests/qemu-iotests/245 b/tests/qemu-iotests/245 old mode 100644 new mode 100755 From 423edd9a31b3c78007bb5d9c9a9b3c0c618a10a8 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 4 Feb 2020 17:06:04 +0100 Subject: [PATCH 45/46] drop "from __future__ import print_function" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is only needed for Python 2, which we do not support anymore. Cc: Philippe Mathieu-Daudé Signed-off-by: Paolo Bonzini Reviewed-by: Philippe Mathieu-Daudé Acked-by: Alex Bennée Acked-by: Markus Armbruster Message-Id: <20200204160604.19883-1-pbonzini@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- scripts/analyse-9p-simpletrace.py | 1 - scripts/analyse-locks-simpletrace.py | 1 - scripts/device-crash-test | 1 - scripts/dump-guest-memory.py | 1 - scripts/kvm/kvm_flightrecorder | 1 - scripts/kvm/vmxcap | 1 - scripts/minikconf.py | 1 - scripts/modules/module_block.py | 1 - scripts/qapi-gen.py | 1 - scripts/qapi/doc.py | 1 - scripts/qmp/qemu-ga-client | 1 - scripts/qmp/qmp | 1 - scripts/qmp/qmp-shell | 1 - scripts/qmp/qom-get | 1 - scripts/qmp/qom-list | 1 - scripts/qmp/qom-set | 1 - scripts/qmp/qom-tree | 1 - scripts/replay-dump.py | 1 - scripts/signrom.py | 1 - scripts/simpletrace.py | 1 - scripts/vmstate-static-checker.py | 1 - tests/docker/travis.py | 1 - tests/guest-debug/test-gdbstub.py | 1 - tests/migration/guestperf/engine.py | 1 - tests/migration/guestperf/plot.py | 1 - tests/migration/guestperf/shell.py | 1 - tests/qapi-schema/test-qapi.py | 1 - tests/qemu-iotests/149 | 1 - tests/qemu-iotests/165 | 1 - tests/qemu-iotests/iotests.py | 1 - tests/qemu-iotests/nbd-fault-injector.py | 1 - tests/qemu-iotests/qcow2.py | 1 - tests/qemu-iotests/qed.py | 1 - tests/vm/basevm.py | 1 - 34 files changed, 34 deletions(-) diff --git a/scripts/analyse-9p-simpletrace.py b/scripts/analyse-9p-simpletrace.py index f20050fddd..7dfcb6ba2f 100755 --- a/scripts/analyse-9p-simpletrace.py +++ b/scripts/analyse-9p-simpletrace.py @@ -3,7 +3,6 @@ # Usage: ./analyse-9p-simpletrace # # Author: Harsh Prateek Bora -from __future__ import print_function import os import simpletrace diff --git a/scripts/analyse-locks-simpletrace.py b/scripts/analyse-locks-simpletrace.py index 9c263d6e79..63c11f4fce 100755 --- a/scripts/analyse-locks-simpletrace.py +++ b/scripts/analyse-locks-simpletrace.py @@ -6,7 +6,6 @@ # Author: Alex Bennée # -from __future__ import print_function import simpletrace import argparse import numpy as np diff --git a/scripts/device-crash-test b/scripts/device-crash-test index 25ee968b66..305d0427af 100755 --- a/scripts/device-crash-test +++ b/scripts/device-crash-test @@ -23,7 +23,6 @@ Run QEMU with all combinations of -machine and -device types, check for crashes and unexpected errors. """ -from __future__ import print_function import os import sys diff --git a/scripts/dump-guest-memory.py b/scripts/dump-guest-memory.py index 9371e45813..4177261d33 100644 --- a/scripts/dump-guest-memory.py +++ b/scripts/dump-guest-memory.py @@ -12,7 +12,6 @@ Authors: This work is licensed under the terms of the GNU GPL, version 2 or later. See the COPYING file in the top-level directory. """ -from __future__ import print_function import ctypes import struct diff --git a/scripts/kvm/kvm_flightrecorder b/scripts/kvm/kvm_flightrecorder index 1391a84409..78ca3af9c4 100755 --- a/scripts/kvm/kvm_flightrecorder +++ b/scripts/kvm/kvm_flightrecorder @@ -32,7 +32,6 @@ # consuming CPU cycles. No disk I/O is performed since the ring buffer holds a # fixed-size in-memory trace. -from __future__ import print_function import sys import os diff --git a/scripts/kvm/vmxcap b/scripts/kvm/vmxcap index 5dfeb2e03a..971ed0e721 100755 --- a/scripts/kvm/vmxcap +++ b/scripts/kvm/vmxcap @@ -10,7 +10,6 @@ # This work is licensed under the terms of the GNU GPL, version 2. See # the COPYING file in the top-level directory. -from __future__ import print_function MSR_IA32_VMX_BASIC = 0x480 MSR_IA32_VMX_PINBASED_CTLS = 0x481 MSR_IA32_VMX_PROCBASED_CTLS = 0x482 diff --git a/scripts/minikconf.py b/scripts/minikconf.py index 377d6228b9..2f9647d0fa 100755 --- a/scripts/minikconf.py +++ b/scripts/minikconf.py @@ -11,7 +11,6 @@ # or, at your option, any later version. See the COPYING file in # the top-level directory. -from __future__ import print_function import os import sys import re diff --git a/scripts/modules/module_block.py b/scripts/modules/module_block.py index 08646af92c..f23191fac1 100644 --- a/scripts/modules/module_block.py +++ b/scripts/modules/module_block.py @@ -10,7 +10,6 @@ # This work is licensed under the terms of the GNU GPL, version 2. # See the COPYING file in the top-level directory. -from __future__ import print_function import sys import os diff --git a/scripts/qapi-gen.py b/scripts/qapi-gen.py index c7b0070db2..4b03f7d53b 100755 --- a/scripts/qapi-gen.py +++ b/scripts/qapi-gen.py @@ -4,7 +4,6 @@ # This work is licensed under the terms of the GNU GPL, version 2 or later. # See the COPYING file in the top-level directory. -from __future__ import print_function import argparse import re diff --git a/scripts/qapi/doc.py b/scripts/qapi/doc.py index 6f1c17f71f..1787a53d91 100644 --- a/scripts/qapi/doc.py +++ b/scripts/qapi/doc.py @@ -4,7 +4,6 @@ # See the COPYING file in the top-level directory. """This script produces the documentation of a qapi schema in texinfo format""" -from __future__ import print_function import re from qapi.gen import QAPIGenDoc, QAPISchemaVisitor diff --git a/scripts/qmp/qemu-ga-client b/scripts/qmp/qemu-ga-client index e4568aff68..ce122984a9 100755 --- a/scripts/qmp/qemu-ga-client +++ b/scripts/qmp/qemu-ga-client @@ -36,7 +36,6 @@ # See also: https://wiki.qemu.org/Features/QAPI/GuestAgent # -from __future__ import print_function import os import sys import base64 diff --git a/scripts/qmp/qmp b/scripts/qmp/qmp index f85a14a627..0625fc2aba 100755 --- a/scripts/qmp/qmp +++ b/scripts/qmp/qmp @@ -10,7 +10,6 @@ # This work is licensed under the terms of the GNU GPLv2 or later. # See the COPYING file in the top-level directory. -from __future__ import print_function import sys, os from qmp import QEMUMonitorProtocol diff --git a/scripts/qmp/qmp-shell b/scripts/qmp/qmp-shell index 9e122ad0c6..a01d31de1e 100755 --- a/scripts/qmp/qmp-shell +++ b/scripts/qmp/qmp-shell @@ -65,7 +65,6 @@ # which will echo back the properly formatted JSON-compliant QMP that is being # sent to QEMU, which is useful for debugging and documentation generation. -from __future__ import print_function import json import ast import readline diff --git a/scripts/qmp/qom-get b/scripts/qmp/qom-get index ec5275d53a..007b4cd442 100755 --- a/scripts/qmp/qom-get +++ b/scripts/qmp/qom-get @@ -11,7 +11,6 @@ # the COPYING file in the top-level directory. ## -from __future__ import print_function import sys import os from qmp import QEMUMonitorProtocol diff --git a/scripts/qmp/qom-list b/scripts/qmp/qom-list index 0f97440973..03bda3446b 100755 --- a/scripts/qmp/qom-list +++ b/scripts/qmp/qom-list @@ -11,7 +11,6 @@ # the COPYING file in the top-level directory. ## -from __future__ import print_function import sys import os from qmp import QEMUMonitorProtocol diff --git a/scripts/qmp/qom-set b/scripts/qmp/qom-set index 26ed9e3263..c37fe78b00 100755 --- a/scripts/qmp/qom-set +++ b/scripts/qmp/qom-set @@ -11,7 +11,6 @@ # the COPYING file in the top-level directory. ## -from __future__ import print_function import sys import os from qmp import QEMUMonitorProtocol diff --git a/scripts/qmp/qom-tree b/scripts/qmp/qom-tree index 31603c681f..1c8acf61e7 100755 --- a/scripts/qmp/qom-tree +++ b/scripts/qmp/qom-tree @@ -13,7 +13,6 @@ # the COPYING file in the top-level directory. ## -from __future__ import print_function import sys import os from qmp import QEMUMonitorProtocol diff --git a/scripts/replay-dump.py b/scripts/replay-dump.py index 0cdae879b7..4cbc1e47c6 100755 --- a/scripts/replay-dump.py +++ b/scripts/replay-dump.py @@ -18,7 +18,6 @@ # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, see . -from __future__ import print_function import argparse import struct from collections import namedtuple diff --git a/scripts/signrom.py b/scripts/signrom.py index 9be5dab1cf..43693dba56 100755 --- a/scripts/signrom.py +++ b/scripts/signrom.py @@ -1,6 +1,5 @@ #!/usr/bin/env python3 -from __future__ import print_function # # Option ROM signing utility # diff --git a/scripts/simpletrace.py b/scripts/simpletrace.py index 2bc043112a..20f0026066 100755 --- a/scripts/simpletrace.py +++ b/scripts/simpletrace.py @@ -9,7 +9,6 @@ # # For help see docs/devel/tracing.txt -from __future__ import print_function import struct import inspect from tracetool import read_events, Event diff --git a/scripts/vmstate-static-checker.py b/scripts/vmstate-static-checker.py index d44dedd9e9..539ead62b4 100755 --- a/scripts/vmstate-static-checker.py +++ b/scripts/vmstate-static-checker.py @@ -19,7 +19,6 @@ # You should have received a copy of the GNU General Public License along # with this program; if not, see . -from __future__ import print_function import argparse import json import sys diff --git a/tests/docker/travis.py b/tests/docker/travis.py index 62fccc5ebb..37307ac366 100755 --- a/tests/docker/travis.py +++ b/tests/docker/travis.py @@ -11,7 +11,6 @@ # or (at your option) any later version. See the COPYING file in # the top-level directory. -from __future__ import print_function import sys import yaml import itertools diff --git a/tests/guest-debug/test-gdbstub.py b/tests/guest-debug/test-gdbstub.py index c7e3986a24..98a5df4d42 100644 --- a/tests/guest-debug/test-gdbstub.py +++ b/tests/guest-debug/test-gdbstub.py @@ -1,4 +1,3 @@ -from __future__ import print_function # # This script needs to be run on startup # qemu -kernel ${KERNEL} -s -S diff --git a/tests/migration/guestperf/engine.py b/tests/migration/guestperf/engine.py index 1dd04ce33b..fd63c66601 100644 --- a/tests/migration/guestperf/engine.py +++ b/tests/migration/guestperf/engine.py @@ -1,4 +1,3 @@ -from __future__ import print_function # # Migration test main engine # diff --git a/tests/migration/guestperf/plot.py b/tests/migration/guestperf/plot.py index aa98912a82..34cebd54ba 100644 --- a/tests/migration/guestperf/plot.py +++ b/tests/migration/guestperf/plot.py @@ -1,4 +1,3 @@ -from __future__ import print_function # # Migration test graph plotting # diff --git a/tests/migration/guestperf/shell.py b/tests/migration/guestperf/shell.py index 61d2abbaad..5bcc066bb9 100644 --- a/tests/migration/guestperf/shell.py +++ b/tests/migration/guestperf/shell.py @@ -1,4 +1,3 @@ -from __future__ import print_function # # Migration test command line shell integration # diff --git a/tests/qapi-schema/test-qapi.py b/tests/qapi-schema/test-qapi.py index 503fb8ad25..41232c11a3 100755 --- a/tests/qapi-schema/test-qapi.py +++ b/tests/qapi-schema/test-qapi.py @@ -11,7 +11,6 @@ # See the COPYING file in the top-level directory. # -from __future__ import print_function import argparse import difflib diff --git a/tests/qemu-iotests/149 b/tests/qemu-iotests/149 index 0a7b765d07..b4a21bf7b7 100755 --- a/tests/qemu-iotests/149 +++ b/tests/qemu-iotests/149 @@ -20,7 +20,6 @@ # Exercise the QEMU 'luks' block driver to validate interoperability # with the Linux dm-crypt + cryptsetup implementation -from __future__ import print_function import subprocess import os import os.path diff --git a/tests/qemu-iotests/165 b/tests/qemu-iotests/165 index b60a803dae..fb56a769b4 100755 --- a/tests/qemu-iotests/165 +++ b/tests/qemu-iotests/165 @@ -18,7 +18,6 @@ # along with this program. If not, see . # -from __future__ import print_function import os import re import iotests diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index ead04a1ab5..0473e824ed 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -1,4 +1,3 @@ -from __future__ import print_function # Common utilities and Python wrappers for qemu-iotests # # Copyright (C) 2012 IBM Corp. diff --git a/tests/qemu-iotests/nbd-fault-injector.py b/tests/qemu-iotests/nbd-fault-injector.py index b158dd65a2..588d62aebf 100755 --- a/tests/qemu-iotests/nbd-fault-injector.py +++ b/tests/qemu-iotests/nbd-fault-injector.py @@ -43,7 +43,6 @@ # This work is licensed under the terms of the GNU GPL, version 2 or later. # See the COPYING file in the top-level directory. -from __future__ import print_function import sys import socket import struct diff --git a/tests/qemu-iotests/qcow2.py b/tests/qemu-iotests/qcow2.py index 1c4fa2b09f..94a07b2f6f 100755 --- a/tests/qemu-iotests/qcow2.py +++ b/tests/qemu-iotests/qcow2.py @@ -1,6 +1,5 @@ #!/usr/bin/env python3 -from __future__ import print_function import sys import struct import string diff --git a/tests/qemu-iotests/qed.py b/tests/qemu-iotests/qed.py index 36bca1de23..d6bec96069 100755 --- a/tests/qemu-iotests/qed.py +++ b/tests/qemu-iotests/qed.py @@ -10,7 +10,6 @@ # This work is licensed under the terms of the GNU GPL, version 2 or later. # See the COPYING file in the top-level directory. -from __future__ import print_function import sys import struct import random diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py index 30714fa1a8..4dee6647e6 100644 --- a/tests/vm/basevm.py +++ b/tests/vm/basevm.py @@ -11,7 +11,6 @@ # the COPYING file in the top-level directory. # -from __future__ import print_function import os import re import sys From 66e7dde18cc4085ca47124be4ca08fa8e6bcdd3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Thu, 6 Feb 2020 16:31:20 +0000 Subject: [PATCH 46/46] .readthedocs.yml: specify some minimum python requirements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QEMU is all about the Python 3 now so lets also hint that to ReadTheDocs in its config file. Signed-off-by: Alex Bennée Reviewed-by: Peter Maydell Message-Id: <20200206163120.31899-1-alex.bennee@linaro.org> Signed-off-by: Philippe Mathieu-Daudé --- .readthedocs.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .readthedocs.yml diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 0000000000..8355dbc634 --- /dev/null +++ b/.readthedocs.yml @@ -0,0 +1,20 @@ +# .readthedocs.yml +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required +version: 2 + +# Build documentation in the docs/ directory with Sphinx +sphinx: + configuration: docs/conf.py + +# We want all the document formats +formats: all + +# For consistency, we require that QEMU's Sphinx extensions +# run with at least the same minimum version of Python that +# we require for other Python in our codebase (our conf.py +# enforces this, and some code needs it.) +python: + version: 3.5