Open
Description
Downstream (https://github.com/arm/arm-toolchain/), I have managed to hack together running hermetic testing of unit tests by LLVM.
❯ qemu-system-arm -M mps2-an500 -semihosting -nographic -device loader,file=libc/test/src/stdio/libc.test.src.stdio.printf_test.__hermetic__.__build__ -s -S
[==========] Running 1 test from 1 test suite.
[ RUN ] LlvmLibcPrintfTest.PrintOut
A simple string with no conversions.
1234567890
1234 and more
[ OK ] LlvmLibcPrintfTest.PrintOut
Ran 1 tests. PASS: 1 FAIL: 0
In an ideal world, I would like to contribute this upstream, where the embedded build is ran in the post-commit, which in-turn can be used to catch any errors relating to baremetal implementations. In order to do this, I will have to do the following.
- Start the mutex implementation ([libc] Mutex implementation for single-threaded baremetal #145358)
- Fix a few bugs with the testing on LLVM-libc
- Add the
-nolibc
flag to the baremetal Clang driver ([clang] Add option for -nolibc in Driver/ToolChains/Baremetal.cpp #145700) -
clock()
unimplemented, and thereforeLibcTest.cpp
doesn't compile ([libc] Fix issue with using clock() in hermetic testing #146069) -
atexit()
currently disabled for baremetal targets.
- Add the
- Upstream the LLVM-libc support libraries (https://github.com/arm/arm-toolchain/tree/arm-software/arm-software/embedded/llvmlibc-support) into
crt1
andsemihost
.- Minimal
crt1
- Decide how to manage the linker script(s)
- Decide where to put the semihost library
- Minimal
- Add an option to test LLVM-libc upstream
- Other things that I may have missed when integrating upstream.