[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/5] tests/acceptance: Make pick_default_qemu_bin()
From: |
Philippe Mathieu-Daudé |
Subject: |
[Qemu-devel] [PATCH 2/5] tests/acceptance: Make pick_default_qemu_bin() more generic |
Date: |
Tue, 25 Jun 2019 12:15:21 +0200 |
Make pick_default_qemu_bin() generic to find qemu-system or
qemu-user binaries.
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
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
- [Qemu-devel] [PATCH 0/5] tests/acceptance: Add bFLT loader linux-user test, Philippe Mathieu-Daudé, 2019/06/25
- [Qemu-devel] [PATCH 1/5] tests/acceptance: Rename avocado_qemu.Test as MachineTest, Philippe Mathieu-Daudé, 2019/06/25
- [Qemu-devel] [PATCH 3/5] tests/acceptance: Introduce LinuxUserTest base class, Philippe Mathieu-Daudé, 2019/06/25
- [Qemu-devel] [PATCH 5/5] .travis.yml: Let the avocado job run linux-user tests, Philippe Mathieu-Daudé, 2019/06/25
- [Qemu-devel] [PATCH 4/5] tests/acceptance: Add bFLT loader linux-user test, Philippe Mathieu-Daudé, 2019/06/25
- [Qemu-devel] [PATCH 2/5] tests/acceptance: Make pick_default_qemu_bin() more generic,
Philippe Mathieu-Daudé <=
- Re: [Qemu-devel] [PATCH 0/5] tests/acceptance: Add bFLT loader linux-user test, no-reply, 2019/06/25