qemu-devel
[Top][All Lists]
Advanced

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

[PATCH 1/3] avocado_qemu: enhance CANCEL message in QemuBaseTest:setUp()


From: Daniel Henrique Barboza
Subject: [PATCH 1/3] avocado_qemu: enhance CANCEL message in QemuBaseTest:setUp()
Date: Wed, 18 Jan 2023 09:43:46 -0300

Trying to run 'make check-avocado' while having only non-x86_64 QEMU
binaries built, in a x86_64 host machine, will give us the following
cancel message:

"CANCEL: No QEMU binary defined or found in the build tree"

Which is not quite what's happening here. Avocado defaults to the host
arch for every arch-agnostic test, and in the case mentioned above it
cancelled the test because there were no qemu-system-x86_64 binary to be
found.

Change pick_default_qemu_bin() to return a (qemu_bin, arch) tuple, then
use 'arch' in the CANCEL message. This will make the error more
informative:

"CANCEL: No QEMU binary defined or found in the build tree for arch x86_64"

Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
---
 tests/avocado/avocado_qemu/__init__.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/tests/avocado/avocado_qemu/__init__.py 
b/tests/avocado/avocado_qemu/__init__.py
index 910f3ba1ea..8614ac3978 100644
--- a/tests/avocado/avocado_qemu/__init__.py
+++ b/tests/avocado/avocado_qemu/__init__.py
@@ -128,8 +128,8 @@ def pick_default_qemu_bin(bin_prefix='qemu-system-', 
arch=None):
     ]
     for path in qemu_bin_paths:
         if is_readable_executable_file(path):
-            return path
-    return None
+            return path, arch
+    return None, arch
 
 
 def _console_interaction(test, success_message, failure_message,
@@ -247,11 +247,13 @@ def setUp(self, bin_prefix):
         self.cpu = self.params.get('cpu',
                                    default=self._get_unique_tag_val('cpu'))
 
-        default_qemu_bin = pick_default_qemu_bin(bin_prefix, arch=self.arch)
+        default_qemu_bin, arch = pick_default_qemu_bin(bin_prefix,
+                                                       arch=self.arch)
         self.qemu_bin = self.params.get('qemu_bin',
                                         default=default_qemu_bin)
         if self.qemu_bin is None:
-            self.cancel("No QEMU binary defined or found in the build tree")
+            self.cancel("No QEMU binary defined or found in the "
+                        "build tree for arch %s" % arch)
 
     def fetch_asset(self, name,
                     asset_hash=None, algorithm=None,
-- 
2.39.0




reply via email to

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