@samitouri / QOSamiQemu / commits / e0522eff89

tests/functional/test_kvm.py: Skip if virtualization not supported

The test_kvm test runs the virt board with virtualization=on, which will fail if run with an accelerator that doesn't support nested virtualization. Catch the VMLaunchFailure exception and skip the test if startup failed because the accelerator can't support virtualization. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20260507194728.2034696-5-peter.maydell@linaro.org

Peter Maydell committed May 7, 2026 at 20:47 UTC e0522eff89e4697e0463894dc03e31bf3de0e3cc
1 file changed +9 -1
tests/functional/aarch64/test_kvm.py
+9 -1
@@ -14,6 +14,7 @@
14 from qemu_test import Asset
15 from qemu_test import exec_command_and_wait_for_pattern as ec_and_wait
16 from qemu_test.linuxkernel import LinuxKernelTest
17 +from qemu.machine.machine import VMLaunchFailure
18
19
20 class Aarch64VirtKVMTests(LinuxKernelTest):
@@ -44,7 +45,14 @@ class Aarch64VirtKVMTests(LinuxKernelTest):
45 '-append', kernel_command_line)
46 self.vm.add_args("-smp", "2", "-m", "320")
47
47 - self.vm.launch()
48 + try:
49 + self.vm.launch()
50 + except VMLaunchFailure as excp:
51 + if "does not support providing Virtualization" in excp.output:
52 + self.skipTest("accelerator has no virtualization support")
53 + else:
54 + self.log.info("unhandled launch failure: %s", excp.output)
55 + raise excp
56
57 self.wait_for_console_pattern('buildroot login:')
58 ec_and_wait(self, 'root', '#')