From: Eduardo Habkost <ehabkost@redhat.com>
To: qemu-devel@nongnu.org
Cc: Thomas Huth <thuth@redhat.com>,
Peter Maydell <peter.maydell@linaro.org>,
Cleber Rosa <crosa@redhat.com>
Subject: [Qemu-devel] [PATCH 3/8] device-crash-test: Accept machine=DEFAULT to test the default machine
Date: Fri, 9 Mar 2018 17:28:22 -0300 [thread overview]
Message-ID: <20180309202827.12085-4-ehabkost@redhat.com> (raw)
In-Reply-To: <20180309202827.12085-1-ehabkost@redhat.com>
This will be useful for running a smaller test set on
"make check", instead of testing every single machine-type/device
combination.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
scripts/device-crash-test | 29 +++++++++++++++++++++++++++--
1 file changed, 27 insertions(+), 2 deletions(-)
diff --git a/scripts/device-crash-test b/scripts/device-crash-test
index 364c779cdb..632b128e44 100755
--- a/scripts/device-crash-test
+++ b/scripts/device-crash-test
@@ -41,6 +41,11 @@ Test a single QEMU binary:
device-crash-test /path/to/qemu/binary
+Test all QEMU binaries found in the current directory, using only the default
+machine-type:
+
+ device-crash-test -t machine=DEFAULT
+
"""
import sys
@@ -357,7 +362,7 @@ class QemuBinaryInfo(object):
# there's no way to query DeviceClass::user_creatable using QMP,
# so use 'info qdm':
self.no_user_devs = set([d['name'] for d in infoQDM(vm, ) if d['no-user']])
- self.machines = list(m['name'] for m in vm.command('query-machines'))
+ self.machines = vm.command('query-machines')
self.user_devs = self.alldevs.difference(self.no_user_devs)
self.kvm_available = vm.command('query-kvm')['enabled']
finally:
@@ -390,6 +395,19 @@ class QemuBinaryInfo(object):
self._machine_info[machine] = mi
return mi
+ def defaultMachine(self):
+ """Default machine-type for the QEMU binary
+
+ If no default machine-type is returned by query-machines, return the
+ first machine-type in the list.
+ """
+ machines = self.machines
+ defmachine = [m['name'] for m in self.machines if m.get('is-default')]
+ if defmachine:
+ return defmachine[0]
+ else:
+ return self.machines[0]['name']
+
BINARY_INFO = {}
@@ -455,7 +473,7 @@ def accelsToTest(args, testcase):
def machinesToTest(args, testcase):
- return getBinaryInfo(args, testcase['binary']).machines
+ return [m['name'] for m in getBinaryInfo(args, testcase['binary']).machines]
def devicesToTest(args, testcase):
@@ -580,6 +598,13 @@ def main():
return 1
for t in casesToTest(args, tc):
+
+ # expand some test case variables to their actual values before
+ # using them:
+ # "-t machine=DEFAULT" can be used to use the default machine-type
+ if t['machine'] == 'DEFAULT':
+ t['machine'] = getBinaryInfo(args, t['binary']).defaultMachine()
+
logger.info("running test case: %s", formatTestCase(t))
total += 1
--
2.14.3
next prev parent reply other threads:[~2018-03-09 20:28 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-09 20:28 [Qemu-devel] [PATCH 0/8] tests: Run device-crash-test on "make check" Eduardo Habkost
2018-03-09 20:28 ` [Qemu-devel] [PATCH 1/8] device-crash-test: Refactor loglevel configuration code Eduardo Habkost
2018-03-09 20:28 ` [Qemu-devel] [PATCH 2/8] device-crash-test: Add examples to script documentation Eduardo Habkost
2018-03-09 20:28 ` Eduardo Habkost [this message]
2018-03-09 20:28 ` [Qemu-devel] [PATCH 4/8] device-crash-test: New known crashes Eduardo Habkost
2018-03-09 20:28 ` [Qemu-devel] [PATCH 5/8] device-crash-test: Remove runnable-machine check Eduardo Habkost
2018-03-09 20:28 ` [Qemu-devel] [PATCH 6/8] device-crash-test: Use WARN for known crashes Eduardo Habkost
2018-03-09 20:28 ` [Qemu-devel] [PATCH 7/8] device-crash-test: Don't print warnings in quiet mode Eduardo Habkost
2018-03-09 20:28 ` [Qemu-devel] [PATCH 8/8] tests: Run device-crash-test on "make check" Eduardo Habkost
2018-03-12 18:23 ` Eduardo Habkost
2018-03-12 18:25 ` [Qemu-devel] [PATCH v2 8/8] tests: Add check-device-crash-* rules Eduardo Habkost
2018-03-09 20:48 ` [Qemu-devel] [PATCH 0/8] tests: Run device-crash-test on "make check" no-reply
2018-03-09 20:55 ` Eduardo Habkost
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180309202827.12085-4-ehabkost@redhat.com \
--to=ehabkost@redhat.com \
--cc=crosa@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).