Skip to content

Commit c3809eb

Browse files
committed
Add bazel targets for libc/include/... tests.
These tests are compiled with `-DLIBC_FULL_BUILD`, since otherwise inclusion of system headers can redefined macros defined by LLVM libc. Also, set `alwayslink=True` for `//libc/test:LibcUnitTest`. This ensures that the `main` function provided always gets linked into a test target. While not strictly necessary, it makes it so tests like https://github.com/llvm/llvm-project/blob/45d8759cbed0f216786729718608a8be72a505c6/libc/test/include/signbit_test.c will give a duplicate symbol error if they incorrectly depend on `LibcUnitTest`.
1 parent 7181785 commit c3809eb

File tree

3 files changed

+430
-13
lines changed

3 files changed

+430
-13
lines changed

utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ libc_test_library(
7272
"//libc:llvm_libc_macros_stdfix_macros",
7373
"//llvm:Support",
7474
],
75+
# Force linking in this library's `main()` to surface
76+
# a duplicate symbol error if a test defines its own main.
77+
alwayslink = True,
7578
)
7679

7780
libc_test_library(

0 commit comments

Comments
 (0)