On 5/7/26 14:47, Peter Maydell wrote:
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 <[email protected]>
---
  tests/functional/aarch64/test_kvm.py | 10 +++++++++-
  1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/tests/functional/aarch64/test_kvm.py 
b/tests/functional/aarch64/test_kvm.py
index fed18aba60..c977e8c6d2 100755
--- a/tests/functional/aarch64/test_kvm.py
+++ b/tests/functional/aarch64/test_kvm.py
@@ -14,6 +14,7 @@
  from qemu_test import Asset
  from qemu_test import exec_command_and_wait_for_pattern as ec_and_wait
  from qemu_test.linuxkernel import LinuxKernelTest
+from qemu.machine.machine import VMLaunchFailure
class Aarch64VirtKVMTests(LinuxKernelTest):
@@ -44,7 +45,14 @@ def _launch_guest(self, kvm_mode="nvhe"):
                           '-append', kernel_command_line)
          self.vm.add_args("-smp", "2", "-m", "320")
- self.vm.launch()
+        try:
+            self.vm.launch()
+        except VMLaunchFailure as excp:
+            if "does not support providing Virtualization" in excp.output:
+                self.skipTest("accelerator has no virtualization support")
+            else:
+                self.log.info("unhandled launch failure: %s", excp.output)
+                raise excp
self.wait_for_console_pattern('buildroot login:')
          ec_and_wait(self, 'root', '#')

Reviewed-by: Richard Henderson <[email protected]>

r~

Reply via email to