Skip to contentSkip to conversation

device-crash-test: Check if path is actually an executable file

PATCH In review Eduardo Habkost 3 participants 3 messages Oct 26, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 device-crash-test: Check if path is actually an executable file

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.

---
 scripts/device-crash-test | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
scripts/device-crash-test +3 -1
index 866baf7058..04118669ba 100755
@@ -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
 
 
Signature · 1 line
2.28.0
Tested-by on v1 1/1
#1 lore raw
Quoted 21 lines · Eduardo Habkost

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.

---
 scripts/device-crash-test | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
scripts/device-crash-test +0 -0
index 866baf7058..04118669ba 100755

scripts/device-crash-test def binariesToTest(args, testcase): · line 389

Quoted 8 lines
scripts/device-crash-test +3 -1
@@ -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!

Reviewed-by on v1 1/1
#2 lore raw
In reply to Eduardo Habkost
Quoted 7 lines · Eduardo Habkost

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'

Quoted 8 lines

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

---
  scripts/device-crash-test | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)