1 function(add_unittest_framework_library name)
4 "" # No optional arguments
5 "" # No single value arguments
6 "SRCS;HDRS;DEPENDS" # Multi value arguments
10 message(FATAL_ERROR "'add_unittest_framework_library' requires SRCS; for "
11 "header only libraries, use 'add_header_library'")
14 # The Nvidia 'nvlink' linker does not support static libraries.
15 if(LIBC_GPU_TARGET_ARCHITECTURE_IS_NVPTX)
16 set(library_type OBJECT)
18 set(library_type STATIC)
21 foreach(lib IN ITEMS ${name}.unit ${name}.hermetic)
29 target_include_directories(${lib} PUBLIC ${LIBC_SOURCE_DIR})
30 target_compile_options(${lib} PRIVATE -fno-exceptions -fno-rtti)
32 target_include_directories(${name}.hermetic PRIVATE ${LIBC_BUILD_DIR}/include)
33 target_compile_options(${name}.hermetic
34 PRIVATE ${LIBC_HERMETIC_TEST_COMPILE_OPTIONS} -ffreestanding -nostdinc++)
37 foreach(dep IN LISTS ${TEST_LIB_DEPENDS})
38 if(TARGET ${dep}.unit)
39 add_dependencies(${name}.unit ${dep}.unit)
41 add_dependencies(${name}.unit ${dep})
43 if(TARGET ${dep}.hermetic)
44 add_dependencies(${name}.hermetic ${dep}.hermetic)
46 add_dependencies(${name}.hermetic ${dep})
52 add_unittest_framework_library(
64 libc.src.__support.c_string
65 libc.src.__support.CPP.string
66 libc.src.__support.CPP.string_view
67 libc.src.__support.CPP.type_traits
68 libc.src.__support.OSUtil.osutil
69 libc.src.__support.uint128
72 set(libc_death_test_srcs LibcDeathTestExecutors.cpp)
73 if(${LIBC_TARGET_OS} STREQUAL "linux")
74 list(APPEND libc_death_test_srcs ExecuteFunctionUnix.cpp)
77 add_unittest_framework_library(
78 LibcDeathTestExecutors
80 ${libc_death_test_srcs}
85 add_unittest_framework_library(
86 LibcHermeticTestSupport
96 libc.src.__support.CPP.string
97 libc.src.__support.CPP.type_traits
100 add_unittest_framework_library(
103 RoundingModeUtils.cpp
109 libc.test.UnitTest.string_utils
110 libc.src.__support.FPUtil.fp_bits
111 libc.src.__support.FPUtil.fpbits_str
112 libc.src.__support.FPUtil.fenv_impl
113 libc.src.__support.FPUtil.rounding_mode
116 add_unittest_framework_library(
117 LibcFPExceptionHelpers
124 libc.src.__support.FPUtil.fp_bits
125 libc.src.__support.FPUtil.fenv_impl
128 add_unittest_framework_library(
136 libc.src.__support.CPP.span
139 add_unittest_framework_library(
147 libc.src.__support.FPUtil.fp_bits
148 libc.src.stdio.printf_core.core_structs
149 libc.test.UnitTest.string_utils
152 add_unittest_framework_library(
160 libc.src.__support.FPUtil.fp_bits
161 libc.src.stdio.scanf_core.core_structs
162 libc.test.UnitTest.string_utils
170 libc.src.__support.common
171 libc.src.__support.FPUtil.fp_bits
172 libc.src.__support.StringUtil.error_to_string