qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] device-crash-test: Check if path is actually an executable file
@ 2020-10-26 12:52 Eduardo Habkost
  2020-10-26 13:16 ` Thomas Huth
  2020-10-26 13:40 ` Philippe Mathieu-Daudé
  0 siblings, 2 replies; 3+ messages in thread
From: Eduardo Habkost @ 2020-10-26 12:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: Thomas Huth, Philippe Mathieu-Daudé, Cleber Rosa

After the transition to Meson, the build directory now have
subdirectories named "qemu-system-*.p", and device-crash-test
will try to execute them as if they were binaries.  This results
in errors like:

  PermissionError: [Errno 13] Permission denied: './qemu-system-or1k.p'

When generating the default list of binaries to test, check if
the path is actually a file and if it's executable.

Reported-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 scripts/device-crash-test | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/scripts/device-crash-test b/scripts/device-crash-test
index 866baf7058..04118669ba 100755
--- a/scripts/device-crash-test
+++ b/scripts/device-crash-test
@@ -383,7 +383,9 @@ def binariesToTest(args, testcase):
     if args.qemu:
         r = args.qemu
     else:
-        r = glob.glob('./qemu-system-*')
+        r = [f.path for f in os.scandir('.')
+             if f.name.startswith('qemu-system-') and
+                f.is_file() and os.access(f, os.X_OK)]
     return r
 
 
-- 
2.28.0



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

* Re: [PATCH] device-crash-test: Check if path is actually an executable file
  2020-10-26 12:52 [PATCH] device-crash-test: Check if path is actually an executable file Eduardo Habkost
@ 2020-10-26 13:16 ` Thomas Huth
  2020-10-26 13:40 ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Huth @ 2020-10-26 13:16 UTC (permalink / raw)
  To: Eduardo Habkost, qemu-devel; +Cc: Philippe Mathieu-Daudé, Cleber Rosa

On 26/10/2020 13.52, Eduardo Habkost wrote:
> After the transition to Meson, the build directory now have
> subdirectories named "qemu-system-*.p", and device-crash-test
> will try to execute them as if they were binaries.  This results
> in errors like:
> 
>   PermissionError: [Errno 13] Permission denied: './qemu-system-or1k.p'
> 
> When generating the default list of binaries to test, check if
> the path is actually a file and if it's executable.
> 
> Reported-by: Thomas Huth <thuth@redhat.com>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
>  scripts/device-crash-test | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/device-crash-test b/scripts/device-crash-test
> index 866baf7058..04118669ba 100755
> --- a/scripts/device-crash-test
> +++ b/scripts/device-crash-test
> @@ -383,7 +383,9 @@ def binariesToTest(args, testcase):
>      if args.qemu:
>          r = args.qemu
>      else:
> -        r = glob.glob('./qemu-system-*')
> +        r = [f.path for f in os.scandir('.')
> +             if f.name.startswith('qemu-system-') and
> +                f.is_file() and os.access(f, os.X_OK)]
>      return r

Thanks, this seems to fix the issue for me!

Tested-by: Thomas Huth <thuth@redhat.com>



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

* Re: [PATCH] device-crash-test: Check if path is actually an executable file
  2020-10-26 12:52 [PATCH] device-crash-test: Check if path is actually an executable file Eduardo Habkost
  2020-10-26 13:16 ` Thomas Huth
@ 2020-10-26 13:40 ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-10-26 13:40 UTC (permalink / raw)
  To: Eduardo Habkost, qemu-devel; +Cc: Thomas Huth, Cleber Rosa

On 10/26/20 1:52 PM, Eduardo Habkost wrote:
> After the transition to Meson, the build directory now have
> subdirectories named "qemu-system-*.p", and device-crash-test
> will try to execute them as if they were binaries.  This results
> in errors like:
> 
>    PermissionError: [Errno 13] Permission denied: './qemu-system-or1k.p'
> 
> When generating the default list of binaries to test, check if
> the path is actually a file and if it's executable.
> 
> Reported-by: Thomas Huth <thuth@redhat.com>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
>   scripts/device-crash-test | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>



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

end of thread, other threads:[~2020-10-26 13:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-26 12:52 [PATCH] device-crash-test: Check if path is actually an executable file Eduardo Habkost
2020-10-26 13:16 ` Thomas Huth
2020-10-26 13:40 ` Philippe Mathieu-Daudé

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