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 | ], |
Austin Schuh | a4f69d6 | 2020-02-28 13:58:14 -0800 | [diff] [blame] | 165 | nocopts = "-std=gnu\\+\\+1y", |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 166 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 167 | visibility = ["//visibility:public"], |
| 168 | deps = [ |
| 169 | "//third_party/empty_config_h", |
| 170 | ], |
| 171 | alwayslink = True, |
Brian Silverman | 660d609 | 2015-11-26 18:41:59 -0500 | [diff] [blame] | 172 | ) |
| 173 | |
| 174 | cc_library( |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 175 | name = "testutil", |
| 176 | srcs = [ |
| 177 | "src/tests/testutil.cc", |
Brian Silverman | 660d609 | 2015-11-26 18:41:59 -0500 | [diff] [blame] | 178 | ], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 179 | hdrs = [ |
| 180 | "src/tests/testutil.h", |
| 181 | ], |
| 182 | copts = common_copts, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 183 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 184 | deps = [ |
| 185 | ":tcmalloc", |
| 186 | ], |
Brian Silverman | 660d609 | 2015-11-26 18:41:59 -0500 | [diff] [blame] | 187 | ) |
| 188 | |
| 189 | cc_test( |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 190 | name = "low_level_alloc_unittest", |
| 191 | size = "medium", |
| 192 | srcs = [ |
| 193 | "src/tests/low_level_alloc_unittest.cc", |
| 194 | ], |
| 195 | copts = common_copts, |
| 196 | defines = [ |
| 197 | "NO_TCMALLOC_SAMPLES", |
| 198 | ], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 199 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 200 | deps = [ |
| 201 | ":tcmalloc", |
| 202 | ], |
Brian Silverman | 660d609 | 2015-11-26 18:41:59 -0500 | [diff] [blame] | 203 | ) |
| 204 | |
| 205 | cc_test( |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 206 | name = "atomicops_unittest", |
| 207 | size = "small", |
| 208 | srcs = [ |
| 209 | "src/tests/atomicops_unittest.cc", |
| 210 | ], |
| 211 | copts = common_copts, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 212 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 213 | deps = [ |
| 214 | ":tcmalloc", |
| 215 | ], |
Brian Silverman | 660d609 | 2015-11-26 18:41:59 -0500 | [diff] [blame] | 216 | ) |
| 217 | |
| 218 | cc_test( |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 219 | name = "stacktrace_unittest", |
| 220 | size = "small", |
| 221 | srcs = [ |
| 222 | "src/tests/stacktrace_unittest.cc", |
| 223 | ], |
| 224 | copts = common_copts, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 225 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 226 | deps = [ |
| 227 | ":tcmalloc", |
Brian Silverman | a659aaa | 2022-01-02 00:19:11 -0800 | [diff] [blame] | 228 | ":testutil", |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 229 | ], |
Brian Silverman | 660d609 | 2015-11-26 18:41:59 -0500 | [diff] [blame] | 230 | ) |
| 231 | |
| 232 | cc_test( |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 233 | name = "tcmalloc_unittest", |
| 234 | size = "small", |
| 235 | srcs = empty_main_if_asan([ |
| 236 | "src/tests/tcmalloc_unittest.cc", |
| 237 | ]), |
| 238 | copts = common_copts + [ |
| 239 | "-fno-builtin", |
Austin Schuh | dde6405 | 2019-12-11 20:28:00 -0800 | [diff] [blame] | 240 | #Add this back in when we upgrade clang. |
| 241 | #'-Wno-mismatched-new-delete', |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 242 | ], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 243 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 244 | deps = [ |
| 245 | ":tcmalloc", |
| 246 | ":testutil", |
| 247 | ], |
Brian Silverman | 660d609 | 2015-11-26 18:41:59 -0500 | [diff] [blame] | 248 | ) |
| 249 | |
| 250 | cc_test( |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 251 | name = "tcmalloc_large_unittest", |
| 252 | size = "small", |
| 253 | srcs = empty_main_if_asan([ |
| 254 | "src/tests/tcmalloc_large_unittest.cc", |
| 255 | ]), |
| 256 | copts = common_copts + [ |
| 257 | "-fno-builtin", |
| 258 | ], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 259 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 260 | deps = [ |
| 261 | ":tcmalloc", |
Brian Silverman | a659aaa | 2022-01-02 00:19:11 -0800 | [diff] [blame] | 262 | ":testutil", |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 263 | ], |
Brian Silverman | 660d609 | 2015-11-26 18:41:59 -0500 | [diff] [blame] | 264 | ) |
| 265 | |
| 266 | cc_test( |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 267 | name = "addressmap_unittest", |
| 268 | size = "medium", |
| 269 | srcs = [ |
| 270 | "src/tests/addressmap_unittest.cc", |
| 271 | ], |
| 272 | copts = common_copts, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 273 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 274 | deps = [ |
| 275 | ":tcmalloc", |
| 276 | ], |
Brian Silverman | 660d609 | 2015-11-26 18:41:59 -0500 | [diff] [blame] | 277 | ) |
| 278 | |
| 279 | cc_test( |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 280 | name = "system_alloc_unittest", |
| 281 | size = "small", |
| 282 | srcs = empty_main_if_asan([ |
| 283 | "src/tests/system-alloc_unittest.cc", |
| 284 | ]), |
| 285 | copts = common_copts + [ |
| 286 | "-fno-builtin", |
| 287 | ], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 288 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 289 | deps = [ |
| 290 | ":tcmalloc", |
Brian Silverman | a659aaa | 2022-01-02 00:19:11 -0800 | [diff] [blame] | 291 | ":testutil", |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 292 | ], |
Brian Silverman | 660d609 | 2015-11-26 18:41:59 -0500 | [diff] [blame] | 293 | ) |
| 294 | |
| 295 | cc_test( |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 296 | name = "packed_cache_test", |
| 297 | size = "small", |
| 298 | srcs = [ |
| 299 | "src/tests/packed-cache_test.cc", |
| 300 | ], |
| 301 | copts = common_copts, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 302 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 303 | deps = [ |
| 304 | ":tcmalloc", |
| 305 | ], |
Brian Silverman | 660d609 | 2015-11-26 18:41:59 -0500 | [diff] [blame] | 306 | ) |
| 307 | |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 308 | cc_test( |
| 309 | name = "frag_unittest", |
| 310 | size = "small", |
| 311 | srcs = [ |
| 312 | "src/tests/frag_unittest.cc", |
| 313 | ], |
| 314 | copts = common_copts, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 315 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 316 | deps = [ |
| 317 | ":tcmalloc", |
| 318 | ], |
| 319 | ) |
| 320 | |
| 321 | cc_test( |
| 322 | name = "markidle_unittest", |
| 323 | size = "small", |
| 324 | srcs = empty_main_if_asan([ |
| 325 | "src/tests/markidle_unittest.cc", |
| 326 | ]), |
| 327 | copts = common_copts, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 328 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 329 | deps = [ |
| 330 | ":tcmalloc", |
| 331 | ":testutil", |
| 332 | ], |
| 333 | ) |
| 334 | |
| 335 | cc_test( |
| 336 | name = "current_allocated_bytes_test", |
| 337 | size = "small", |
| 338 | srcs = [ |
| 339 | "src/tests/current_allocated_bytes_test.cc", |
| 340 | ], |
| 341 | copts = common_copts, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 342 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 343 | deps = [ |
| 344 | ":tcmalloc", |
| 345 | ], |
| 346 | ) |
| 347 | |
| 348 | cc_test( |
| 349 | name = "malloc_hook_test", |
| 350 | size = "small", |
| 351 | srcs = [ |
| 352 | "src/tests/malloc_hook_test.cc", |
| 353 | ], |
| 354 | copts = common_copts + compiler_select({ |
| 355 | "gcc": [ |
| 356 | "-Wno-maybe-uninitialized", |
| 357 | ], |
| 358 | "clang": [], |
| 359 | }), |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 360 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 361 | deps = [ |
| 362 | ":tcmalloc", |
| 363 | ":testutil", |
| 364 | ], |
| 365 | ) |
| 366 | |
| 367 | cc_test( |
| 368 | name = "malloc_extension_test", |
| 369 | size = "small", |
| 370 | srcs = empty_main_if_asan([ |
| 371 | "src/tests/malloc_extension_test.cc", |
| 372 | ]), |
| 373 | copts = common_copts, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 374 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 375 | deps = [ |
| 376 | ":tcmalloc", |
| 377 | ], |
| 378 | ) |
| 379 | |
| 380 | cc_test( |
| 381 | name = "malloc_extension_c_test", |
| 382 | size = "small", |
| 383 | srcs = empty_main_if_asan([ |
| 384 | "src/tests/malloc_extension_c_test.c", |
| 385 | ]), |
| 386 | copts = common_copts, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 387 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 388 | deps = [ |
| 389 | ":tcmalloc", |
| 390 | ], |
| 391 | ) |
| 392 | |
| 393 | cc_test( |
| 394 | name = "memalign_unittest", |
| 395 | size = "small", |
| 396 | srcs = empty_main_if_asan([ |
| 397 | "src/tests/memalign_unittest.cc", |
| 398 | ]), |
| 399 | copts = common_copts, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 400 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 401 | deps = [ |
| 402 | ":tcmalloc", |
| 403 | ":testutil", |
| 404 | ], |
| 405 | ) |
| 406 | |
| 407 | cc_test( |
| 408 | name = "page_heap_test", |
| 409 | size = "small", |
| 410 | srcs = [ |
| 411 | "src/tests/page_heap_test.cc", |
| 412 | ], |
| 413 | copts = common_copts, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 414 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 415 | deps = [ |
| 416 | ":tcmalloc", |
| 417 | ], |
| 418 | ) |
| 419 | |
| 420 | cc_test( |
| 421 | name = "pagemap_unittest", |
| 422 | size = "small", |
| 423 | srcs = empty_main_if_asan([ |
| 424 | "src/tests/pagemap_unittest.cc", |
| 425 | ]), |
| 426 | copts = common_copts, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 427 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 428 | deps = [ |
| 429 | ":tcmalloc", |
| 430 | ], |
| 431 | ) |
| 432 | |
| 433 | cc_test( |
| 434 | name = "realloc_unittest", |
| 435 | size = "small", |
| 436 | srcs = [ |
| 437 | "src/tests/realloc_unittest.cc", |
| 438 | ], |
| 439 | copts = common_copts, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 440 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 441 | deps = [ |
| 442 | ":tcmalloc", |
| 443 | ], |
| 444 | ) |
| 445 | |
| 446 | cc_test( |
| 447 | name = "stack_trace_table_test", |
| 448 | size = "small", |
| 449 | srcs = [ |
| 450 | "src/tests/stack_trace_table_test.cc", |
| 451 | ], |
| 452 | copts = common_copts, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 453 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 454 | deps = [ |
| 455 | ":tcmalloc", |
| 456 | ], |
| 457 | ) |
| 458 | |
| 459 | cc_test( |
| 460 | name = "thread_dealloc_unittest", |
| 461 | size = "small", |
| 462 | srcs = [ |
| 463 | "src/tests/thread_dealloc_unittest.cc", |
| 464 | ], |
| 465 | copts = common_copts, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 466 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 467 | deps = [ |
| 468 | ":tcmalloc", |
| 469 | ":testutil", |
| 470 | ], |
| 471 | ) |
| 472 | |
| 473 | """ |
Brian Silverman | 660d609 | 2015-11-26 18:41:59 -0500 | [diff] [blame] | 474 | We don't build this because it actually needs to be in a separate binary. |
| 475 | cc_test( |
| 476 | name = 'debugallocation_test', |
| 477 | srcs = [ |
| 478 | 'src/tests/debugallocation_test.cc', |
| 479 | ], |
| 480 | deps = [ |
| 481 | ':tcmalloc', |
| 482 | ], |
| 483 | copts = common_copts, |
| 484 | size = 'small', |
| 485 | ) |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 486 | """ |
Brian Silverman | 660d609 | 2015-11-26 18:41:59 -0500 | [diff] [blame] | 487 | |
| 488 | cc_test( |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 489 | name = "tcmalloc_large_heap_fragmentation_unittest", |
| 490 | size = "small", |
| 491 | srcs = empty_main_if_asan([ |
| 492 | "src/tests/large_heap_fragmentation_unittest.cc", |
| 493 | ]), |
| 494 | copts = common_copts, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 495 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 496 | deps = [ |
| 497 | ":tcmalloc", |
| 498 | ], |
Brian Silverman | 660d609 | 2015-11-26 18:41:59 -0500 | [diff] [blame] | 499 | ) |
| 500 | |
| 501 | cc_test( |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 502 | name = "raw_printer_test", |
| 503 | size = "small", |
| 504 | srcs = [ |
| 505 | "src/tests/raw_printer_test.cc", |
| 506 | ], |
| 507 | copts = common_copts, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 508 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 509 | deps = [ |
| 510 | ":tcmalloc", |
| 511 | ], |
Brian Silverman | 660d609 | 2015-11-26 18:41:59 -0500 | [diff] [blame] | 512 | ) |
| 513 | |
| 514 | cc_test( |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 515 | name = "getpc_test", |
| 516 | size = "small", |
| 517 | srcs = empty_main_if_asan([ |
| 518 | "src/tests/getpc_test.cc", |
| 519 | ]), |
| 520 | copts = common_copts, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 521 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 522 | deps = [ |
| 523 | ":tcmalloc", |
| 524 | ], |
Brian Silverman | 660d609 | 2015-11-26 18:41:59 -0500 | [diff] [blame] | 525 | ) |
| 526 | |
| 527 | cc_test( |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 528 | name = "profiledata_unittest", |
| 529 | size = "small", |
| 530 | srcs = [ |
| 531 | "src/tests/profiledata_unittest.cc", |
| 532 | ], |
| 533 | copts = common_copts, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 534 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 535 | deps = [ |
| 536 | ":tcmalloc", |
| 537 | ], |
Brian Silverman | 660d609 | 2015-11-26 18:41:59 -0500 | [diff] [blame] | 538 | ) |
| 539 | |
| 540 | cc_test( |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 541 | name = "profile_handler_unittest", |
| 542 | size = "small", |
| 543 | srcs = [ |
| 544 | "src/tests/profile-handler_unittest.cc", |
| 545 | ], |
| 546 | copts = common_copts, |
| 547 | flaky = True, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 548 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 549 | deps = [ |
| 550 | ":tcmalloc", |
| 551 | ], |
Brian Silverman | 660d609 | 2015-11-26 18:41:59 -0500 | [diff] [blame] | 552 | ) |
| 553 | |
| 554 | cc_test( |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 555 | name = "heap_profiler_unittest", |
| 556 | size = "small", |
| 557 | srcs = [ |
| 558 | "src/tests/heap-profiler_unittest.cc", |
| 559 | ], |
| 560 | copts = common_copts, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 561 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 562 | deps = [ |
| 563 | ":tcmalloc", |
| 564 | ], |
Brian Silverman | 660d609 | 2015-11-26 18:41:59 -0500 | [diff] [blame] | 565 | ) |
| 566 | |
| 567 | cc_test( |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 568 | name = "sampler_test", |
| 569 | size = "small", |
| 570 | srcs = [ |
| 571 | "src/tests/sampler_test.cc", |
| 572 | ], |
| 573 | copts = common_copts + [ |
| 574 | "-Wno-type-limits", |
| 575 | ], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 576 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 577 | deps = [ |
| 578 | ":tcmalloc", |
| 579 | ], |
Brian Silverman | 660d609 | 2015-11-26 18:41:59 -0500 | [diff] [blame] | 580 | ) |