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# Tests for LLVM libc string.h functions. 6 7load("//libc:libc_build_rules.bzl", "libc_support_library") 8load("//libc/test:libc_test_rules.bzl", "libc_test") 9 10package(default_visibility = ["//visibility:public"]) 11 12licenses(["notice"]) 13 14libc_test( 15 name = "strlen_test", 16 srcs = ["strlen_test.cpp"], 17 libc_function_deps = [ 18 "//libc:strlen", 19 ], 20) 21 22libc_test( 23 name = "strcpy_test", 24 srcs = ["strcpy_test.cpp"], 25 libc_function_deps = [ 26 "//libc:strcpy", 27 ], 28) 29 30libc_test( 31 name = "strcmp_test", 32 srcs = ["strcmp_test.cpp"], 33 libc_function_deps = [ 34 "//libc:strcmp", 35 ], 36) 37 38libc_test( 39 name = "memchr_test", 40 srcs = ["memchr_test.cpp"], 41 libc_function_deps = [ 42 "//libc:memchr", 43 ], 44) 45 46libc_support_library( 47 name = "strchr_test_helper", 48 hdrs = ["StrchrTest.h"], 49 deps = ["//libc/test/UnitTest:LibcUnitTest"], 50) 51 52libc_test( 53 name = "strchr_test", 54 srcs = ["strchr_test.cpp"], 55 libc_function_deps = [ 56 "//libc:strchr", 57 ], 58 deps = [":strchr_test_helper"], 59) 60 61libc_test( 62 name = "strstr_test", 63 srcs = ["strstr_test.cpp"], 64 libc_function_deps = [ 65 "//libc:strstr", 66 ], 67) 68 69libc_test( 70 name = "strnlen_test", 71 srcs = ["strnlen_test.cpp"], 72 libc_function_deps = [ 73 "//libc:strnlen", 74 ], 75) 76 77libc_test( 78 name = "memrchr_test", 79 srcs = ["memrchr_test.cpp"], 80 libc_function_deps = [ 81 "//libc:memrchr", 82 ], 83) 84 85libc_test( 86 name = "strrchr_test", 87 srcs = ["strrchr_test.cpp"], 88 libc_function_deps = [ 89 "//libc:strrchr", 90 ], 91 deps = [":strchr_test_helper"], 92) 93 94libc_test( 95 name = "strcspn_test", 96 srcs = ["strcspn_test.cpp"], 97 libc_function_deps = [ 98 "//libc:strcspn", 99 ], 100) 101 102libc_test( 103 name = "strspn_test", 104 srcs = ["strspn_test.cpp"], 105 libc_function_deps = [ 106 "//libc:strspn", 107 ], 108) 109 110libc_test( 111 name = "strtok_test", 112 srcs = ["strtok_test.cpp"], 113 libc_function_deps = [ 114 "//libc:strtok", 115 ], 116) 117 118libc_support_library( 119 name = "memory_check_utils", 120 hdrs = ["memory_utils/memory_check_utils.h"], 121 deps = [ 122 "//libc:__support_cpp_span", 123 "//libc:__support_libc_assert", 124 "//libc:__support_macros_config", 125 "//libc:__support_macros_sanitizer", 126 "//libc:string_memory_utils", 127 ], 128) 129 130libc_support_library( 131 name = "protected_pages", 132 hdrs = ["memory_utils/protected_pages.h"], 133 deps = [ 134 "//libc:__support_macros_attributes", 135 "//libc:__support_macros_properties_os", 136 ], 137) 138 139libc_test( 140 name = "memcpy_test", 141 srcs = ["memcpy_test.cpp"], 142 libc_function_deps = [ 143 "//libc:memcpy", 144 ], 145 deps = [ 146 ":memory_check_utils", 147 ":protected_pages", 148 "//libc:__support_macros_properties_os", 149 ], 150) 151 152libc_test( 153 name = "mempcpy_test", 154 srcs = ["mempcpy_test.cpp"], 155 libc_function_deps = [ 156 "//libc:mempcpy", 157 ], 158) 159 160libc_test( 161 name = "memset_test", 162 srcs = ["memset_test.cpp"], 163 libc_function_deps = [ 164 "//libc:memset", 165 ], 166 deps = [ 167 ":memory_check_utils", 168 ":protected_pages", 169 "//libc:__support_macros_properties_os", 170 ], 171) 172 173libc_test( 174 name = "memmove_test", 175 srcs = ["memmove_test.cpp"], 176 libc_function_deps = [ 177 "//libc:memcmp", 178 "//libc:memmove", 179 ], 180 deps = [ 181 ":memory_check_utils", 182 "//libc:__support_cpp_span", 183 "//libc/test/UnitTest:memory_matcher", 184 ], 185) 186 187libc_test( 188 name = "memcmp_test", 189 srcs = ["memcmp_test.cpp"], 190 libc_function_deps = [ 191 "//libc:memcmp", 192 ], 193 deps = [ 194 ":memory_check_utils", 195 "//libc/test/UnitTest:test_logger", 196 ], 197) 198