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