This class is used to test QEMU machines, rename it as MachineTest. This will allow us to add a UserTest class for qemu-user tests.
Signed-off-by: Philippe Mathieu-Daudé <phi...@redhat.com> --- docs/devel/testing.rst | 8 ++++---- tests/acceptance/avocado_qemu/__init__.py | 7 ++++++- tests/acceptance/boot_linux_console.py | 4 ++-- tests/acceptance/cpu_queries.py | 4 ++-- tests/acceptance/empty_cpu_model.py | 4 ++-- tests/acceptance/linux_initrd.py | 4 ++-- tests/acceptance/linux_ssh_mips_malta.py | 4 ++-- tests/acceptance/migration.py | 4 ++-- tests/acceptance/version.py | 4 ++-- tests/acceptance/virtio_version.py | 4 ++-- tests/acceptance/vnc.py | 4 ++-- 11 files changed, 28 insertions(+), 23 deletions(-) diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst index da2d0fc964..5b911e153d 100644 --- a/docs/devel/testing.rst +++ b/docs/devel/testing.rst @@ -599,7 +599,7 @@ class. Here's a simple usage example: from avocado_qemu import Test - class Version(Test): + class Version(MachineTest): """ :avocado: tags=quick """ @@ -623,7 +623,7 @@ in the current directory, tagged as "quick", run: avocado run -t quick . -The ``avocado_qemu.Test`` base test class +The ``avocado_qemu.MachineTest`` base test class ----------------------------------------- The ``avocado_qemu.Test`` class has a number of characteristics that @@ -644,10 +644,10 @@ and hypothetical example follows: .. code:: - from avocado_qemu import Test + from avocado_qemu import MachineTest - class MultipleMachines(Test): + class MultipleMachines(MachineTest): """ :avocado: enable """ diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py index 2b236a1cf0..84fe090458 100644 --- a/tests/acceptance/avocado_qemu/__init__.py +++ b/tests/acceptance/avocado_qemu/__init__.py @@ -52,7 +52,6 @@ def pick_default_qemu_bin(arch=None): class Test(avocado.Test): def setUp(self): - self._vms = {} arches = self.tags.get('arch', []) if len(arches) == 1: arch = arches.pop() @@ -65,6 +64,12 @@ class Test(avocado.Test): if self.qemu_bin is None: self.cancel("No QEMU binary defined or found in the source tree") + +class MachineTest(Test): + def setUp(self): + self._vms = {} + super().setUp() + def _new_vm(self, *args): vm = QEMUMachine(self.qemu_bin) if args: diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py index 32159503e9..1a7b378413 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -14,12 +14,12 @@ import lzma import gzip import shutil -from avocado_qemu import Test +from avocado_qemu import MachineTest from avocado.utils import process from avocado.utils import archive -class BootLinuxConsole(Test): +class BootLinuxConsole(MachineTest): """ Boots a Linux kernel and checks that the console is operational and the kernel command line is properly passed from QEMU to the kernel diff --git a/tests/acceptance/cpu_queries.py b/tests/acceptance/cpu_queries.py index e71edec39f..30f545fe48 100644 --- a/tests/acceptance/cpu_queries.py +++ b/tests/acceptance/cpu_queries.py @@ -10,9 +10,9 @@ import logging -from avocado_qemu import Test +from avocado_qemu import MachineTest -class QueryCPUModelExpansion(Test): +class QueryCPUModelExpansion(MachineTest): """ Run query-cpu-model-expansion for each CPU model, and validate results """ diff --git a/tests/acceptance/empty_cpu_model.py b/tests/acceptance/empty_cpu_model.py index 3f4f663582..a4e9cc62f8 100644 --- a/tests/acceptance/empty_cpu_model.py +++ b/tests/acceptance/empty_cpu_model.py @@ -8,9 +8,9 @@ # This work is licensed under the terms of the GNU GPL, version 2 or # later. See the COPYING file in the top-level directory. import subprocess -from avocado_qemu import Test +from avocado_qemu import MachineTest -class EmptyCPUModel(Test): +class EmptyCPUModel(MachineTest): def test(self): cmd = [self.qemu_bin, '-S', '-display', 'none', '-machine', 'none', '-cpu', ''] r = subprocess.run(cmd, stderr=subprocess.PIPE, stdout=subprocess.PIPE) diff --git a/tests/acceptance/linux_initrd.py b/tests/acceptance/linux_initrd.py index 23be5a63aa..b9b2d3dab1 100644 --- a/tests/acceptance/linux_initrd.py +++ b/tests/acceptance/linux_initrd.py @@ -12,10 +12,10 @@ import logging import tempfile from avocado.utils.process import run -from avocado_qemu import Test +from avocado_qemu import MachineTest -class LinuxInitrd(Test): +class LinuxInitrd(MachineTest): """ Checks QEMU evaluates correctly the initrd file passed as -initrd option. diff --git a/tests/acceptance/linux_ssh_mips_malta.py b/tests/acceptance/linux_ssh_mips_malta.py index aafb0c39f6..8451d05f7c 100644 --- a/tests/acceptance/linux_ssh_mips_malta.py +++ b/tests/acceptance/linux_ssh_mips_malta.py @@ -13,12 +13,12 @@ import paramiko import time from avocado import skipIf -from avocado_qemu import Test +from avocado_qemu import MachineTest from avocado.utils import process from avocado.utils import archive -class LinuxSSH(Test): +class LinuxSSH(MachineTest): timeout = 150 # Not for 'configure --enable-debug --enable-debug-tcg' diff --git a/tests/acceptance/migration.py b/tests/acceptance/migration.py index 6115cf6c24..7fdb717628 100644 --- a/tests/acceptance/migration.py +++ b/tests/acceptance/migration.py @@ -10,13 +10,13 @@ # later. See the COPYING file in the top-level directory. -from avocado_qemu import Test +from avocado_qemu import MachineTest from avocado.utils import network from avocado.utils import wait -class Migration(Test): +class Migration(MachineTest): """ :avocado: enable """ diff --git a/tests/acceptance/version.py b/tests/acceptance/version.py index 67c2192c93..e11661f780 100644 --- a/tests/acceptance/version.py +++ b/tests/acceptance/version.py @@ -9,10 +9,10 @@ # later. See the COPYING file in the top-level directory. -from avocado_qemu import Test +from avocado_qemu import MachineTest -class Version(Test): +class Version(MachineTest): """ :avocado: tags=quick """ diff --git a/tests/acceptance/virtio_version.py b/tests/acceptance/virtio_version.py index 8b97453ff8..04c68e41e6 100644 --- a/tests/acceptance/virtio_version.py +++ b/tests/acceptance/virtio_version.py @@ -13,7 +13,7 @@ import os sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) from qemu import QEMUMachine -from avocado_qemu import Test +from avocado_qemu import MachineTest # Virtio Device IDs: VIRTIO_NET = 1 @@ -55,7 +55,7 @@ def get_pci_interfaces(vm, devtype): interfaces = ('pci-express-device', 'conventional-pci-device') return [i for i in interfaces if devtype_implements(vm, devtype, i)] -class VirtioVersionCheck(Test): +class VirtioVersionCheck(MachineTest): """ Check if virtio-version-specific device types result in the same device tree created by `disable-modern` and diff --git a/tests/acceptance/vnc.py b/tests/acceptance/vnc.py index 064ceabcc1..2c532dab5e 100644 --- a/tests/acceptance/vnc.py +++ b/tests/acceptance/vnc.py @@ -8,10 +8,10 @@ # 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 avocado_qemu import Test +from avocado_qemu import MachineTest -class Vnc(Test): +class Vnc(MachineTest): """ :avocado: tags=vnc,quick """ -- 2.20.1