qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 13/29] python/qemu: Add binutils::binary_get_devices()


From: Liam Merwick
Subject: Re: [PATCH v2 13/29] python/qemu: Add binutils::binary_get_devices()
Date: Fri, 7 Feb 2020 15:02:00 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1

On 29/01/2020 21:23, Philippe Mathieu-Daudé wrote:
Since QEMU binaries can be built with various configurations,
the list of devices linked in can vary.
Add a helper to query the list of devices built into a
QEMU binary.

Signed-off-by: Philippe Mathieu-Daudé <address@hidden>


Reviewed-by: Liam Merwick <address@hidden>


---
  python/qemu/binutils.py          | 9 +++++++++
  tests/acceptance/core_scripts.py | 8 ++++++++
  2 files changed, 17 insertions(+)

diff --git a/python/qemu/binutils.py b/python/qemu/binutils.py
index bba203bc8d..9633ba8efd 100644
--- a/python/qemu/binutils.py
+++ b/python/qemu/binutils.py
@@ -96,3 +96,12 @@ def binary_get_accels(qemu_bin):
      '''
      accel_types = binary_get_qom_implementations(qemu_bin, "accel", False)
      return [a.strip("-accel") for a in accel_types]
+
+def binary_get_devices(qemu_bin):
+    '''
+    Get list of devices supported by a QEMU binary
+
+    @param qemu_bin (str): path to the QEMU binary
+    @return list of devices supported by the binary
+    '''
+    return binary_get_qom_implementations(qemu_bin, "device", False)
diff --git a/tests/acceptance/core_scripts.py b/tests/acceptance/core_scripts.py
index 7380f2f49b..a62eb2e46b 100644
--- a/tests/acceptance/core_scripts.py
+++ b/tests/acceptance/core_scripts.py
@@ -18,6 +18,7 @@ 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_devices
  from qemu.binutils import binary_get_machines
  from qemu.binutils import binary_get_qom_implementations
  from qemu.binutils import binary_get_version
@@ -69,3 +70,10 @@ class PythonQemuCoreScripts(Test):
          self.assertNotIn("accel", accels)
          # qtest is always available
          self.assertIn("qtest", accels)
+
+    def test_get_devices(self):
+        logger = logging.getLogger('core')
+        devices = binary_get_devices(self.qemu_bin)
+        for d in devices:
+            logger.debug('device: {}'.format(d))
+        self.assertIn("migration", devices)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]