]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
tests/functional: Add hvf_available() helper
authorPeter Maydell <peter.maydell@linaro.org>
Tue, 1 Jul 2025 16:22:27 +0000 (17:22 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Tue, 1 Jul 2025 16:22:27 +0000 (17:22 +0100)
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-id: 20250623121845.7214-26-philmd@linaro.org
[PMM: tweaks to satisfy the python linter CI job]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
python/qemu/utils/__init__.py
python/qemu/utils/accel.py
tests/functional/qemu_test/testcase.py

index 017cfdcda75b5fcbbcae622eccfd2520f4ada81d..be5daa836340a650e9bce63bb6bb194d893a6bf0 100644 (file)
@@ -23,13 +23,19 @@ import textwrap
 from typing import Optional
 
 # pylint: disable=import-error
-from .accel import kvm_available, list_accel, tcg_available
+from .accel import (
+    hvf_available,
+    kvm_available,
+    list_accel,
+    tcg_available,
+)
 
 
 __all__ = (
     'VerboseProcessError',
     'add_visual_margin',
     'get_info_usernet_hostfwd_port',
+    'hvf_available',
     'kvm_available',
     'list_accel',
     'tcg_available',
index 386ff640ca81b6d3aeb096ca1a491931cf34f23e..f915b646692eb821da69563ca66c79491fc949a4 100644 (file)
@@ -82,3 +82,12 @@ def tcg_available(qemu_bin: str) -> bool:
     @param qemu_bin (str): path to the QEMU binary
     """
     return 'tcg' in list_accel(qemu_bin)
+
+
+def hvf_available(qemu_bin: str) -> bool:
+    """
+    Check if HVF is available.
+
+    @param qemu_bin (str): path to the QEMU binary
+    """
+    return 'hvf' in list_accel(qemu_bin)
index 50c401b8c3c3de758d1f4459574ce938a0da0901..2082c6fce43b0544d4e4258cd4155f555ed30cd4 100644 (file)
@@ -23,7 +23,7 @@ import unittest
 import uuid
 
 from qemu.machine import QEMUMachine
-from qemu.utils import kvm_available, tcg_available
+from qemu.utils import hvf_available, kvm_available, tcg_available
 
 from .archive import archive_extract
 from .asset import Asset
@@ -317,7 +317,9 @@ class QemuSystemTest(QemuBaseTest):
         :type accelerator: str
         """
         checker = {'tcg': tcg_available,
-                   'kvm': kvm_available}.get(accelerator)
+                   'kvm': kvm_available,
+                   'hvf': hvf_available,
+                  }.get(accelerator)
         if checker is None:
             self.skipTest("Don't know how to check for the presence "
                           "of accelerator %s" % accelerator)