mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-06-20 02:45:50 +03:00
249 lines
6.6 KiB
Text
249 lines
6.6 KiB
Text
load("@rules_cc//cc:defs.bzl", "cc_test")
|
|
load("//tools:cc.bzl", "COPTS")
|
|
load("//tools:transition.bzl", "PLATFORM", "transition_default_constraints")
|
|
|
|
exports_files(
|
|
[
|
|
"arena_reset.c",
|
|
"batch_alloc.c",
|
|
],
|
|
visibility = ["//:__subpackages__"],
|
|
)
|
|
|
|
UNIT_TESTS = [
|
|
{"src": "a0.c"},
|
|
{
|
|
"src": "arena_decay.c",
|
|
"conf": "dirty_decay_ms:1000,muzzy_decay_ms:1000,tcache_max:1024",
|
|
},
|
|
{
|
|
"src": "arena_reset_prof.c",
|
|
"conf": "prof:true,lg_prof_sample:0",
|
|
},
|
|
{"src": "arena_reset.c"},
|
|
{"src": "atomic.c"},
|
|
{"src": "background_thread.c"},
|
|
{"src": "background_thread_enable.c"},
|
|
{"src": "base.c"},
|
|
{
|
|
"src": "batch_alloc_prof.c",
|
|
"conf": "prof:true,lg_prof_sample:14",
|
|
},
|
|
{
|
|
"src": "batch_alloc.c",
|
|
"conf": "tcache_gc_incr_bytes:2147483648",
|
|
},
|
|
{
|
|
"src": "binshard.c",
|
|
"conf": "narenas:1,bin_shards:1-160:16|129-512:4|256-256:8",
|
|
},
|
|
{"src": "bitmap.c"},
|
|
{"src": "bit_util.c"},
|
|
{"src": "buf_writer.c"},
|
|
{"src": "cache_bin.c"},
|
|
{"src": "ckh.c"},
|
|
{"src": "counter.c"},
|
|
{"src": "decay.c"},
|
|
{"src": "div.c"},
|
|
{"src": "double_free.c"},
|
|
{"src": "edata_cache.c"},
|
|
{"src": "emitter.c"},
|
|
{"src": "extent_quantize.c"},
|
|
{"src": "fb.c"},
|
|
{"src": "fork.c"},
|
|
{"src": "fxp.c"},
|
|
{
|
|
"src": "san.c",
|
|
"conf": "san_guard_large:1,san_guard_small:1",
|
|
},
|
|
{"src": "san_bump.c"},
|
|
{"src": "hash.c"},
|
|
{"src": "hook.c"},
|
|
{"src": "hpa.c"},
|
|
{
|
|
"src": "hpa_background_thread.c",
|
|
"conf": "hpa_dirty_mult:0,hpa_min_purge_interval_ms:50,hpa_sec_nshards:0",
|
|
},
|
|
{"src": "hpdata.c"},
|
|
{"src": "huge.c"},
|
|
{
|
|
"src": "inspect.c",
|
|
"prof_conf": "prof:false",
|
|
},
|
|
{
|
|
"src": "junk.c",
|
|
"conf": "abort:false,zero:false,junk:true",
|
|
},
|
|
{
|
|
"name": "unit_junk_alloc",
|
|
"src": "junk.c",
|
|
"conf": "abort:false,zero:false,junk:alloc",
|
|
},
|
|
{
|
|
"name": "unit_junk_free",
|
|
"src": "junk.c",
|
|
"conf": "abort:false,zero:false,junk:free",
|
|
},
|
|
{"src": "log.c"},
|
|
{"src": "mallctl.c"},
|
|
{
|
|
"src": "malloc_conf_2.c",
|
|
"conf": "dirty_decay_ms:500",
|
|
},
|
|
{"src": "malloc_io.c"},
|
|
{"src": "math.c"},
|
|
{"src": "mpsc_queue.c"},
|
|
{"src": "mq.c"},
|
|
{"src": "mtx.c"},
|
|
{"src": "nstime.c"},
|
|
{"src": "oversize_threshold.c"},
|
|
{"src": "pa.c"},
|
|
{
|
|
"src": "pack.c",
|
|
"conf": "dirty_decay_ms:0,muzzy_decay_ms:0",
|
|
},
|
|
{"src": "pages.c"},
|
|
{"src": "peak.c"},
|
|
{"src": "ph.c"},
|
|
{"src": "prng.c"},
|
|
{
|
|
"src": "prof_accum.c",
|
|
"prof_conf": "prof:true,prof_accum:true,prof_active:false,lg_prof_sample:0",
|
|
},
|
|
{
|
|
"src": "prof_active.c",
|
|
"prof_conf": "prof:true,prof_active:true,prof_thread_active_init:false,lg_prof_sample:0",
|
|
},
|
|
{
|
|
"src": "prof_gdump.c",
|
|
"prof_conf": "prof:true,prof_active:false,prof_gdump:true",
|
|
},
|
|
{
|
|
"src": "prof_hook.c",
|
|
"prof_conf": "prof:true,prof_active:true,lg_prof_sample:0",
|
|
},
|
|
{
|
|
"src": "prof_idump.c",
|
|
"conf": "tcache:false",
|
|
"prof_conf": ",prof:true,prof_accum:true,prof_active:false,lg_prof_sample:0,lg_prof_interval:0",
|
|
},
|
|
{
|
|
"src": "prof_log.c",
|
|
"prof_conf": "prof:true,prof_active:true,lg_prof_sample:0",
|
|
},
|
|
{
|
|
"src": "prof_mdump.c",
|
|
"prof_conf": "prof:true,lg_prof_sample:0",
|
|
},
|
|
{
|
|
"src": "prof_recent.c",
|
|
"prof_conf": "prof:true,prof_active:true,lg_prof_sample:0,prof_recent_alloc_max:3",
|
|
},
|
|
{
|
|
"src": "prof_reset.c",
|
|
"prof_conf": "prof:true,prof_active:false,lg_prof_sample:0,prof_recent_alloc_max:0",
|
|
},
|
|
{
|
|
"src": "prof_stats.c",
|
|
"prof_conf": "prof:true,prof_active:true,lg_prof_sample:0,prof_stats:true",
|
|
},
|
|
{
|
|
"src": "prof_tctx.c",
|
|
"prof_conf": "prof:true,prof_active:true,lg_prof_sample:0",
|
|
},
|
|
{
|
|
"src": "prof_thread_name.c",
|
|
"prof_conf": "prof:true,prof_active:false",
|
|
},
|
|
{
|
|
"src": "prof_sys_thread_name.c",
|
|
"prof_conf": "prof:true,prof_active:true,lg_prof_sample:0,prof_sys_thread_name:true",
|
|
},
|
|
{"src": "psset.c"},
|
|
{"src": "ql.c"},
|
|
{"src": "qr.c"},
|
|
{"src": "rb.c"},
|
|
{"src": "retained.c"},
|
|
{"src": "rtree.c"},
|
|
{"src": "safety_check.c"},
|
|
{"src": "sc.c"},
|
|
{"src": "sec.c"},
|
|
{"src": "seq.c"},
|
|
{"src": "SFMT.c"},
|
|
{
|
|
"src": "size_check.c",
|
|
"prof_conf": "prof:false",
|
|
},
|
|
{"src": "size_classes.c"},
|
|
{"src": "slab.c"},
|
|
{"src": "smoothstep.c"},
|
|
{"src": "spin.c"},
|
|
{"src": "stats.c"},
|
|
{"src": "stats_print.c"},
|
|
{"src": "sz.c"},
|
|
{
|
|
"src": "tcache_max.c",
|
|
"conf": "tcache_max:1024",
|
|
},
|
|
{"src": "test_hooks.c"},
|
|
{
|
|
"src": "thread_event.c",
|
|
"prof_conf": "prof:true,lg_prof_sample:0",
|
|
},
|
|
{"src": "ticker.c"},
|
|
{"src": "tsd.c"},
|
|
{"src": "uaf.c"},
|
|
{"src": "witness.c"},
|
|
{
|
|
"src": "zero.c",
|
|
"conf": "abort:false,junk:false,zero:true",
|
|
},
|
|
{
|
|
"src": "zero_realloc_abort.c",
|
|
"conf": "zero_realloc:abort",
|
|
},
|
|
{
|
|
"src": "zero_realloc_free.c",
|
|
"conf": "zero_realloc:free",
|
|
},
|
|
{
|
|
"src": "zero_realloc_alloc.c",
|
|
"conf": "zero_realloc:alloc",
|
|
},
|
|
{
|
|
"src": "zero_reallocs.c",
|
|
"conf": "zero_realloc:free",
|
|
},
|
|
]
|
|
|
|
transition_default_constraints(
|
|
name = "testlib",
|
|
testonly = True,
|
|
src = "//test:testlib",
|
|
platform = PLATFORM,
|
|
settings = {
|
|
"//settings:enable_jet": "True",
|
|
"//settings:with_test": "unit",
|
|
"//settings/flags:enable_fill": "True",
|
|
# This needs to be pinned for testing. The MALLOC_CONF ENV depends on it. The make build allows for it to be
|
|
# set dynamically via templating and generates a test harness around it. By requiring a value that cannot be
|
|
# set internally by accident, this exercises the same functionality.
|
|
"//settings/flags:jemalloc_prefix": "je_test_",
|
|
},
|
|
visibility = ["//:__subpackages__"],
|
|
)
|
|
|
|
[cc_test(
|
|
name = test["name"] if "name" in test else test["src"].removesuffix(".c").replace("/", "_"),
|
|
srcs = [test["src"]],
|
|
copts = COPTS,
|
|
env = select({
|
|
"//settings/flags:prof": {
|
|
"JE_TEST_MALLOC_CONF": test.get("conf", "") + test.get("prof_conf", ""),
|
|
},
|
|
"//conditions:default": {"JE_TEST_MALLOC_CONF": test.get("conf", "")},
|
|
}),
|
|
linkstatic = True,
|
|
local_defines = ["JEMALLOC_UNIT_TEST"],
|
|
deps = [":testlib"],
|
|
) for test in UNIT_TESTS]
|