Skip to content

Commit 0d3af96

Browse files
committed
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 <[email protected]> Signed-off-by: Alex Bennée <[email protected]> Message-Id: <[email protected]>
1 parent f2e1161 commit 0d3af96

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

tests/functional/test_aarch64_virt.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ def test_alpine_virt_tcg_gic_max(self):
4040
iso_path = self.ASSET_ALPINE_ISO.fetch()
4141

4242
self.set_machine('virt')
43-
self.vm.set_console()
4443
self.require_accelerator("tcg")
4544

45+
self.vm.set_console()
4646
self.vm.add_args("-accel", "tcg")
4747
self.vm.add_args("-cpu", "max,pauth-impdef=on")
4848
self.vm.add_args("-machine",
@@ -71,15 +71,16 @@ def common_aarch64_virt(self, machine):
7171
Common code to launch basic virt machine with kernel+initrd
7272
and a scratch disk.
7373
"""
74+
self.set_machine('virt')
75+
self.require_accelerator("tcg")
76+
7477
logger = logging.getLogger('aarch64_virt')
7578

7679
kernel_path = self.ASSET_KERNEL.fetch()
7780

78-
self.set_machine('virt')
7981
self.vm.set_console()
8082
kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
8183
'console=ttyAMA0')
82-
self.require_accelerator("tcg")
8384
self.vm.add_args('-cpu', 'max,pauth-impdef=on',
8485
'-machine', machine,
8586
'-accel', 'tcg',
@@ -100,7 +101,9 @@ def common_aarch64_virt(self, machine):
100101

101102
# Add the device
102103
self.vm.add_args('-blockdev',
103-
f"driver=qcow2,file.driver=file,file.filename={image_path},node-name=scratch")
104+
"driver=qcow2,"
105+
"file.driver=file,"
106+
f"file.filename={image_path},node-name=scratch")
104107
self.vm.add_args('-device',
105108
'virtio-blk-device,drive=scratch')
106109

0 commit comments

Comments
 (0)