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