-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch from manually building picolibc tests to bilding and running them as part of picolibc build. This enables tests, which were not included in the manual build. Several fixes were necessary: 1. Add '-nostdlib' to picolibc c_args This prevents errors like: ld.lld: error: unable to find library -lc in checks for compiler flags support in picolibs build scripts. Example of failing check: has_link_defsym = meson.get_cross_property('has_link_defsym', cc.has_link_argument('-Wl,--defsym=' + global_prefix + '_start=0')) 2. Make picolibc use compiler_rt in place of libgcc. 3. Change machines used with qemu and adjust memory layouts. Some of picolibc tests need more memory, than previous machines provided. Example error: ld.lld: error: section '.text' will not fit in region 'flash': overflowed by 34504 bytes 4. Postpone building picolibc tests to the test step. compiler_rt requires picolibc to be installed. picolibc tests require compiler_rt. The delayed tests enable picolibc to be installed before compiler_rt is built.
- Loading branch information
Showing
11 changed files
with
240 additions
and
143 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
#!/usr/bin/env python3 | ||
|
||
# Copyright (c) 2023, Arm Limited and affiliates. | ||
|
||
# This is a wrapper script to run picolibc tests with qemu | ||
|
||
import sys | ||
import argparse | ||
import subprocess | ||
|
||
# This script requires Python 3.6 or later | ||
assert sys.version_info >= (3, 6) | ||
|
||
disabled_tests = [ | ||
"picolibc_aarch64-build/test/math_errhandling", | ||
"picolibc_armv7em_hard_fpv4_sp_d16-build/test/math_errhandling", | ||
"picolibc_armv7em_hard_fpv5_d16-build/test/math_errhandling", | ||
"picolibc_armv8m.main_hard_fp-build/test/printf_scanf", | ||
"picolibc_armv8m.main_hard_fp-build/test/printff_scanff", | ||
"picolibc_armv8m.main_hard_fp-build/test/printff-tests", | ||
"picolibc_armv8m.main_hard_fp-build/test/math_errhandling", | ||
"picolibc_armv8m.main_hard_fp-build/test/rounding-mode", | ||
"picolibc_armv8m.main_hard_fp-build/test/long_double", | ||
"picolibc_armv8m.main_hard_fp-build/test/rand", | ||
"picolibc_armv8m.main_hard_fp-build/test/fenv", | ||
"picolibc_armv8m.main_hard_fp-build/test/math-funcs", | ||
"picolibc_armv8m.main_hard_fp-build/test/test-strtod", | ||
"picolibc_armv8m.main_hard_fp-build/test/test-efcvt", | ||
"picolibc_armv8m.main_hard_fp-build/test/complex-funcs", | ||
"picolibc_armv8m.main_hard_fp-build/test/semihost/semihost-times", | ||
"picolibc_armv8m.main_hard_fp-build/newlib/libm/test/math_test", | ||
"picolibc_armv8m.main_hard_fp-build/test/libc-testsuite/sscanf", | ||
"picolibc_armv8m.main_hard_fp-build/test/libc-testsuite/strtod", | ||
"picolibc_armv8.1m.main_soft_nofp_nomve-build/newlib/libm/test/math_test", | ||
"picolibc_armv8.1m.main_hard_fp-build/test/math_errhandling", | ||
"picolibc_armv8.1m.main_hard_fp-build/newlib/libm/test/math_test", | ||
"picolibc_armv8.1m.main_hard_nofp_mve-build/test/fenv", | ||
"picolibc_armv8.1m.main_hard_nofp_mve-build/newlib/libm/test/math_test", | ||
"picolibc_armv8.1m.main_hard_nofp_mve-build/test/math_errhandling" | ||
] | ||
|
||
def is_disabled(image): | ||
return any([image.endswith(t) for t in disabled_tests]) | ||
|
||
def run(args): | ||
"""Execute the program using QEMU and return the subprocess return code.""" | ||
command = args.command | ||
assert command | ||
image = command[0] | ||
image_args = command[1:] | ||
if image_args[0:1] == ['--']: | ||
image_args = image_args[1:] | ||
if is_disabled(image): | ||
return 77 | ||
semihosting = ','.join( | ||
["enable=on", "chardev=stdio0"] | ||
+ ['arg=' + arg.replace(',', ',,') for arg in image_args]) | ||
qemu_params = args.qemu_params.split(':') + [ | ||
"-chardev", "stdio,mux=on,id=stdio0", | ||
"-semihosting-config", semihosting, | ||
"-monitor", "none", | ||
"-serial", "none", | ||
"-nographic"] | ||
if qemu_params.count("virt"): | ||
qemu_params += ["-kernel", image] | ||
else: | ||
qemu_params += ["-device", f"loader,file={image},cpu-num=0"] | ||
qemu_cmd = [args.qemu_command] + qemu_params | ||
print(f"qemu_cmd : {qemu_cmd}") | ||
result = subprocess.run(qemu_cmd, stdout=subprocess.PIPE, | ||
stderr=sys.stderr, | ||
check=False) | ||
sys.stdout.buffer.write(result.stdout) | ||
return result.returncode | ||
|
||
def main(): | ||
parser = argparse.ArgumentParser(description='Run a single test using qemu') | ||
parser.add_argument('--qemu-command', required=True, help='qemu-system-<arch> path') | ||
parser.add_argument('--qemu-params', required=True, | ||
help='list of arguments to pass to qemu, separated with ":"') | ||
parser.add_argument('command', nargs=argparse.REMAINDER, | ||
help='image file to execute with optional arguments') | ||
args = parser.parse_args() | ||
ret_code = run(args) | ||
sys.exit(ret_code) | ||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
__flash_size = 0x00400000; | ||
__flash = 0x10000000; | ||
__flash_size = 0x00200000; | ||
__ram = 0x60000000; | ||
__ram_size = 0x00200000; | ||
__stack_size = 4k; | ||
|
||
INCLUDE picolibcpp.ld |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
__flash_size = 0x00400000; | ||
__flash = 0x10000000; | ||
__flash_size = 0x00200000; | ||
__ram = 0x60000000; | ||
__ram_size = 0x00200000; | ||
__stack_size = 4k; | ||
|
||
INCLUDE picolibcpp.ld |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
__flash_size = 0x00400000; | ||
__flash = 0x10000000; | ||
__flash_size = 0x00200000; | ||
__ram = 0x60000000; | ||
__ram_size = 0x00200000; | ||
__stack_size = 4k; | ||
|
||
INCLUDE picolibcpp.ld |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
__flash = 0x10000000; | ||
__flash_size = 0x00400000; | ||
__ram = 0x80000000; | ||
__ram_size = 0x01000000; | ||
__stack_size = 4k; | ||
|
||
INCLUDE picolibcpp.ld |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
__flash = 0x10000000; | ||
__flash_size = 0x00400000; | ||
__ram = 0x80000000; | ||
__ram_size = 0x01000000; | ||
__stack_size = 4k; | ||
|
||
INCLUDE picolibcpp.ld |