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