summary refs log tree commit diff stats
path: root/tests/functional/test_aarch64_virt.py
diff options
context:
space:
mode:
authorAlex Bennée <alex.bennee@linaro.org>2025-01-08 12:10:44 +0000
committerAlex Bennée <alex.bennee@linaro.org>2025-01-10 11:18:32 +0000
commit0d3af961f751e0b424828d25e2ca47bc8729485c (patch)
tree21b225bf086f91e0cffc69339a1393ae4a99ab4b /tests/functional/test_aarch64_virt.py
parentf2e116184e723e23f7e0c3099db57e3c53cb3a7e (diff)
downloadfocaccia-qemu-0d3af961f751e0b424828d25e2ca47bc8729485c.tar.gz
focaccia-qemu-0d3af961f751e0b424828d25e2ca47bc8729485c.zip
tests/functional: bail aarch64_virt tests early if missing TCG
The set_machine and require_accelerator steps can bail early so move
those to the front of the test functions. While we are at it also
clean up some long lines when adding the vm arguments.

Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20250108121054.1126164-23-alex.bennee@linaro.org>
Diffstat (limited to 'tests/functional/test_aarch64_virt.py')
-rwxr-xr-xtests/functional/test_aarch64_virt.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/tests/functional/test_aarch64_virt.py b/tests/functional/test_aarch64_virt.py
index b3d3b0ee51..201c5ed023 100755
--- a/tests/functional/test_aarch64_virt.py
+++ b/tests/functional/test_aarch64_virt.py
@@ -40,9 +40,9 @@ class Aarch64VirtMachine(QemuSystemTest):
         iso_path = self.ASSET_ALPINE_ISO.fetch()
 
         self.set_machine('virt')
-        self.vm.set_console()
         self.require_accelerator("tcg")
 
+        self.vm.set_console()
         self.vm.add_args("-accel", "tcg")
         self.vm.add_args("-cpu", "max,pauth-impdef=on")
         self.vm.add_args("-machine",
@@ -71,15 +71,16 @@ class Aarch64VirtMachine(QemuSystemTest):
         Common code to launch basic virt machine with kernel+initrd
         and a scratch disk.
         """
+        self.set_machine('virt')
+        self.require_accelerator("tcg")
+
         logger = logging.getLogger('aarch64_virt')
 
         kernel_path = self.ASSET_KERNEL.fetch()
 
-        self.set_machine('virt')
         self.vm.set_console()
         kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
                                'console=ttyAMA0')
-        self.require_accelerator("tcg")
         self.vm.add_args('-cpu', 'max,pauth-impdef=on',
                          '-machine', machine,
                          '-accel', 'tcg',
@@ -100,7 +101,9 @@ class Aarch64VirtMachine(QemuSystemTest):
 
         # Add the device
         self.vm.add_args('-blockdev',
-                         f"driver=qcow2,file.driver=file,file.filename={image_path},node-name=scratch")
+                         "driver=qcow2,"
+                         "file.driver=file,"
+                         f"file.filename={image_path},node-name=scratch")
         self.vm.add_args('-device',
                          'virtio-blk-device,drive=scratch')