]> Git Repo - qemu.git/commitdiff
avocado: Fix BUILD_DIR if it's equal to SOURCE_DIR
authorPeter Delevoryas <[email protected]>
Sat, 2 Jul 2022 18:56:04 +0000 (11:56 -0700)
committerPhilippe Mathieu-Daudé <[email protected]>
Tue, 12 Jul 2022 22:06:02 +0000 (00:06 +0200)
I like to build QEMU from the root source directory [*], rather
than cd'ing into the build directory. This code may as well include
a search path for that, so that you can run avocado tests individually
without specifying "-p qemu_bin=build/qemu-system-arm" manually.

[*] See commit dedad02720 ("configure: add support for pseudo-"in source tree" builds")

Signed-off-by: Peter Delevoryas <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20220702185604[email protected]>
[PMD: Mention commit dedad02720]
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
tests/avocado/avocado_qemu/__init__.py

index b656a70c55b460ab14d51731141386bc174a4727..ed4853c805b5f9e8f49449da8c8e71afbf61125c 100644 (file)
@@ -120,14 +120,15 @@ def pick_default_qemu_bin(bin_prefix='qemu-system-', 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(".", bin_prefix + arch)
-    if is_readable_executable_file(qemu_bin_relative_path):
-        return qemu_bin_relative_path
-
-    qemu_bin_from_bld_dir_path = os.path.join(BUILD_DIR,
-                                              qemu_bin_relative_path)
-    if is_readable_executable_file(qemu_bin_from_bld_dir_path):
-        return qemu_bin_from_bld_dir_path
+    qemu_bin_name = bin_prefix + arch
+    qemu_bin_paths = [
+        os.path.join(".", qemu_bin_name),
+        os.path.join(BUILD_DIR, qemu_bin_name),
+        os.path.join(BUILD_DIR, "build", qemu_bin_name),
+    ]
+    for path in qemu_bin_paths:
+        if is_readable_executable_file(path):
+            return path
     return None
 
 
This page took 0.029727 seconds and 4 git commands to generate.