[RFC PATCH RESEND 41/42] tests/functional: Add split_available() helper

Philippe Mathieu-Daudé posted 42 patches 4 months, 3 weeks ago
[RFC PATCH RESEND 41/42] tests/functional: Add split_available() helper
Posted by Philippe Mathieu-Daudé 4 months, 3 weeks ago
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 python/qemu/utils/__init__.py          |  3 ++-
 python/qemu/utils/accel.py             | 10 ++++++++++
 tests/functional/qemu_test/testcase.py |  4 +++-
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/python/qemu/utils/__init__.py b/python/qemu/utils/__init__.py
index d2fe5db223c..74218b9f2c6 100644
--- a/python/qemu/utils/__init__.py
+++ b/python/qemu/utils/__init__.py
@@ -23,7 +23,8 @@
 from typing import Optional
 
 # pylint: disable=import-error
-from .accel import hvf_available, kvm_available, list_accel, tcg_available
+from .accel import hvf_available, kvm_available, list_accel, tcg_available, \
+                   split_available
 
 
 __all__ = (
diff --git a/python/qemu/utils/accel.py b/python/qemu/utils/accel.py
index 376d1e30005..0f58998b2f7 100644
--- a/python/qemu/utils/accel.py
+++ b/python/qemu/utils/accel.py
@@ -90,3 +90,13 @@ def hvf_available(qemu_bin: str) -> bool:
     @param qemu_bin (str): path to the QEMU binary
     """
     return 'hvf' in list_accel(qemu_bin)
+
+def split_available(qemu_bin: str) -> bool:
+    """
+    Check if split accelerator is available.
+
+    @param qemu_bin (str): path to the QEMU binary
+    """
+    return 'split' in list_accel(qemu_bin) \
+           and tcg_available(qemu_bin) \
+           and hvf_available(qemu_bin)
diff --git a/tests/functional/qemu_test/testcase.py b/tests/functional/qemu_test/testcase.py
index 2082c6fce43..b6a534a29f0 100644
--- a/tests/functional/qemu_test/testcase.py
+++ b/tests/functional/qemu_test/testcase.py
@@ -23,7 +23,8 @@
 import uuid
 
 from qemu.machine import QEMUMachine
-from qemu.utils import hvf_available, kvm_available, tcg_available
+from qemu.utils import hvf_available, kvm_available, tcg_available, \
+                       split_available
 
 from .archive import archive_extract
 from .asset import Asset
@@ -319,6 +320,7 @@ def require_accelerator(self, accelerator):
         checker = {'tcg': tcg_available,
                    'kvm': kvm_available,
                    'hvf': hvf_available,
+                   'split': split_available,
                   }.get(accelerator)
         if checker is None:
             self.skipTest("Don't know how to check for the presence "
-- 
2.49.0


Re: [RFC PATCH RESEND 41/42] tests/functional: Add split_available() helper
Posted by Richard Henderson 4 months, 3 weeks ago
On 6/20/25 10:27, Philippe Mathieu-Daudé wrote:
> +    return 'split' in list_accel(qemu_bin) \
> +           and tcg_available(qemu_bin) \
> +           and hvf_available(qemu_bin)

Do you really need 3 checks?  Kconfig gates on this already.

r~