[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
- [Qemu-devel] [PATCH 0/6] QTests: use Python to run complex tests, Philippe Mathieu-Daudé, 2017/12/13
- [Qemu-devel] [PATCH 1/6] iotests.py: split BlockQMPTestCase class of QMPTestCase, Philippe Mathieu-Daudé, 2017/12/13
- [Qemu-devel] [PATCH 2/6] iotests.py: move the generic QMPTestCase to qtest.py, Philippe Mathieu-Daudé, 2017/12/13
- [Qemu-devel] [PATCH 3/6] qtest.py: use TMPDIR/TEMP if the TEST_DIR env var is missing, Philippe Mathieu-Daudé, 2017/12/13
- [Qemu-devel] [PATCH 4/6] qtest.py: add verify_machine(supported_machines),
Philippe Mathieu-Daudé <=
- [Qemu-devel] [PATCH 5/6] qtest.py: add a simple main() which calls unittest.main(), Philippe Mathieu-Daudé, 2017/12/13
- [Qemu-devel] [PATCH 6/6] tests: add a Makefile rule to run Python qtests, Philippe Mathieu-Daudé, 2017/12/13
- Re: [Qemu-devel] [PATCH 0/6] QTests: use Python to run complex tests, Stefan Hajnoczi, 2017/12/14
- Re: [Qemu-devel] [PATCH 0/6] QTests: use Python to run complex tests, Paolo Bonzini, 2017/12/14
- Re: [Qemu-devel] [Qemu-block] [PATCH 0/6] QTests: use Python to run complex tests, Nir Soffer, 2017/12/14
- Re: [Qemu-devel] [Qemu-block] [PATCH 0/6] QTests: use Python to run complex tests, Philippe Mathieu-Daudé, 2017/12/14
- Re: [Qemu-devel] [Qemu-block] [PATCH 0/6] QTests: use Python to run complex tests, Markus Armbruster, 2017/12/14
- Re: [Qemu-devel] [Qemu-block] [PATCH 0/6] QTests: use Python to run complex tests, Paolo Bonzini, 2017/12/14
- Re: [Qemu-devel] [Qemu-block] [PATCH 0/6] QTests: use Python to run complex tests, Peter Maydell, 2017/12/14
- Re: [Qemu-devel] [Qemu-block] [PATCH 0/6] QTests: use Python to run complex tests, Paolo Bonzini, 2017/12/14