| 1 |
# This file is licensed under the Apache License v2.0 with LLVM Exceptions. |
| 2 |
# See https://llvm.org/LICENSE.txt for license information. |
| 3 |
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 4 |
|
| 5 |
# LLVM libc unittest library. |
| 6 |
|
| 7 |
load("//libc/test:libc_test_rules.bzl", "libc_test_library") |
| 8 |
|
| 9 |
package(default_visibility = ["//visibility:public"]) |
| 10 |
|
| 11 |
licenses(["notice"]) |
| 12 |
|
| 13 |
libc_test_library( |
| 14 |
name = "test_logger", |
| 15 |
srcs = ["TestLogger.cpp"], |
| 16 |
hdrs = ["TestLogger.h"], |
| 17 |
deps = [ |
| 18 |
"//libc:__support_big_int", |
| 19 |
"//libc:__support_cpp_string", |
| 20 |
"//libc:__support_cpp_string_view", |
| 21 |
"//libc:__support_macros_config", |
| 22 |
"//libc:__support_macros_properties_types", |
| 23 |
"//libc:__support_osutil_io", |
| 24 |
"//libc:__support_uint128", |
| 25 |
"//libc:func_aligned_alloc", |
| 26 |
"//libc:func_free", |
| 27 |
"//libc:func_malloc", |
| 28 |
"//libc:func_realloc", |
| 29 |
], |
| 30 |
) |
| 31 |
|
| 32 |
libc_test_library( |
| 33 |
name = "LibcUnitTest", |
| 34 |
srcs = [ |
| 35 |
"BazelFilePath.cpp", |
| 36 |
"ExecuteFunctionUnix.cpp", |
| 37 |
"LibcTest.cpp", |
| 38 |
"LibcTestMain.cpp", |
| 39 |
], |
| 40 |
hdrs = [ |
| 41 |
"ErrnoSetterMatcher.h", |
| 42 |
"ExecuteFunction.h", |
| 43 |
"LibcTest.h", |
| 44 |
"PlatformDefs.h", |
| 45 |
"Test.h", |
| 46 |
], |
| 47 |
deps = [ |
| 48 |
":test_logger", |
| 49 |
"//libc:__support_c_string", |
| 50 |
"//libc:__support_cpp_bit", |
| 51 |
"//libc:__support_cpp_bitset", |
| 52 |
"//libc:__support_cpp_limits", |
| 53 |
"//libc:__support_cpp_span", |
| 54 |
"//libc:__support_cpp_string", |
| 55 |
"//libc:__support_cpp_string_view", |
| 56 |
"//libc:__support_cpp_type_traits", |
| 57 |
"//libc:__support_fixed_point", |
| 58 |
"//libc:__support_fputil_fp_bits", |
| 59 |
"//libc:__support_fputil_fpbits_str", |
| 60 |
"//libc:__support_fputil_rounding_mode", |
| 61 |
"//libc:__support_libc_errno", |
| 62 |
"//libc:__support_macros_config", |
| 63 |
"//libc:__support_macros_properties_architectures", |
| 64 |
"//libc:__support_macros_properties_types", |
| 65 |
"//libc:__support_stringutil", |
| 66 |
"//libc:__support_uint128", |
| 67 |
"//libc:errno", |
| 68 |
"//libc:func_aligned_alloc", |
| 69 |
"//libc:func_free", |
| 70 |
"//libc:func_malloc", |
| 71 |
"//libc:func_realloc", |
| 72 |
"//libc:llvm_libc_macros_stdfix_macros", |
| 73 |
"//llvm:Support", |
| 74 |
], |
| 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, |
| 78 |
) |
| 79 |
|
| 80 |
libc_test_library( |
| 81 |
name = "errno_test_helpers", |
| 82 |
hdrs = [ |
| 83 |
"ErrnoCheckingTest.h", |
| 84 |
], |
| 85 |
deps = [ |
| 86 |
":LibcUnitTest", |
| 87 |
"//libc:__support_libc_errno", |
| 88 |
"//libc:__support_macros_config", |
| 89 |
"//libc:errno", |
| 90 |
], |
| 91 |
) |
| 92 |
|
| 93 |
libc_test_library( |
| 94 |
name = "fp_test_helpers", |
| 95 |
srcs = [ |
| 96 |
"FEnvSafeTest.cpp", |
| 97 |
"FPExceptMatcher.cpp", |
| 98 |
"RoundingModeUtils.cpp", |
| 99 |
], |
| 100 |
hdrs = [ |
| 101 |
"FEnvSafeTest.h", |
| 102 |
"FPExceptMatcher.h", |
| 103 |
"FPMatcher.h", |
| 104 |
"RoundingModeUtils.h", |
| 105 |
], |
| 106 |
deps = [ |
| 107 |
":LibcUnitTest", |
| 108 |
":string_utils", |
| 109 |
":test_logger", |
| 110 |
"//libc:__support_cpp_array", |
| 111 |
"//libc:__support_cpp_bit", |
| 112 |
"//libc:__support_cpp_bitset", |
| 113 |
"//libc:__support_cpp_span", |
| 114 |
"//libc:__support_cpp_type_traits", |
| 115 |
"//libc:__support_cpp_utility", |
| 116 |
"//libc:__support_fputil_fenv_impl", |
| 117 |
"//libc:__support_fputil_fp_bits", |
| 118 |
"//libc:__support_fputil_fpbits_str", |
| 119 |
"//libc:__support_fputil_rounding_mode", |
| 120 |
"//libc:__support_macros_config", |
| 121 |
"//libc:__support_macros_properties_architectures", |
| 122 |
"//libc:hdr_fenv_macros", |
| 123 |
"//libc:hdr_math_macros", |
| 124 |
"//libc:types_fenv_t", |
| 125 |
], |
| 126 |
) |
| 127 |
|
| 128 |
libc_test_library( |
| 129 |
name = "memory_matcher", |
| 130 |
srcs = [ |
| 131 |
"MemoryMatcher.cpp", |
| 132 |
], |
| 133 |
hdrs = [ |
| 134 |
"MemoryMatcher.h", |
| 135 |
], |
| 136 |
deps = [ |
| 137 |
":LibcUnitTest", |
| 138 |
"//libc:__support_cpp_bit", |
| 139 |
"//libc:__support_cpp_bitset", |
| 140 |
"//libc:__support_cpp_span", |
| 141 |
"//libc:__support_cpp_type_traits", |
| 142 |
"//libc:__support_ctype_utils", |
| 143 |
"//libc:__support_macros_config", |
| 144 |
], |
| 145 |
) |
| 146 |
|
| 147 |
libc_test_library( |
| 148 |
name = "printf_matcher", |
| 149 |
srcs = [ |
| 150 |
"PrintfMatcher.cpp", |
| 151 |
], |
| 152 |
hdrs = [ |
| 153 |
"PrintfMatcher.h", |
| 154 |
], |
| 155 |
deps = [ |
| 156 |
":LibcUnitTest", |
| 157 |
":string_utils", |
| 158 |
"//libc:__support_fputil_fp_bits", |
| 159 |
"//libc:__support_macros_config", |
| 160 |
"//libc:printf_core_structs", |
| 161 |
], |
| 162 |
) |
| 163 |
|
| 164 |
libc_test_library( |
| 165 |
name = "string_utils", |
| 166 |
hdrs = [ |
| 167 |
"StringUtils.h", |
| 168 |
], |
| 169 |
deps = [ |
| 170 |
"//libc:__support_big_int", |
| 171 |
"//libc:__support_cpp_string", |
| 172 |
"//libc:__support_cpp_type_traits", |
| 173 |
"//libc:__support_macros_config", |
| 174 |
], |
| 175 |
) |