[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 11/29] python/qemu: Add binutils::binary_get_accels()
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v2 11/29] python/qemu: Add binutils::binary_get_accels() |
Date: |
Wed, 29 Jan 2020 22:23:27 +0100 |
Add a helper to query the list of accelerators built into a
QEMU binary.
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
python/qemu/binutils.py | 10 ++++++++++
tests/acceptance/core_scripts.py | 10 ++++++++++
2 files changed, 20 insertions(+)
diff --git a/python/qemu/binutils.py b/python/qemu/binutils.py
index 76f256f5d2..bba203bc8d 100644
--- a/python/qemu/binutils.py
+++ b/python/qemu/binutils.py
@@ -86,3 +86,13 @@ def binary_get_qom_implementations(qemu_bin, type_name,
include_abstract=False):
LOG.info(res)
vm.shutdown()
return [m['name'] for m in res]
+
+def binary_get_accels(qemu_bin):
+ '''
+ Get list of accelerators supported by a QEMU binary
+
+ @param qemu_bin (str): path to the QEMU binary
+ @return list of accelerators supported by the binary
+ '''
+ accel_types = binary_get_qom_implementations(qemu_bin, "accel", False)
+ return [a.strip("-accel") for a in accel_types]
diff --git a/tests/acceptance/core_scripts.py b/tests/acceptance/core_scripts.py
index c2fe4acf1d..7380f2f49b 100644
--- a/tests/acceptance/core_scripts.py
+++ b/tests/acceptance/core_scripts.py
@@ -16,6 +16,7 @@ import logging
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python'))
from avocado_qemu import Test
+from qemu.binutils import binary_get_accels
from qemu.binutils import binary_get_arch
from qemu.binutils import binary_get_machines
from qemu.binutils import binary_get_qom_implementations
@@ -59,3 +60,12 @@ class PythonQemuCoreScripts(Test):
for t in type_impl:
logger.debug('type: {}'.format(t))
self.assertIn(type_name, type_impl)
+
+ def test_get_accels(self):
+ logger = logging.getLogger('core')
+ accels = binary_get_accels(self.qemu_bin)
+ for a in accels:
+ logger.debug('accel: {}'.format(a))
+ self.assertNotIn("accel", accels)
+ # qtest is always available
+ self.assertIn("qtest", accels)
--
2.21.1
- [PATCH v2 05/29] tests/acceptance: Restrict X86CPUModelAliases test to QEMU >= 4.1, (continued)
- [PATCH v2 05/29] tests/acceptance: Restrict X86CPUModelAliases test to QEMU >= 4.1, Philippe Mathieu-Daudé, 2020/01/29
- [PATCH v2 06/29] python/qemu: Add binutils::binary_get_arch(), Philippe Mathieu-Daudé, 2020/01/29
- [PATCH v2 07/29] tests/acceptance: Use the 'arch' tag to verify QEMU binary target, Philippe Mathieu-Daudé, 2020/01/29
- [PATCH v2 08/29] python/qemu: Add binutils::binary_get_machines(), Philippe Mathieu-Daudé, 2020/01/29
- [PATCH v2 10/29] python/qemu: Add binutils::binary_get_qom_implementations(), Philippe Mathieu-Daudé, 2020/01/29
- [PATCH v2 09/29] tests/acceptance: Use 'machine' tag to check if available in QEMU binary, Philippe Mathieu-Daudé, 2020/01/29
- [PATCH v2 11/29] python/qemu: Add binutils::binary_get_accels(),
Philippe Mathieu-Daudé <=
- [PATCH v2 12/29] python/qemu/accel: Use binutils::binary_get_accels(), Philippe Mathieu-Daudé, 2020/01/29
- [PATCH v2 13/29] python/qemu: Add binutils::binary_get_devices(), Philippe Mathieu-Daudé, 2020/01/29
- [PATCH v2 15/29] tests: rename virtio_seg_max_adjust to virtio_check_params, Philippe Mathieu-Daudé, 2020/01/29
- [RFC PATCH v2 14/29] tests/acceptance: Use 'device' tags to check availability in QEMU binary, Philippe Mathieu-Daudé, 2020/01/29
- [PATCH v2 16/29] tests/acceptance/virtio_check_params: Only remove listed machines, Philippe Mathieu-Daudé, 2020/01/29
- [PATCH v2 17/29] tests/acceptance/virtio_check_params: Improve exception logging, Philippe Mathieu-Daudé, 2020/01/29
- [PATCH v2 19/29] tests/acceptance/virtio_check_params: Only test Xen as superuser, Philippe Mathieu-Daudé, 2020/01/29