172 lines · plain
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-exception4 5# LLVM libc unittest library.6 7load("//libc/test:libc_test_rules.bzl", "libc_test_library")8 9package(default_visibility = ["//visibility:public"])10 11licenses(["notice"])12 13libc_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 "//libc:hdr_stdint_proxy",30 ],31)32 33libc_test_library(34 name = "LibcUnitTest",35 srcs = [36 "BazelFilePath.cpp",37 "ExecuteFunctionUnix.cpp",38 "LibcDeathTestExecutors.cpp",39 "LibcTest.cpp",40 "LibcTestMain.cpp",41 ],42 hdrs = [43 "ErrnoCheckingTest.h",44 "ErrnoSetterMatcher.h",45 "ExecuteFunction.h",46 "LibcTest.h",47 "PlatformDefs.h",48 "Test.h",49 ],50 deps = [51 ":test_logger",52 "//libc:__support_c_string",53 "//libc:__support_cpp_bit",54 "//libc:__support_cpp_bitset",55 "//libc:__support_cpp_limits",56 "//libc:__support_cpp_span",57 "//libc:__support_cpp_string",58 "//libc:__support_cpp_string_view",59 "//libc:__support_cpp_type_traits",60 "//libc:__support_fixed_point",61 "//libc:__support_fputil_fp_bits",62 "//libc:__support_fputil_fpbits_str",63 "//libc:__support_fputil_rounding_mode",64 "//libc:__support_libc_errno",65 "//libc:__support_macros_config",66 "//libc:__support_macros_properties_architectures",67 "//libc:__support_macros_properties_compiler",68 "//libc:__support_macros_properties_types",69 "//libc:__support_stringutil",70 "//libc:__support_uint128",71 "//libc:errno",72 "//libc:func_aligned_alloc",73 "//libc:func_free",74 "//libc:func_malloc",75 "//libc:func_realloc",76 "//libc:hdr_stdint_proxy",77 "//libc:llvm_libc_macros_stdfix_macros",78 "//llvm:Support",79 ],80 # Force linking in this library's `main()` to surface81 # a duplicate symbol error if a test defines its own main.82 alwayslink = True,83)84 85libc_test_library(86 name = "fp_test_helpers",87 srcs = [88 "FEnvSafeTest.cpp",89 "FPExceptMatcher.cpp",90 "RoundingModeUtils.cpp",91 ],92 hdrs = [93 "FEnvSafeTest.h",94 "FPExceptMatcher.h",95 "FPMatcher.h",96 "RoundingModeUtils.h",97 ],98 deps = [99 ":LibcUnitTest",100 ":string_utils",101 ":test_logger",102 "//libc:__support_cpp_array",103 "//libc:__support_cpp_bit",104 "//libc:__support_cpp_bitset",105 "//libc:__support_cpp_span",106 "//libc:__support_cpp_type_traits",107 "//libc:__support_cpp_utility",108 "//libc:__support_fputil_fenv_impl",109 "//libc:__support_fputil_fp_bits",110 "//libc:__support_fputil_fpbits_str",111 "//libc:__support_fputil_rounding_mode",112 "//libc:__support_libc_errno",113 "//libc:__support_macros_config",114 "//libc:__support_macros_optimization",115 "//libc:__support_macros_properties_architectures",116 "//libc:hdr_fenv_macros",117 "//libc:hdr_math_macros",118 "//libc:hdr_stdint_proxy",119 "//libc:types_fenv_t",120 ],121)122 123libc_test_library(124 name = "memory_matcher",125 srcs = [126 "MemoryMatcher.cpp",127 ],128 hdrs = [129 "MemoryMatcher.h",130 ],131 deps = [132 ":LibcUnitTest",133 "//libc:__support_cpp_bit",134 "//libc:__support_cpp_bitset",135 "//libc:__support_cpp_span",136 "//libc:__support_cpp_type_traits",137 "//libc:__support_ctype_utils",138 "//libc:__support_macros_config",139 ],140)141 142libc_test_library(143 name = "printf_matcher",144 srcs = [145 "PrintfMatcher.cpp",146 ],147 hdrs = [148 "PrintfMatcher.h",149 ],150 deps = [151 ":LibcUnitTest",152 ":string_utils",153 "//libc:__support_fputil_fp_bits",154 "//libc:__support_macros_config",155 "//libc:hdr_stdint_proxy",156 "//libc:printf_core_structs",157 ],158)159 160libc_test_library(161 name = "string_utils",162 hdrs = [163 "StringUtils.h",164 ],165 deps = [166 "//libc:__support_big_int",167 "//libc:__support_cpp_string",168 "//libc:__support_cpp_type_traits",169 "//libc:__support_macros_config",170 ],171)172