-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
picolibc: tests with meson #254
picolibc: tests with meson #254
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall, thanks
aa20239
to
4b25128
Compare
I applied corrections for the comments. |
4b25128
to
d527131
Compare
I addressed some of the issues in a separate PR #256 to make changes reviewable. |
d527131
to
c9a33a0
Compare
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there!
test-support/lit-exec-qemu.py
Outdated
# https://mesonbuild.com/Unit-tests.html#skipped-tests-and-hard-errors | ||
EXIT_CODE_SKIP = 77 | ||
|
||
disabled_tests = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This information doesn't belong in this file.
test-support/lit-exec-qemu.py
Outdated
@@ -5,15 +5,53 @@ | |||
# This script is a bridge between lit-based tests of LLVM C++ runtime libraries | |||
# (libc++abi, libunwind, libc++) and QEMU. It must handle the same command-line | |||
# arguments as llvm-project/libcxx/utils/run.py. | |||
# This is also a wrapper script to run picolibc tests with QEMU. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This goes against the philosophy of "Make each program do one thing well."
CMakeLists.txt
Outdated
# the full target, which would include tests. Picolibc tests, are enabled | ||
# only in tests step, otherwise, they would be built before install. | ||
add_custom_target(compiler_rt_${variant}-available) | ||
ExternalProject_Add_StepDependencies(picolibc_${variant} test compiler_rt_${variant}-available) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could a standard step be used instead? e.g. compiler_rt_${variant}-install
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be more readable, but the issue is, the target has to exist at the point where ExternalProject_Add_StepDependencies
is called and compiler_rt_${variant}-install
is created later, by ExternalProject
call for compiler_rt
. I added this dummy compiler_rt_${variant}-available
to resolve the mutual dependency between picolibc
and compiler-rt
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the target has to exist at the point where ExternalProject_Add_StepDependencies is called
Are you sure? Usually in CMake targets don't have to exist at the point the dependency is declared.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right. CMake happily accepted the -install
target. I will fix this in next iteration.
c9a33a0
to
158598c
Compare
I uploaded a new patch. I won't be able to address new comments till Tuesday. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!
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:
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'))
Make picolibc use compiler_rt in place of libgcc.
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
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.