diff mbox series

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

Message ID 20230118124348.364771-2-dbarboza@ventanamicro.com (mailing list archive)
State New, archived
Headers show
Series avocado_qemu: allow cross-arch tests | expand

Commit Message

Daniel Henrique Barboza Jan. 18, 2023, 12:43 p.m. UTC
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(-)

Comments

Fabiano Rosas Jan. 18, 2023, 3:24 p.m. UTC | #1
Daniel Henrique Barboza <dbarboza@ventanamicro.com> writes:

> 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>

Reviewed-by: Fabiano Rosas <farosas@suse.de>
diff mbox series

Patch

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,