summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2020-02-10 12:07:26 +0000
committerPeter Maydell <peter.maydell@linaro.org>2020-02-10 12:07:26 +0000
commit73d336510cf118fcc2ee7e98e774a193cf661614 (patch)
treef2f147fd31878ca2c21a16b9b5d2723ae4db7b6d /tests
parent93c86fff53a267f657e79ec07dcd04b63882e330 (diff)
parent66e7dde18cc4085ca47124be4ca08fa8e6bcdd3a (diff)
downloadqemu-73d336510cf118fcc2ee7e98e774a193cf661614.zip
Merge remote-tracking branch 'remotes/philmd-gitlab/tags/python-next-20200207' into staging
- Python 3 cleanups: . Remove text about Python 2 in qemu-deprecated (Thomas) . Remove shebang header (Paolo, Philippe) . scripts/checkpatch.pl now allows Python 3 interpreter (Philippe) . Explicit usage of Python 3 interpreter in scripts (Philippe) . Fix Python scripts permissions (Paolo, Philippe) . Drop 'from __future__ import print_function' (Paolo) . Specify minimum python requirements in ReadTheDocs configuration (Alex) - Test UNIX/EXEC transports with migration (Oksana) - Added extract_from_rpm helper, improved extract_from_deb (Liam) - Allow to use other serial consoles than default one (Philippe) - Various improvements in QEMUMonitorProtocol (Wainer) - Fix kvm_available() on ppc64le (Wainer) # gpg: Signature made Fri 07 Feb 2020 15:01:56 GMT # gpg: using RSA key FAABE75E12917221DCFD6BB2E3E32C2CDEADC0DE # gpg: Good signature from "Philippe Mathieu-Daudé (F4BUG) <f4bug@amsat.org>" [full] # Primary key fingerprint: FAAB E75E 1291 7221 DCFD 6BB2 E3E3 2C2C DEAD C0DE * remotes/philmd-gitlab/tags/python-next-20200207: (46 commits) .readthedocs.yml: specify some minimum python requirements drop "from __future__ import print_function" make all Python scripts executable scripts/signrom: remove Python 2 support, add shebang tests/qemu-iotests/check: Only check for Python 3 interpreter scripts: Explicit usage of Python 3 (scripts without __main__) tests/qemu-iotests: Explicit usage of Python3 (scripts without __main__) tests/vm: Remove shebang header tests/acceptance: Remove shebang header scripts/tracetool: Remove shebang header scripts/minikconf: Explicit usage of Python 3 scripts: Explicit usage of Python 3 (scripts with __main__) tests: Explicit usage of Python 3 tests/qemu-iotests: Explicit usage of Python 3 (scripts with __main__) tests/qemu-iotests/check: Allow use of python3 interpreter scripts/checkpatch.pl: Only allow Python 3 interpreter tests/acceptance/migration: Default to -nodefaults tests/acceptance/migration: Add the 'migration' tag tests/acceptance/migration: Test EXEC transport when migrating tests/acceptance/migration: Test UNIX transport when migrating ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/acceptance/avocado_qemu/__init__.py59
-rw-r--r--tests/acceptance/boot_linux_console.py124
-rw-r--r--tests/acceptance/migration.py57
-rw-r--r--tests/acceptance/version.py1
-rw-r--r--[-rwxr-xr-x]tests/acceptance/virtio_check_params.py (renamed from tests/acceptance/virtio_seg_max_adjust.py)16
-rw-r--r--tests/acceptance/x86_cpu_model_versions.py1
-rwxr-xr-xtests/docker/travis.py3
-rw-r--r--tests/guest-debug/test-gdbstub.py1
-rw-r--r--tests/migration/guestperf/engine.py1
-rw-r--r--tests/migration/guestperf/plot.py1
-rw-r--r--tests/migration/guestperf/shell.py1
-rwxr-xr-xtests/qapi-schema/test-qapi.py3
-rwxr-xr-xtests/qemu-iotests/0302
-rwxr-xr-xtests/qemu-iotests/0402
-rwxr-xr-xtests/qemu-iotests/0412
-rwxr-xr-xtests/qemu-iotests/0442
-rwxr-xr-xtests/qemu-iotests/0452
-rwxr-xr-xtests/qemu-iotests/0552
-rwxr-xr-xtests/qemu-iotests/0562
-rwxr-xr-xtests/qemu-iotests/0572
-rwxr-xr-xtests/qemu-iotests/0652
-rwxr-xr-xtests/qemu-iotests/0932
-rwxr-xr-xtests/qemu-iotests/0962
-rwxr-xr-xtests/qemu-iotests/1182
-rwxr-xr-xtests/qemu-iotests/1242
-rwxr-xr-xtests/qemu-iotests/1292
-rwxr-xr-xtests/qemu-iotests/1322
-rwxr-xr-xtests/qemu-iotests/1362
-rwxr-xr-xtests/qemu-iotests/1392
-rwxr-xr-xtests/qemu-iotests/1472
-rwxr-xr-xtests/qemu-iotests/1482
-rwxr-xr-xtests/qemu-iotests/1493
-rwxr-xr-xtests/qemu-iotests/1512
-rwxr-xr-xtests/qemu-iotests/1522
-rwxr-xr-xtests/qemu-iotests/1552
-rwxr-xr-xtests/qemu-iotests/1632
-rwxr-xr-xtests/qemu-iotests/1653
-rwxr-xr-xtests/qemu-iotests/1692
-rwxr-xr-xtests/qemu-iotests/1942
-rwxr-xr-xtests/qemu-iotests/1962
-rwxr-xr-xtests/qemu-iotests/1992
-rwxr-xr-xtests/qemu-iotests/2022
-rwxr-xr-xtests/qemu-iotests/2032
-rwxr-xr-xtests/qemu-iotests/2052
-rwxr-xr-xtests/qemu-iotests/2062
-rwxr-xr-xtests/qemu-iotests/2072
-rwxr-xr-xtests/qemu-iotests/2082
-rwxr-xr-xtests/qemu-iotests/2092
-rwxr-xr-xtests/qemu-iotests/2102
-rwxr-xr-xtests/qemu-iotests/2112
-rwxr-xr-xtests/qemu-iotests/2122
-rwxr-xr-xtests/qemu-iotests/2132
-rwxr-xr-xtests/qemu-iotests/2162
-rwxr-xr-xtests/qemu-iotests/2182
-rwxr-xr-xtests/qemu-iotests/2192
-rwxr-xr-x[-rw-r--r--]tests/qemu-iotests/2222
-rwxr-xr-xtests/qemu-iotests/2242
-rwxr-xr-xtests/qemu-iotests/2282
-rwxr-xr-xtests/qemu-iotests/2342
-rwxr-xr-xtests/qemu-iotests/2352
-rwxr-xr-xtests/qemu-iotests/2362
-rwxr-xr-xtests/qemu-iotests/2372
-rwxr-xr-xtests/qemu-iotests/2382
-rwxr-xr-xtests/qemu-iotests/2422
-rwxr-xr-x[-rw-r--r--]tests/qemu-iotests/2452
-rwxr-xr-xtests/qemu-iotests/2462
-rwxr-xr-xtests/qemu-iotests/2482
-rwxr-xr-xtests/qemu-iotests/2542
-rwxr-xr-xtests/qemu-iotests/2552
-rwxr-xr-xtests/qemu-iotests/2562
-rwxr-xr-xtests/qemu-iotests/2572
-rwxr-xr-xtests/qemu-iotests/2582
-rwxr-xr-xtests/qemu-iotests/2602
-rwxr-xr-xtests/qemu-iotests/2622
-rwxr-xr-xtests/qemu-iotests/2642
-rwxr-xr-xtests/qemu-iotests/2662
-rwxr-xr-xtests/qemu-iotests/2772
-rwxr-xr-xtests/qemu-iotests/2802
-rwxr-xr-xtests/qemu-iotests/2812
-rw-r--r--tests/qemu-iotests/2832
-rwxr-xr-xtests/qemu-iotests/check2
-rw-r--r--tests/qemu-iotests/iotests.py1
-rwxr-xr-xtests/qemu-iotests/nbd-fault-injector.py3
-rwxr-xr-xtests/qemu-iotests/qcow2.py3
-rwxr-xr-xtests/qemu-iotests/qed.py3
-rw-r--r--[-rwxr-xr-x]tests/vm/basevm.py2
-rwxr-xr-xtests/vm/centos2
-rwxr-xr-xtests/vm/fedora2
-rwxr-xr-xtests/vm/freebsd2
-rwxr-xr-xtests/vm/netbsd2
-rwxr-xr-xtests/vm/openbsd2
-rwxr-xr-xtests/vm/ubuntu.i3862
92 files changed, 302 insertions, 130 deletions
diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py
index 6618ea67c1..d4358eb431 100644
--- a/tests/acceptance/avocado_qemu/__init__.py
+++ b/tests/acceptance/avocado_qemu/__init__.py
@@ -55,19 +55,16 @@ 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, 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())
+ if not keep_sending:
+ send_string = None # send only once
msg = console.readline().strip()
if not msg:
continue
@@ -79,6 +76,43 @@ def wait_for_console_pattern(test, success_message, failure_message=None):
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
+
+ :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 +128,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):
diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
index e40b84651b..34d37eba3b 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()
@@ -49,7 +49,28 @@ 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):
+ """
+ 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):
"""
@@ -304,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/'
@@ -519,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()
@@ -568,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')
diff --git a/tests/acceptance/migration.py b/tests/acceptance/migration.py
index a44c1ae58f..a8367ca023 100644
--- a/tests/acceptance/migration.py
+++ b/tests/acceptance/migration.py
@@ -10,13 +10,19 @@
# later. See the COPYING file in the top-level directory.
+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):
+ """
+ :avocado: tags=migration
+ """
timeout = 10
@@ -24,6 +30,28 @@ 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 do_migrate(self, dest_uri, src_uri=None):
+ 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)
+
def _get_free_port(self):
port = network.find_free_port()
if port is None:
@@ -32,19 +60,18 @@ 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)
- 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.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)
+
+ @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
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')
diff --git a/tests/acceptance/virtio_seg_max_adjust.py b/tests/acceptance/virtio_check_params.py
index 5458573138..87e6c839d1 100755..100644
--- a/tests/acceptance/virtio_seg_max_adjust.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
#
@@ -21,10 +20,12 @@
import sys
import os
import re
+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'}
@@ -73,12 +74,20 @@ 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"])
+ vm.add_args('-nodefaults')
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))
@@ -108,6 +117,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:
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
#
diff --git a/tests/docker/travis.py b/tests/docker/travis.py
index e1433012bd..37307ac366 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
#
@@ -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 bad14edb47..41232c11a3 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
#
@@ -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/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/149 b/tests/qemu-iotests/149
index 8ab42e94c6..b4a21bf7b7 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.
#
@@ -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/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..fb56a769b4 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.
#
@@ -18,7 +18,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-from __future__ import print_function
import os
import re
import iotests
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/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/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/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/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/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..100755
--- 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/245 b/tests/qemu-iotests/245
index d12b253065..489bf78bd0 100644..100755
--- 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/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/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/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/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/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
#
diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
index fff5fa956a..f7a2d3d6c3 100755
--- a/tests/qemu-iotests/check
+++ b/tests/qemu-iotests/check
@@ -846,7 +846,7 @@ do
start=$(_wallclock)
- if [ "$(head -n 1 "$source_iotests/$seq")" == "#!/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
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 7e2dab6ea4..588d62aebf 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:
@@ -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 91e4420b9f..94a07b2f6f 100755
--- a/tests/qemu-iotests/qcow2.py
+++ b/tests/qemu-iotests/qcow2.py
@@ -1,6 +1,5 @@
-#!/usr/bin/env python
+#!/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 8adaaf46c4..d6bec96069 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
#
@@ -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 ed5dd4f3d0..4dee6647e6 100755..100644
--- a/tests/vm/basevm.py
+++ b/tests/vm/basevm.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
#
# VM testing base class
#
@@ -12,7 +11,6 @@
# the COPYING file in the top-level directory.
#
-from __future__ import print_function
import os
import re
import sys
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
#