summaryrefslogtreecommitdiff
path: root/libc/cmake
diff options
context:
space:
mode:
authorJoseph Huber <jhuber6@vols.utk.edu>2023-05-02 06:39:14 -0500
committerJoseph Huber <jhuber6@vols.utk.edu>2023-05-02 09:40:24 -0500
commit2353b52eae71ffa3993d21f0bed0c571cf2e0c79 (patch)
tree76d1c287d8539afc5e6dfd9a3739baf24a54b882 /libc/cmake
parentd755e10e7ac8abe7031c3f119df93541c0a78551 (diff)
downloadllvm-2353b52eae71ffa3993d21f0bed0c571cf2e0c79.tar.gz
[libc] Fix some missing features from the hermetic test support
This patch addresses some of the flags and features that are currently missing from the hermetic test support. This mostly just fixes the `add_libc_test` option failing to find a few dependencies or missing arguments from the previous unit test support. Reviewed By: lntue Differential Revision: https://reviews.llvm.org/D149629
Diffstat (limited to 'libc/cmake')
-rw-r--r--libc/cmake/modules/LLVMLibCTestRules.cmake15
1 files changed, 9 insertions, 6 deletions
diff --git a/libc/cmake/modules/LLVMLibCTestRules.cmake b/libc/cmake/modules/LLVMLibCTestRules.cmake
index 51ed88211f9d..a99274ce5ce3 100644
--- a/libc/cmake/modules/LLVMLibCTestRules.cmake
+++ b/libc/cmake/modules/LLVMLibCTestRules.cmake
@@ -568,6 +568,7 @@ endif()
# ARGS <list of command line arguments to be passed to the test>
# ENV <list of environment variables to set before running the test>
# COMPILE_OPTIONS <list of special compile options for the test>
+# LINK_LIBRARIES <list of linking libraries for this target>
# LOADER_ARGS <list of special args to loaders (like the GPU loader)>
# )
function(add_libc_hermetic_test test_name)
@@ -579,7 +580,7 @@ function(add_libc_hermetic_test test_name)
"HERMETIC_TEST"
"" # No optional arguments
"SUITE" # Single value arguments
- "SRCS;HDRS;DEPENDS;ARGS;ENV;COMPILE_OPTIONS;LOADER_ARGS" # Multi-value arguments
+ "SRCS;HDRS;DEPENDS;ARGS;ENV;COMPILE_OPTIONS;LINK_LIBRARIES;LOADER_ARGS" # Multi-value arguments
${ARGN}
)
@@ -660,13 +661,15 @@ function(add_libc_hermetic_test test_name)
target_link_options(${fq_build_target_name} PRIVATE -nostdlib -static)
target_link_libraries(
${fq_build_target_name}
- libc.startup.${LIBC_TARGET_OS}.crt1
- LibcHermeticTestMain LibcHermeticTest
- # The NVIDIA 'nvlink' linker does not currently support static libraries.
- $<$<NOT:$<BOOL:${LIBC_GPU_TARGET_ARCHITECTURE_IS_NVPTX}>>:${fq_target_name}.__libc__>)
+ PRIVATE
+ ${HERMETIC_TEST_LINK_LIBRARIES}
+ libc.startup.${LIBC_TARGET_OS}.crt1
+ LibcHermeticTestMain LibcHermeticTest
+ # The NVIDIA 'nvlink' linker does not currently support static libraries.
+ $<$<NOT:$<BOOL:${LIBC_GPU_TARGET_ARCHITECTURE_IS_NVPTX}>>:${fq_target_name}.__libc__>)
add_dependencies(${fq_build_target_name}
LibcHermeticTest
- ${HERMETIC_TEST_DEPENDS})
+ ${fq_deps_list})
# Tests on the GPU require an external loader utility to launch the kernel.
if(TARGET libc.utils.gpu.loader)