xref: /llvm-project/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel (revision a0c4f854cad2b97e44a1b58dc1fd982e1c4d60f3)
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
7load("//libc:libc_build_rules.bzl", "libc_support_library")
8
9package(default_visibility = ["//visibility:public"])
10
11licenses(["notice"])
12
13libc_support_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
32libc_support_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_span",
53        "//libc:__support_cpp_string",
54        "//libc:__support_cpp_string_view",
55        "//libc:__support_cpp_type_traits",
56        "//libc:__support_fixed_point",
57        "//libc:__support_fputil_fp_bits",
58        "//libc:__support_fputil_fpbits_str",
59        "//libc:__support_fputil_rounding_mode",
60        "//libc:__support_macros_config",
61        "//libc:__support_macros_properties_architectures",
62        "//libc:__support_macros_properties_types",
63        "//libc:__support_stringutil",
64        "//libc:__support_uint128",
65        "//libc:errno",
66        "//libc:func_aligned_alloc",
67        "//libc:func_free",
68        "//libc:func_malloc",
69        "//libc:func_realloc",
70        "//libc:llvm_libc_macros_stdfix_macros",
71        "//llvm:Support",
72    ],
73)
74
75libc_support_library(
76    name = "fp_test_helpers",
77    srcs = [
78        "FEnvSafeTest.cpp",
79        "FPExceptMatcher.cpp",
80        "RoundingModeUtils.cpp",
81    ],
82    hdrs = [
83        "FEnvSafeTest.h",
84        "FPExceptMatcher.h",
85        "FPMatcher.h",
86        "RoundingModeUtils.h",
87    ],
88    deps = [
89        ":LibcUnitTest",
90        ":string_utils",
91        ":test_logger",
92        "//libc:__support_cpp_array",
93        "//libc:__support_cpp_bit",
94        "//libc:__support_cpp_bitset",
95        "//libc:__support_cpp_span",
96        "//libc:__support_cpp_type_traits",
97        "//libc:__support_cpp_utility",
98        "//libc:__support_fputil_fenv_impl",
99        "//libc:__support_fputil_fp_bits",
100        "//libc:__support_fputil_fpbits_str",
101        "//libc:__support_fputil_rounding_mode",
102        "//libc:__support_macros_config",
103        "//libc:__support_macros_properties_architectures",
104        "//libc:hdr_fenv_macros",
105        "//libc:hdr_math_macros",
106        "//libc:types_fenv_t",
107    ],
108)
109
110libc_support_library(
111    name = "memory_matcher",
112    srcs = [
113        "MemoryMatcher.cpp",
114    ],
115    hdrs = [
116        "MemoryMatcher.h",
117    ],
118    deps = [
119        ":LibcUnitTest",
120        "//libc:__support_cpp_bit",
121        "//libc:__support_cpp_bitset",
122        "//libc:__support_cpp_span",
123        "//libc:__support_cpp_type_traits",
124        "//libc:__support_ctype_utils",
125        "//libc:__support_macros_config",
126    ],
127)
128
129libc_support_library(
130    name = "printf_matcher",
131    srcs = [
132        "PrintfMatcher.cpp",
133    ],
134    hdrs = [
135        "PrintfMatcher.h",
136    ],
137    deps = [
138        ":LibcUnitTest",
139        ":string_utils",
140        "//libc:__support_fputil_fp_bits",
141        "//libc:__support_macros_config",
142        "//libc:printf_core_structs",
143    ],
144)
145
146libc_support_library(
147    name = "string_utils",
148    hdrs = [
149        "StringUtils.h",
150    ],
151    deps = [
152        "//libc:__support_big_int",
153        "//libc:__support_cpp_string",
154        "//libc:__support_cpp_type_traits",
155        "//libc:__support_macros_config",
156    ],
157)
158