Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 1 | licenses(["notice"]) |
Brian Silverman | 660d609 | 2015-11-26 18:41:59 -0500 | [diff] [blame] | 2 | |
Austin Schuh | dde6405 | 2019-12-11 20:28:00 -0800 | [diff] [blame] | 3 | load("//tools/build_rules:select.bzl", "compiler_select", "cpu_select") |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 4 | load("//tools/build_rules:empty_main.bzl", "empty_main_if_asan") |
Brian Silverman | 660d609 | 2015-11-26 18:41:59 -0500 | [diff] [blame] | 5 | |
| 6 | common_copts = [ |
Brian Silverman | a659aaa | 2022-01-02 00:19:11 -0800 | [diff] [blame] | 7 | # Stuff from their Makefile. |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 8 | "-Wno-cast-align", |
| 9 | "-Wno-sign-compare", |
| 10 | "-fno-builtin-malloc", |
| 11 | "-fno-builtin-free", |
| 12 | "-fno-builtin-realloc", |
| 13 | "-fno-builtin-calloc", |
| 14 | "-fno-builtin-cfree", |
| 15 | "-fno-builtin-memalign", |
| 16 | "-fno-builtin-posix_memalign", |
| 17 | "-fno-builtin-valloc", |
| 18 | "-fno-builtin-pvalloc", |
| 19 | "-Wno-unused-result", |
| 20 | "-fno-omit-frame-pointer", |
| 21 | "-DNDEBUG", |
Brian Silverman | a659aaa | 2022-01-02 00:19:11 -0800 | [diff] [blame] | 22 | "-DENABLE_EMERGENCY_MALLOC", |
Brian Silverman | 660d609 | 2015-11-26 18:41:59 -0500 | [diff] [blame] | 23 | |
Brian Silverman | a659aaa | 2022-01-02 00:19:11 -0800 | [diff] [blame] | 24 | # Stuff to make it work for us. |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 25 | "-Ithird_party/gperftools/src/", |
| 26 | "-Ithird_party/empty_config_h", |
| 27 | "-Wno-unused-parameter", |
| 28 | "-Wno-missing-field-initializers", |
| 29 | "-Wno-unused-function", |
| 30 | "-Wno-unused-variable", |
| 31 | "-Wno-format-nonliteral", |
| 32 | "-Wno-switch-enum", |
| 33 | "-Wno-error=cast-align", |
| 34 | "-Wno-error=cast-qual", |
Tyler Chatow | b8304af | 2022-02-25 20:52:46 -0800 | [diff] [blame] | 35 | "-Wno-cast-qual", |
James Kuszmaul | 9776b39 | 2023-01-14 14:08:08 -0800 | [diff] [blame] | 36 | "-Wno-array-bounds", |
| 37 | "-Wno-cast-function-type", |
Brian Silverman | 660d609 | 2015-11-26 18:41:59 -0500 | [diff] [blame] | 38 | |
Brian Silverman | a659aaa | 2022-01-02 00:19:11 -0800 | [diff] [blame] | 39 | # //build_tests:tcmalloc_build_test relies on this. |
| 40 | "-DENABLE_LARGE_ALLOC_REPORT=1", |
| 41 | |
| 42 | # Stuff pulled out of config.h. |
| 43 | "-DGPERFTOOLS_CONFIG_H_=1", |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 44 | "-DHAVE_BUILTIN_EXPECT=1", |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 45 | "-DHAVE_DECL_MEMALIGN=1", |
| 46 | "-DHAVE_DECL_POSIX_MEMALIGN=1", |
| 47 | "-DHAVE_DECL_PVALLOC=1", |
| 48 | "-DHAVE_DECL_UNAME=1", |
| 49 | "-DHAVE_DECL_VALLOC=1", |
| 50 | "-DHAVE_DLFCN_H=1", |
| 51 | "-DHAVE_ELF32_VERSYM=1", |
| 52 | "-DHAVE_EXECINFO_H=1", |
| 53 | "-DHAVE_FCNTL_H=1", |
| 54 | "-DHAVE_FEATURES_H=1", |
| 55 | "-DHAVE_FORK=1", |
| 56 | "-DHAVE_GETEUID=1", |
| 57 | "-DHAVE_GLOB_H=1", |
| 58 | "-DHAVE_GRP_H=1", |
| 59 | "-DHAVE_INTTYPES_H=1", |
| 60 | "-DHAVE_LINUX_PTRACE_H=1", |
| 61 | "-DHAVE_LINUX_SIGEV_THREAD_ID=1", |
| 62 | "-DHAVE_MALLOC_H=1", |
| 63 | "-DHAVE_MEMORY_H=1", |
| 64 | "-DHAVE_MMAP=1", |
| 65 | "-DHAVE_NAMESPACES=1", |
| 66 | "-DHAVE_POLL_H=1", |
| 67 | "-DHAVE_PROGRAM_INVOCATION_NAME=1", |
| 68 | "-DHAVE_PTHREAD=1", |
| 69 | "-DHAVE_PWD_H=1", |
| 70 | "-DHAVE_SBRK=1", |
| 71 | "-DHAVE_SCHED_H=1", |
| 72 | "-DHAVE_STDINT_H=1", |
| 73 | "-DHAVE_STDLIB_H=1", |
| 74 | "-DHAVE_STRINGS_H=1", |
| 75 | "-DHAVE_STRING_H=1", |
| 76 | "-DHAVE_STRUCT_MALLINFO=1", |
| 77 | "-DHAVE_SYS_CDEFS_H=1", |
| 78 | "-DHAVE_SYS_PRCTL_H=1", |
| 79 | "-DHAVE_SYS_RESOURCE_H=1", |
| 80 | "-DHAVE_SYS_SOCKET_H=1", |
| 81 | "-DHAVE_SYS_STAT_H=1", |
| 82 | "-DHAVE_SYS_SYSCALL_H=1", |
| 83 | "-DHAVE_SYS_TYPES_H=1", |
| 84 | "-DHAVE_SYS_UCONTEXT_H=1", |
| 85 | "-DHAVE_SYS_WAIT_H=1", |
| 86 | "-DHAVE_TLS=1", |
| 87 | "-DHAVE_UCONTEXT_H=1", |
| 88 | "-DHAVE_UNISTD_H=1", |
| 89 | "-DHAVE_UNWIND_H=1", |
| 90 | "-DHAVE___ATTRIBUTE__=1", |
| 91 | "-DHAVE___ENVIRON=1", |
| 92 | "-DMALLOC_HOOK_MAYBE_VOLATILE=volatile", |
| 93 | "-DPERFTOOLS_DLL_DECL=", |
| 94 | "-DSTDC_HEADERS=1", |
| 95 | "-DSTL_NAMESPACE=std", |
Brian Silverman | a659aaa | 2022-01-02 00:19:11 -0800 | [diff] [blame] | 96 | "-DPACKAGE_STRING=\\\"gperftools\\ 2.9.1\\\"", |
Austin Schuh | a5778ae | 2020-10-21 21:15:35 -0700 | [diff] [blame] | 97 | "-DPACKAGE_BUGREPORT=\\\"https://frc971.org/contact\\\"", |
Brian Silverman | a659aaa | 2022-01-02 00:19:11 -0800 | [diff] [blame] | 98 | "-DPACKAGE_VERSION=\\\"2.9.1\\\"", |
Brian Silverman | 660d609 | 2015-11-26 18:41:59 -0500 | [diff] [blame] | 99 | ] + cpu_select({ |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 100 | "amd64": [ |
| 101 | "-DHAVE_GETPAGESZE=1", |
| 102 | "-DHAVE_SYS_PARAM_H=1", |
| 103 | "-DPC_FROM_UCONTEXT=uc_mcontext.gregs[REG_RIP]", |
| 104 | "-DPRIdS=\\\"ld\\\"", |
| 105 | "-DPRIuS=\\\"lu\\\"", |
| 106 | "-DPRIxS=\\\"lx\\\"", |
| 107 | ], |
Philipp Schrader | f1bbf34 | 2022-02-05 14:30:15 -0800 | [diff] [blame] | 108 | "arm32": [ |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 109 | "-DPC_FROM_UCONTEXT=uc_mcontext.arm_pc", |
| 110 | "-DPRIdS=\\\"d\\\"", |
| 111 | "-DPRIuS=\\\"u\\\"", |
| 112 | "-DPRIxS=\\\"x\\\"", |
| 113 | ], |
Philipp Schrader | f1bbf34 | 2022-02-05 14:30:15 -0800 | [diff] [blame] | 114 | "arm64": [ |
| 115 | "-DPC_FROM_UCONTEXT=uc_mcontext.pc", |
| 116 | "-DPRIdS=\\\"ld\\\"", |
| 117 | "-DPRIuS=\\\"lu\\\"", |
| 118 | "-DPRIxS=\\\"lx\\\"", |
| 119 | ], |
Brian Silverman | 660d609 | 2015-11-26 18:41:59 -0500 | [diff] [blame] | 120 | }) + compiler_select({ |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 121 | "clang": [ |
| 122 | "-Wno-unused-const-variable", |
Brian Silverman | 4c7235a | 2021-11-17 19:04:37 -0800 | [diff] [blame] | 123 | "-Wno-unused-but-set-variable", |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 124 | "-Wno-gnu-alignof-expression", |
| 125 | "-Wno-unused-private-field", |
Brian Silverman | a659aaa | 2022-01-02 00:19:11 -0800 | [diff] [blame] | 126 | |
| 127 | # It has annotations for this analysis, but the invariants are too tricky |
| 128 | # for clang to figure out by itself so it has lots of false positives. Just |
| 129 | # disable the analysis to simplify. |
| 130 | "-Wno-thread-safety-analysis", |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 131 | ], |
James Kuszmaul | 9776b39 | 2023-01-14 14:08:08 -0800 | [diff] [blame] | 132 | "gcc": [ |
| 133 | "-Wno-use-after-free", |
| 134 | "-Wno-ignored-qualifiers", |
| 135 | ], |
Brian Silverman | 660d609 | 2015-11-26 18:41:59 -0500 | [diff] [blame] | 136 | }) |
| 137 | |
| 138 | cc_library( |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 139 | name = "tcmalloc", |
| 140 | srcs = glob( |
| 141 | include = [ |
| 142 | "src/*.cc", |
| 143 | "src/*.c", |
| 144 | "src/base/*.cc", |
| 145 | "src/base/*.c", |
| 146 | ], |
| 147 | exclude = [ |
| 148 | "**/*_unittest.cc", |
| 149 | "**/*_test.cc", |
| 150 | "src/debugallocation.cc", |
Brian Silverman | a659aaa | 2022-01-02 00:19:11 -0800 | [diff] [blame] | 151 | "src/fake_stacktrace_scope.cc", |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 152 | ], |
| 153 | ), |
| 154 | hdrs = glob([ |
| 155 | "src/*.h", |
| 156 | "src/base/*.h", |
| 157 | "src/gperftools/*.h", |
Brian Silverman | a659aaa | 2022-01-02 00:19:11 -0800 | [diff] [blame] | 158 | ]), |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 159 | copts = common_copts, |
Austin Schuh | dde6405 | 2019-12-11 20:28:00 -0800 | [diff] [blame] | 160 | includes = ["src"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 161 | linkopts = [ |
| 162 | "-lrt", |
| 163 | "-lpthread", |
| 164 | ], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 165 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 166 | visibility = ["//visibility:public"], |
| 167 | deps = [ |
| 168 | "//third_party/empty_config_h", |
| 169 | ], |
| 170 | alwayslink = True, |
Brian Silverman | 660d609 | 2015-11-26 18:41:59 -0500 | [diff] [blame] | 171 | ) |
| 172 | |
| 173 | cc_library( |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 174 | name = "testutil", |
| 175 | srcs = [ |
| 176 | "src/tests/testutil.cc", |
Brian Silverman | 660d609 | 2015-11-26 18:41:59 -0500 | [diff] [blame] | 177 | ], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 178 | hdrs = [ |
| 179 | "src/tests/testutil.h", |
| 180 | ], |
| 181 | copts = common_copts, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 182 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 183 | deps = [ |
| 184 | ":tcmalloc", |
| 185 | ], |
Brian Silverman | 660d609 | 2015-11-26 18:41:59 -0500 | [diff] [blame] | 186 | ) |
| 187 | |
| 188 | cc_test( |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 189 | name = "low_level_alloc_unittest", |
| 190 | size = "medium", |
| 191 | srcs = [ |
| 192 | "src/tests/low_level_alloc_unittest.cc", |
| 193 | ], |
| 194 | copts = common_copts, |
| 195 | defines = [ |
| 196 | "NO_TCMALLOC_SAMPLES", |
| 197 | ], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 198 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 199 | deps = [ |
| 200 | ":tcmalloc", |
| 201 | ], |
Brian Silverman | 660d609 | 2015-11-26 18:41:59 -0500 | [diff] [blame] | 202 | ) |
| 203 | |
| 204 | cc_test( |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 205 | name = "atomicops_unittest", |
| 206 | size = "small", |
| 207 | srcs = [ |
| 208 | "src/tests/atomicops_unittest.cc", |
| 209 | ], |
| 210 | copts = common_copts, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 211 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 212 | deps = [ |
| 213 | ":tcmalloc", |
| 214 | ], |
Brian Silverman | 660d609 | 2015-11-26 18:41:59 -0500 | [diff] [blame] | 215 | ) |
| 216 | |
| 217 | cc_test( |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 218 | name = "stacktrace_unittest", |
| 219 | size = "small", |
| 220 | srcs = [ |
| 221 | "src/tests/stacktrace_unittest.cc", |
| 222 | ], |
| 223 | copts = common_copts, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 224 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 225 | deps = [ |
| 226 | ":tcmalloc", |
Brian Silverman | a659aaa | 2022-01-02 00:19:11 -0800 | [diff] [blame] | 227 | ":testutil", |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 228 | ], |
Brian Silverman | 660d609 | 2015-11-26 18:41:59 -0500 | [diff] [blame] | 229 | ) |
| 230 | |
| 231 | cc_test( |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 232 | name = "tcmalloc_unittest", |
| 233 | size = "small", |
| 234 | srcs = empty_main_if_asan([ |
| 235 | "src/tests/tcmalloc_unittest.cc", |
| 236 | ]), |
| 237 | copts = common_copts + [ |
| 238 | "-fno-builtin", |
Austin Schuh | dde6405 | 2019-12-11 20:28:00 -0800 | [diff] [blame] | 239 | #Add this back in when we upgrade clang. |
| 240 | #'-Wno-mismatched-new-delete', |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 241 | ], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 242 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 243 | deps = [ |
| 244 | ":tcmalloc", |
| 245 | ":testutil", |
| 246 | ], |
Brian Silverman | 660d609 | 2015-11-26 18:41:59 -0500 | [diff] [blame] | 247 | ) |
| 248 | |
| 249 | cc_test( |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 250 | name = "tcmalloc_large_unittest", |
| 251 | size = "small", |
| 252 | srcs = empty_main_if_asan([ |
| 253 | "src/tests/tcmalloc_large_unittest.cc", |
| 254 | ]), |
| 255 | copts = common_copts + [ |
| 256 | "-fno-builtin", |
| 257 | ], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 258 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 259 | deps = [ |
| 260 | ":tcmalloc", |
Brian Silverman | a659aaa | 2022-01-02 00:19:11 -0800 | [diff] [blame] | 261 | ":testutil", |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 262 | ], |
Brian Silverman | 660d609 | 2015-11-26 18:41:59 -0500 | [diff] [blame] | 263 | ) |
| 264 | |
| 265 | cc_test( |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 266 | name = "addressmap_unittest", |
| 267 | size = "medium", |
| 268 | srcs = [ |
| 269 | "src/tests/addressmap_unittest.cc", |
| 270 | ], |
| 271 | copts = common_copts, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 272 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 273 | deps = [ |
| 274 | ":tcmalloc", |
| 275 | ], |
Brian Silverman | 660d609 | 2015-11-26 18:41:59 -0500 | [diff] [blame] | 276 | ) |
| 277 | |
| 278 | cc_test( |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 279 | name = "system_alloc_unittest", |
| 280 | size = "small", |
| 281 | srcs = empty_main_if_asan([ |
| 282 | "src/tests/system-alloc_unittest.cc", |
| 283 | ]), |
| 284 | copts = common_copts + [ |
| 285 | "-fno-builtin", |
| 286 | ], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 287 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 288 | deps = [ |
| 289 | ":tcmalloc", |
Brian Silverman | a659aaa | 2022-01-02 00:19:11 -0800 | [diff] [blame] | 290 | ":testutil", |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 291 | ], |
Brian Silverman | 660d609 | 2015-11-26 18:41:59 -0500 | [diff] [blame] | 292 | ) |
| 293 | |
| 294 | cc_test( |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 295 | name = "packed_cache_test", |
| 296 | size = "small", |
| 297 | srcs = [ |
| 298 | "src/tests/packed-cache_test.cc", |
| 299 | ], |
| 300 | copts = common_copts, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 301 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 302 | deps = [ |
| 303 | ":tcmalloc", |
| 304 | ], |
Brian Silverman | 660d609 | 2015-11-26 18:41:59 -0500 | [diff] [blame] | 305 | ) |
| 306 | |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 307 | cc_test( |
| 308 | name = "frag_unittest", |
| 309 | size = "small", |
| 310 | srcs = [ |
| 311 | "src/tests/frag_unittest.cc", |
| 312 | ], |
| 313 | copts = common_copts, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 314 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 315 | deps = [ |
| 316 | ":tcmalloc", |
| 317 | ], |
| 318 | ) |
| 319 | |
| 320 | cc_test( |
| 321 | name = "markidle_unittest", |
| 322 | size = "small", |
| 323 | srcs = empty_main_if_asan([ |
| 324 | "src/tests/markidle_unittest.cc", |
| 325 | ]), |
| 326 | copts = common_copts, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 327 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 328 | deps = [ |
| 329 | ":tcmalloc", |
| 330 | ":testutil", |
| 331 | ], |
| 332 | ) |
| 333 | |
| 334 | cc_test( |
| 335 | name = "current_allocated_bytes_test", |
| 336 | size = "small", |
| 337 | srcs = [ |
| 338 | "src/tests/current_allocated_bytes_test.cc", |
| 339 | ], |
| 340 | copts = common_copts, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 341 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 342 | deps = [ |
| 343 | ":tcmalloc", |
| 344 | ], |
| 345 | ) |
| 346 | |
| 347 | cc_test( |
| 348 | name = "malloc_hook_test", |
| 349 | size = "small", |
| 350 | srcs = [ |
| 351 | "src/tests/malloc_hook_test.cc", |
| 352 | ], |
| 353 | copts = common_copts + compiler_select({ |
| 354 | "gcc": [ |
| 355 | "-Wno-maybe-uninitialized", |
| 356 | ], |
| 357 | "clang": [], |
| 358 | }), |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 359 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 360 | deps = [ |
| 361 | ":tcmalloc", |
| 362 | ":testutil", |
| 363 | ], |
| 364 | ) |
| 365 | |
| 366 | cc_test( |
| 367 | name = "malloc_extension_test", |
| 368 | size = "small", |
| 369 | srcs = empty_main_if_asan([ |
| 370 | "src/tests/malloc_extension_test.cc", |
| 371 | ]), |
| 372 | copts = common_copts, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 373 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 374 | deps = [ |
| 375 | ":tcmalloc", |
| 376 | ], |
| 377 | ) |
| 378 | |
| 379 | cc_test( |
| 380 | name = "malloc_extension_c_test", |
| 381 | size = "small", |
| 382 | srcs = empty_main_if_asan([ |
| 383 | "src/tests/malloc_extension_c_test.c", |
| 384 | ]), |
| 385 | copts = common_copts, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 386 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 387 | deps = [ |
| 388 | ":tcmalloc", |
| 389 | ], |
| 390 | ) |
| 391 | |
| 392 | cc_test( |
| 393 | name = "memalign_unittest", |
| 394 | size = "small", |
| 395 | srcs = empty_main_if_asan([ |
| 396 | "src/tests/memalign_unittest.cc", |
| 397 | ]), |
| 398 | copts = common_copts, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 399 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 400 | deps = [ |
| 401 | ":tcmalloc", |
| 402 | ":testutil", |
| 403 | ], |
| 404 | ) |
| 405 | |
| 406 | cc_test( |
| 407 | name = "page_heap_test", |
| 408 | size = "small", |
| 409 | srcs = [ |
| 410 | "src/tests/page_heap_test.cc", |
| 411 | ], |
| 412 | copts = common_copts, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 413 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 414 | deps = [ |
| 415 | ":tcmalloc", |
| 416 | ], |
| 417 | ) |
| 418 | |
| 419 | cc_test( |
| 420 | name = "pagemap_unittest", |
| 421 | size = "small", |
| 422 | srcs = empty_main_if_asan([ |
| 423 | "src/tests/pagemap_unittest.cc", |
| 424 | ]), |
| 425 | copts = common_copts, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 426 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 427 | deps = [ |
| 428 | ":tcmalloc", |
| 429 | ], |
| 430 | ) |
| 431 | |
| 432 | cc_test( |
| 433 | name = "realloc_unittest", |
| 434 | size = "small", |
| 435 | srcs = [ |
| 436 | "src/tests/realloc_unittest.cc", |
| 437 | ], |
| 438 | copts = common_copts, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 439 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 440 | deps = [ |
| 441 | ":tcmalloc", |
| 442 | ], |
| 443 | ) |
| 444 | |
| 445 | cc_test( |
| 446 | name = "stack_trace_table_test", |
| 447 | size = "small", |
| 448 | srcs = [ |
| 449 | "src/tests/stack_trace_table_test.cc", |
| 450 | ], |
| 451 | copts = common_copts, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 452 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 453 | deps = [ |
| 454 | ":tcmalloc", |
| 455 | ], |
| 456 | ) |
| 457 | |
| 458 | cc_test( |
| 459 | name = "thread_dealloc_unittest", |
| 460 | size = "small", |
| 461 | srcs = [ |
| 462 | "src/tests/thread_dealloc_unittest.cc", |
| 463 | ], |
| 464 | copts = common_copts, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 465 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 466 | deps = [ |
| 467 | ":tcmalloc", |
| 468 | ":testutil", |
| 469 | ], |
| 470 | ) |
| 471 | |
| 472 | """ |
Brian Silverman | 660d609 | 2015-11-26 18:41:59 -0500 | [diff] [blame] | 473 | We don't build this because it actually needs to be in a separate binary. |
| 474 | cc_test( |
| 475 | name = 'debugallocation_test', |
| 476 | srcs = [ |
| 477 | 'src/tests/debugallocation_test.cc', |
| 478 | ], |
| 479 | deps = [ |
| 480 | ':tcmalloc', |
| 481 | ], |
| 482 | copts = common_copts, |
| 483 | size = 'small', |
| 484 | ) |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 485 | """ |
Brian Silverman | 660d609 | 2015-11-26 18:41:59 -0500 | [diff] [blame] | 486 | |
| 487 | cc_test( |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 488 | name = "tcmalloc_large_heap_fragmentation_unittest", |
| 489 | size = "small", |
| 490 | srcs = empty_main_if_asan([ |
| 491 | "src/tests/large_heap_fragmentation_unittest.cc", |
| 492 | ]), |
| 493 | copts = common_copts, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 494 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 495 | deps = [ |
| 496 | ":tcmalloc", |
| 497 | ], |
Brian Silverman | 660d609 | 2015-11-26 18:41:59 -0500 | [diff] [blame] | 498 | ) |
| 499 | |
| 500 | cc_test( |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 501 | name = "raw_printer_test", |
| 502 | size = "small", |
| 503 | srcs = [ |
| 504 | "src/tests/raw_printer_test.cc", |
| 505 | ], |
| 506 | copts = common_copts, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 507 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 508 | deps = [ |
| 509 | ":tcmalloc", |
| 510 | ], |
Brian Silverman | 660d609 | 2015-11-26 18:41:59 -0500 | [diff] [blame] | 511 | ) |
| 512 | |
| 513 | cc_test( |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 514 | name = "getpc_test", |
| 515 | size = "small", |
| 516 | srcs = empty_main_if_asan([ |
| 517 | "src/tests/getpc_test.cc", |
| 518 | ]), |
| 519 | copts = common_copts, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 520 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 521 | deps = [ |
| 522 | ":tcmalloc", |
| 523 | ], |
Brian Silverman | 660d609 | 2015-11-26 18:41:59 -0500 | [diff] [blame] | 524 | ) |
| 525 | |
| 526 | cc_test( |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 527 | name = "profiledata_unittest", |
| 528 | size = "small", |
| 529 | srcs = [ |
| 530 | "src/tests/profiledata_unittest.cc", |
| 531 | ], |
| 532 | copts = common_copts, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 533 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 534 | deps = [ |
| 535 | ":tcmalloc", |
| 536 | ], |
Brian Silverman | 660d609 | 2015-11-26 18:41:59 -0500 | [diff] [blame] | 537 | ) |
| 538 | |
| 539 | cc_test( |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 540 | name = "profile_handler_unittest", |
| 541 | size = "small", |
| 542 | srcs = [ |
| 543 | "src/tests/profile-handler_unittest.cc", |
| 544 | ], |
| 545 | copts = common_copts, |
| 546 | flaky = True, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 547 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 548 | deps = [ |
| 549 | ":tcmalloc", |
| 550 | ], |
Brian Silverman | 660d609 | 2015-11-26 18:41:59 -0500 | [diff] [blame] | 551 | ) |
| 552 | |
| 553 | cc_test( |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 554 | name = "heap_profiler_unittest", |
| 555 | size = "small", |
| 556 | srcs = [ |
| 557 | "src/tests/heap-profiler_unittest.cc", |
| 558 | ], |
| 559 | copts = common_copts, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 560 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 561 | deps = [ |
| 562 | ":tcmalloc", |
| 563 | ], |
Brian Silverman | 660d609 | 2015-11-26 18:41:59 -0500 | [diff] [blame] | 564 | ) |
| 565 | |
| 566 | cc_test( |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 567 | name = "sampler_test", |
| 568 | size = "small", |
| 569 | srcs = [ |
| 570 | "src/tests/sampler_test.cc", |
| 571 | ], |
| 572 | copts = common_copts + [ |
| 573 | "-Wno-type-limits", |
| 574 | ], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 575 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 576 | deps = [ |
| 577 | ":tcmalloc", |
| 578 | ], |
Brian Silverman | 660d609 | 2015-11-26 18:41:59 -0500 | [diff] [blame] | 579 | ) |