qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] avocado: Fix BUILD_DIR if it's equal to SOURCE_DIR
@ 2022-07-02 18:56 Peter Delevoryas
  2022-07-07  0:55 ` Peter Delevoryas
  2022-07-12 21:53 ` Philippe Mathieu-Daudé via
  0 siblings, 2 replies; 4+ messages in thread
From: Peter Delevoryas @ 2022-07-02 18:56 UTC (permalink / raw)
  Cc: Peter Delevoryas, Cleber Rosa, Philippe Mathieu-Daudé,
	Wainer dos Santos Moschetta, Beraldo Leal, qemu-devel

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.

Signed-off-by: Peter Delevoryas <peter@pjd.dev>
---
 tests/avocado/avocado_qemu/__init__.py | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/tests/avocado/avocado_qemu/__init__.py b/tests/avocado/avocado_qemu/__init__.py
index b656a70c55..ed4853c805 100644
--- a/tests/avocado/avocado_qemu/__init__.py
+++ b/tests/avocado/avocado_qemu/__init__.py
@@ -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
 
 
-- 
2.37.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] avocado: Fix BUILD_DIR if it's equal to SOURCE_DIR
  2022-07-02 18:56 [PATCH] avocado: Fix BUILD_DIR if it's equal to SOURCE_DIR Peter Delevoryas
@ 2022-07-07  0:55 ` Peter Delevoryas
  2022-07-12 21:53 ` Philippe Mathieu-Daudé via
  1 sibling, 0 replies; 4+ messages in thread
From: Peter Delevoryas @ 2022-07-07  0:55 UTC (permalink / raw)
  To: Cleber Rosa, Philippe Mathieu-Daudé,
	Wainer dos Santos Moschetta, Beraldo Leal, qemu-devel

On Sat, Jul 02, 2022 at 11:56:04AM -0700, Peter Delevoryas wrote:
> 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.

Pinging this thread since I didn't get a response.

> 
> Signed-off-by: Peter Delevoryas <peter@pjd.dev>
> ---
>  tests/avocado/avocado_qemu/__init__.py | 17 +++++++++--------
>  1 file changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/tests/avocado/avocado_qemu/__init__.py b/tests/avocado/avocado_qemu/__init__.py
> index b656a70c55..ed4853c805 100644
> --- a/tests/avocado/avocado_qemu/__init__.py
> +++ b/tests/avocado/avocado_qemu/__init__.py
> @@ -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),

Thinking about how to write this last line again, maybe it should actually
be "os.path.join(SOURCE_DIR, "build", qemu_bin_name)"?

> +    ]
> +    for path in qemu_bin_paths:
> +        if is_readable_executable_file(path):
> +            return path
>      return None
>  
>  
> -- 
> 2.37.0
> 
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] avocado: Fix BUILD_DIR if it's equal to SOURCE_DIR
  2022-07-02 18:56 [PATCH] avocado: Fix BUILD_DIR if it's equal to SOURCE_DIR Peter Delevoryas
  2022-07-07  0:55 ` Peter Delevoryas
@ 2022-07-12 21:53 ` Philippe Mathieu-Daudé via
  2022-07-12 22:23   ` Peter Delevoryas
  1 sibling, 1 reply; 4+ messages in thread
From: Philippe Mathieu-Daudé via @ 2022-07-12 21:53 UTC (permalink / raw)
  To: Peter Delevoryas
  Cc: Cleber Rosa, Wainer dos Santos Moschetta, Beraldo Leal,
	qemu-devel, Daniel P. Berrangé

On 2/7/22 20:56, Peter Delevoryas wrote:
> 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.
> 
> Signed-off-by: Peter Delevoryas <peter@pjd.dev>
> ---
>   tests/avocado/avocado_qemu/__init__.py | 17 +++++++++--------
>   1 file changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/tests/avocado/avocado_qemu/__init__.py b/tests/avocado/avocado_qemu/__init__.py
> index b656a70c55..ed4853c805 100644
> --- a/tests/avocado/avocado_qemu/__init__.py
> +++ b/tests/avocado/avocado_qemu/__init__.py
> @@ -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),

I suppose you are building as pseudo-in-tree (see commit dedad02720: 
"configure: add support for pseudo-"in source tree" builds"). OK.

> +    ]
> +    for path in qemu_bin_paths:
> +        if is_readable_executable_file(path):
> +            return path
>       return None
>   
>   

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

And queued.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] avocado: Fix BUILD_DIR if it's equal to SOURCE_DIR
  2022-07-12 21:53 ` Philippe Mathieu-Daudé via
@ 2022-07-12 22:23   ` Peter Delevoryas
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Delevoryas @ 2022-07-12 22:23 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Cleber Rosa, Wainer dos Santos Moschetta, Beraldo Leal,
	qemu-devel, Daniel P. Berrangé

On Tue, Jul 12, 2022 at 11:53:14PM +0200, Philippe Mathieu-Daudé wrote:
> On 2/7/22 20:56, Peter Delevoryas wrote:
> > 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.
> > 
> > Signed-off-by: Peter Delevoryas <peter@pjd.dev>
> > ---
> >   tests/avocado/avocado_qemu/__init__.py | 17 +++++++++--------
> >   1 file changed, 9 insertions(+), 8 deletions(-)
> > 
> > diff --git a/tests/avocado/avocado_qemu/__init__.py b/tests/avocado/avocado_qemu/__init__.py
> > index b656a70c55..ed4853c805 100644
> > --- a/tests/avocado/avocado_qemu/__init__.py
> > +++ b/tests/avocado/avocado_qemu/__init__.py
> > @@ -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),
> 
> I suppose you are building as pseudo-in-tree (see commit dedad02720:
> "configure: add support for pseudo-"in source tree" builds"). OK.

That's right, thanks for adding the reference in the commit message.

> 
> > +    ]
> > +    for path in qemu_bin_paths:
> > +        if is_readable_executable_file(path):
> > +            return path
> >       return None
> 
> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Thanks!!
Peter

> 
> And queued.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-07-12 22:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-02 18:56 [PATCH] avocado: Fix BUILD_DIR if it's equal to SOURCE_DIR Peter Delevoryas
2022-07-07  0:55 ` Peter Delevoryas
2022-07-12 21:53 ` Philippe Mathieu-Daudé via
2022-07-12 22:23   ` Peter Delevoryas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).