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