From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Fam Zheng" <fam@euphon.net>,
"Eduardo Habkost" <ehabkost@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>,
"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
"Maxime Coquelin" <maxime.coquelin@redhat.com>,
"Alistair Francis" <alistair.francis@wdc.com>,
"Cleber Rosa" <crosa@redhat.com>,
"Alex Bennée" <alex.bennee@linaro.org>
Subject: [Qemu-devel] [PATCH 2/5] tests/acceptance: Make pick_default_qemu_bin() more generic
Date: Tue, 25 Jun 2019 12:15:21 +0200 [thread overview]
Message-ID: <20190625101524.13447-3-philmd@redhat.com> (raw)
In-Reply-To: <20190625101524.13447-1-philmd@redhat.com>
Make pick_default_qemu_bin() generic to find qemu-system or
qemu-user binaries.
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
tests/acceptance/avocado_qemu/__init__.py | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py
index 84fe090458..6785c7399e 100644
--- a/tests/acceptance/avocado_qemu/__init__.py
+++ b/tests/acceptance/avocado_qemu/__init__.py
@@ -23,7 +23,7 @@ def is_readable_executable_file(path):
return os.path.isfile(path) and os.access(path, os.R_OK | os.X_OK)
-def pick_default_qemu_bin(arch=None):
+def pick_default_qemu_bin(path_fmt, bin_fmt, arch=None):
"""
Picks the path of a QEMU binary, starting either in the current working
directory or in the source tree root directory.
@@ -39,8 +39,7 @@ def pick_default_qemu_bin(arch=None):
"""
if arch is None:
arch = os.uname()[4]
- qemu_bin_relative_path = os.path.join("%s-softmmu" % arch,
- "qemu-system-%s" % arch)
+ qemu_bin_relative_path = os.path.join(path_fmt % arch, bin_fmt % arch)
if is_readable_executable_file(qemu_bin_relative_path):
return qemu_bin_relative_path
@@ -51,14 +50,15 @@ def pick_default_qemu_bin(arch=None):
class Test(avocado.Test):
- def setUp(self):
+ def base_setUp(self, path_fmt, bin_fmt):
arches = self.tags.get('arch', [])
if len(arches) == 1:
arch = arches.pop()
else:
arch = None
self.arch = self.params.get('arch', default=arch)
- default_qemu_bin = pick_default_qemu_bin(arch=self.arch)
+ default_qemu_bin = pick_default_qemu_bin(path_fmt, bin_fmt,
+ arch=self.arch)
self.qemu_bin = self.params.get('qemu_bin',
default=default_qemu_bin)
if self.qemu_bin is None:
@@ -68,7 +68,7 @@ class Test(avocado.Test):
class MachineTest(Test):
def setUp(self):
self._vms = {}
- super().setUp()
+ self.base_setUp("%s-softmmu", "qemu-system-%s")
def _new_vm(self, *args):
vm = QEMUMachine(self.qemu_bin)
--
2.20.1
next prev parent reply other threads:[~2019-06-25 10:21 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-25 10:15 [Qemu-devel] [PATCH 0/5] tests/acceptance: Add bFLT loader linux-user test Philippe Mathieu-Daudé
2019-06-25 10:15 ` [Qemu-devel] [PATCH 1/5] tests/acceptance: Rename avocado_qemu.Test as MachineTest Philippe Mathieu-Daudé
2019-06-25 10:15 ` Philippe Mathieu-Daudé [this message]
2019-06-25 10:15 ` [Qemu-devel] [PATCH 3/5] tests/acceptance: Introduce LinuxUserTest base class Philippe Mathieu-Daudé
2019-06-25 10:15 ` [Qemu-devel] [PATCH 4/5] tests/acceptance: Add bFLT loader linux-user test Philippe Mathieu-Daudé
2019-06-25 10:15 ` [Qemu-devel] [PATCH 5/5] .travis.yml: Let the avocado job run linux-user tests Philippe Mathieu-Daudé
2019-06-25 10:47 ` [Qemu-devel] [PATCH 0/5] tests/acceptance: Add bFLT loader linux-user test no-reply
2019-06-25 11:04 ` Philippe Mathieu-Daudé
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=20190625101524.13447-3-philmd@redhat.com \
--to=philmd@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=alistair.francis@wdc.com \
--cc=crosa@redhat.com \
--cc=ehabkost@redhat.com \
--cc=fam@euphon.net \
--cc=maxime.coquelin@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=wainersm@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).