MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / TEST_BEGIN

Function TEST_BEGIN

deps/jemalloc/test/unit/base.c:59–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57 base_delete(tsdn, base);
58}
59TEST_END
60
61TEST_BEGIN(test_base_hooks_null) {
62 extent_hooks_t hooks_orig;
63 base_t *base;
64 size_t allocated0, allocated1, resident, mapped, n_thp;
65
66 extent_hooks_prep();
67 try_dalloc = false;
68 try_destroy = true;
69 try_decommit = false;
70 try_purge_lazy = false;
71 try_purge_forced = false;
72 memcpy(&hooks_orig, &hooks, sizeof(extent_hooks_t));
73 memcpy(&hooks, &hooks_null, sizeof(extent_hooks_t));
74
75 tsdn_t *tsdn = tsd_tsdn(tsd_fetch());
76 base = base_new(tsdn, 0, &hooks);
77 assert_ptr_not_null(base, "Unexpected base_new() failure");
78
79 if (config_stats) {
80 base_stats_get(tsdn, base, &allocated0, &resident, &mapped,
81 &n_thp);
82 assert_zu_ge(allocated0, sizeof(base_t),
83 "Base header should count as allocated");
84 if (opt_metadata_thp == metadata_thp_always) {
85 assert_zu_gt(n_thp, 0,
86 "Base should have 1 THP at least.");
87 }
88 }
89
90 assert_ptr_not_null(base_alloc(tsdn, base, 42, 1),
91 "Unexpected base_alloc() failure");
92
93 if (config_stats) {
94 base_stats_get(tsdn, base, &allocated1, &resident, &mapped,
95 &n_thp);
96 assert_zu_ge(allocated1 - allocated0, 42,
97 "At least 42 bytes were allocated by base_alloc()");
98 }
99
100 base_delete(tsdn, base);
101
102 memcpy(&hooks, &hooks_orig, sizeof(extent_hooks_t));
103}
104TEST_END
105
106TEST_BEGIN(test_base_hooks_not_null) {

Callers

nothing calls this directly

Calls 9

extent_hooks_prepFunction · 0.50
tsd_tsdnFunction · 0.50
tsd_fetchFunction · 0.50
base_newFunction · 0.50
base_stats_getFunction · 0.50
base_allocFunction · 0.50
base_deleteFunction · 0.50
extent_bsize_getFunction · 0.50
extent_addr_getFunction · 0.50

Tested by

no test coverage detected