qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 4/6] qtest.py: add verify_machine(supported_machines


From: Philippe Mathieu-Daudé
Subject: [Qemu-devel] [PATCH 4/6] qtest.py: add verify_machine(supported_machines)
Date: Wed, 13 Dec 2017 18:35:55 -0300

We can now restrict tests to specific machines.

Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
 scripts/qtest.py | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/scripts/qtest.py b/scripts/qtest.py
index 733686a6fe..429eb67c2a 100644
--- a/scripts/qtest.py
+++ b/scripts/qtest.py
@@ -19,6 +19,7 @@ import re
 import unittest
 import logging
 import tempfile
+import subprocess
 
 
 qemu_prog = os.environ.get('QEMU_PROG', 'qemu')
@@ -210,3 +211,18 @@ def notrun(reason):
 def verify_platform(supported_oses=['linux']):
     if True not in [sys.platform.startswith(x) for x in supported_oses]:
         notrun('not suitable for this OS: %s' % sys.platform)
+
+def verify_machine(supported_machines):
+    if 'any' in supported_machines:
+        return
+    args = list((qemu_prog, "-machine", "help"))
+    subp = subprocess.Popen(args, stdout=subprocess.PIPE,
+                            stderr=subprocess.STDOUT)
+    exitcode = subp.wait()
+    if exitcode < 0:
+        sys.stderr.write('qemu received signal %i: %s\n' % (-exitcode,
+                                                            ' '.join(args)))
+    machines = re.split("\n([\w\.-]+)\s.*", subp.communicate()[0])
+
+    if True not in [x in machines for x in supported_machines]:
+        notrun('not machine suitable for this test')
-- 
2.15.1




reply via email to

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