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 foreach(lib IN ITEMS ${name}.unit ${name}.hermetic)
22 target_include_directories(${lib} PRIVATE ${LIBC_SOURCE_DIR})
23 if(TARGET libc.src.time.clock)
24 target_compile_definitions(${lib} PRIVATE TARGET_SUPPORTS_CLOCK)
28 if(LLVM_LIBC_FULL_BUILD)
29 # TODO: Build test framework with LIBC_FULL_BUILD in full build mode after
30 # making LibcFPExceptionHelpers and LibcDeathTestExecutors hermetic.
31 set(LLVM_LIBC_FULL_BUILD "")
32 _get_common_test_compile_options(compile_options "" "")
33 target_compile_options(${name}.unit PRIVATE ${compile_options})
34 set(LLVM_LIBC_FULL_BUILD ON)
36 _get_common_test_compile_options(compile_options "" "")
37 target_compile_options(${name}.unit PRIVATE ${compile_options})
40 _get_hermetic_test_compile_options(compile_options "")
41 target_include_directories(${name}.hermetic PRIVATE ${LIBC_INCLUDE_DIR})
42 target_compile_options(${name}.hermetic PRIVATE ${compile_options} -nostdinc++)
45 foreach(dep IN ITEMS ${TEST_LIB_DEPENDS})
46 if(TARGET ${dep}.unit)
47 add_dependencies(${name}.unit ${dep}.unit)
49 add_dependencies(${name}.unit ${dep})
51 if(TARGET ${dep}.hermetic)
52 add_dependencies(${name}.hermetic ${dep}.hermetic)
54 add_dependencies(${name}.hermetic ${dep})
60 add_unittest_framework_library(
72 libc.src.__support.big_int
73 libc.src.__support.c_string
74 libc.src.__support.CPP.string
75 libc.src.__support.CPP.string_view
76 libc.src.__support.CPP.type_traits
77 libc.src.__support.fixed_point.fx_rep
78 libc.src.__support.macros.properties.types
79 libc.src.__support.OSUtil.osutil
80 libc.src.__support.uint128
83 set(libc_death_test_srcs LibcDeathTestExecutors.cpp)
84 if(${LIBC_TARGET_OS} STREQUAL "linux")
85 list(APPEND libc_death_test_srcs ExecuteFunctionUnix.cpp)
88 add_unittest_framework_library(
89 LibcDeathTestExecutors
91 ${libc_death_test_srcs}
96 add_unittest_framework_library(
97 LibcHermeticTestSupport
107 libc.src.__support.big_int
108 libc.src.__support.CPP.string
109 libc.src.__support.CPP.type_traits
112 add_unittest_framework_library(
116 RoundingModeUtils.cpp
123 libc.test.UnitTest.string_utils
124 libc.src.__support.CPP.array
125 libc.src.__support.FPUtil.fp_bits
126 libc.src.__support.FPUtil.fpbits_str
127 libc.src.__support.FPUtil.fenv_impl
128 libc.src.__support.FPUtil.rounding_mode
131 add_unittest_framework_library(
132 LibcFPExceptionHelpers
139 libc.src.__support.FPUtil.fp_bits
140 libc.src.__support.FPUtil.fenv_impl
141 libc.hdr.types.fenv_t
144 add_unittest_framework_library(
152 libc.src.__support.CPP.span
155 add_unittest_framework_library(
163 libc.src.__support.FPUtil.fp_bits
164 libc.src.stdio.printf_core.core_structs
165 libc.test.UnitTest.string_utils
168 add_unittest_framework_library(
176 libc.src.__support.FPUtil.fp_bits
177 libc.src.stdio.scanf_core.core_structs
178 libc.test.UnitTest.string_utils
186 libc.src.__support.common
187 libc.src.__support.FPUtil.fp_bits
188 libc.src.__support.StringUtil.error_to_string