Skip to content

Commit acbb491

Browse files
[libcxx] Require qemu-system-arm for armv7m builder (llvm#77067)
And add a check in the python script that the binary given to `--qemu` actually exists. Otherwise you get a generic Python error: ``` # .---command stderr------------ # | Traceback (most recent call last): # | File "/home/david.spickett/modules-llvm-project/libcxx/utils/qemu_baremetal.py", line 70, in <module> # | exit(main()) # | File "/home/david.spickett/modules-llvm-project/libcxx/utils/qemu_baremetal.py", line 66, in main # | os.execvp(qemu_commandline[0], qemu_commandline) # | File "/usr/lib/python3.8/os.py", line 568, in execvp # | _execvpe(file, args) # | File "/usr/lib/python3.8/os.py", line 610, in _execvpe # | raise last_exc # | File "/usr/lib/python3.8/os.py", line 601, in _execvpe # | exec_func(fullname, *argrest) # | FileNotFoundError: [Errno 2] No such file or directory # `----------------------------- # error: command failed with exit status: 1 ``` When it tries to run the entire command later. For the builder, it's only ever going to use qemu-system-arm so error at config time if it's not there.
1 parent 68a1583 commit acbb491

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

libcxx/cmake/caches/Armv7M-picolibc.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@ set(LIBUNWIND_ENABLE_THREADS OFF CACHE BOOL "")
3939
set(LIBUNWIND_IS_BAREMETAL ON CACHE BOOL "")
4040
set(LIBUNWIND_REMEMBER_HEAP_ALLOC ON CACHE BOOL "")
4141
set(LIBUNWIND_USE_COMPILER_RT ON CACHE BOOL "")
42-
find_program(QEMU_SYSTEM_ARM qemu-system-arm)
42+
find_program(QEMU_SYSTEM_ARM qemu-system-arm REQUIRED)

libcxx/utils/qemu_baremetal.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import argparse
1717
import os
1818
import sys
19+
import shutil
1920

2021

2122
def main():
@@ -32,8 +33,13 @@ def main():
3233
parser.add_argument("test_binary")
3334
parser.add_argument("test_args", nargs=argparse.ZERO_OR_MORE, default=[])
3435
args = parser.parse_args()
36+
37+
if not shutil.which(args.qemu):
38+
sys.exit(f"Failed to find QEMU binary from --qemu value: '{args.qemu}'")
39+
3540
if not os.path.exists(args.test_binary):
3641
sys.exit(f"Expected argument to be a test executable: '{args.test_binary}'")
42+
3743
qemu_commandline = [
3844
args.qemu,
3945
"-chardev",

0 commit comments

Comments
 (0)