qemu-devel
[Top][All Lists]
Advanced

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

[PATCH 07/26] tests/acceptance: Make pick_default_qemu_bin() more generi


From: Philippe Mathieu-Daudé
Subject: [PATCH 07/26] tests/acceptance: Make pick_default_qemu_bin() more generic
Date: Mon, 28 Oct 2019 08:34:22 +0100

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 a2cc3d689b..d23681818d 100644
--- a/tests/acceptance/avocado_qemu/__init__.py
+++ b/tests/acceptance/avocado_qemu/__init__.py
@@ -24,7 +24,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.
@@ -43,8 +43,7 @@ def pick_default_qemu_bin(arch=None):
     # qemu binary path does not match arch for powerpc, handle it
     if 'ppc64le' in arch:
         arch = 'ppc64'
-    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
 
@@ -99,14 +98,15 @@ def exec_command_and_wait_for_pattern(test, command,
 
 
 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:
@@ -116,7 +116,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.21.0




reply via email to

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