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