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

Function p_test_impl

deps/jemalloc/test/src/test.c:127–185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125}
126
127static test_status_t
128p_test_impl(bool do_malloc_init, bool do_reentrant, test_t *t, va_list ap) {
129 test_status_t ret;
130
131 if (do_malloc_init) {
132 /*
133 * Make sure initialization occurs prior to running tests.
134 * Tests are special because they may use internal facilities
135 * prior to triggering initialization as a side effect of
136 * calling into the public API.
137 */
138 if (nallocx(1, 0) == 0) {
139 malloc_printf("Initialization error");
140 return test_status_fail;
141 }
142 }
143
144 ret = test_status_pass;
145 for (; t != NULL; t = va_arg(ap, test_t *)) {
146 /* Non-reentrant run. */
147 reentrancy = non_reentrant;
148 test_hooks_arena_new_hook = test_hooks_libc_hook = NULL;
149 t();
150 if (test_status > ret) {
151 ret = test_status;
152 }
153 check_global_slow(&ret);
154 /* Reentrant run. */
155 if (do_reentrant) {
156 reentrancy = libc_reentrant;
157 test_hooks_arena_new_hook = NULL;
158 test_hooks_libc_hook = &libc_reentrancy_hook;
159 t();
160 if (test_status > ret) {
161 ret = test_status;
162 }
163 check_global_slow(&ret);
164
165 reentrancy = arena_new_reentrant;
166 test_hooks_libc_hook = NULL;
167 test_hooks_arena_new_hook = &arena_new_reentrancy_hook;
168 t();
169 if (test_status > ret) {
170 ret = test_status;
171 }
172 check_global_slow(&ret);
173 }
174 }
175
176 malloc_printf("--- %s: %u/%u, %s: %u/%u, %s: %u/%u ---\n",
177 test_status_string(test_status_pass),
178 test_counts[test_status_pass], test_count,
179 test_status_string(test_status_skip),
180 test_counts[test_status_skip], test_count,
181 test_status_string(test_status_fail),
182 test_counts[test_status_fail], test_count);
183
184 return ret;

Callers 3

p_testFunction · 0.70
p_test_no_reentrancyFunction · 0.70
p_test_no_malloc_initFunction · 0.70

Calls 3

check_global_slowFunction · 0.85
test_status_stringFunction · 0.70
malloc_printfFunction · 0.50

Tested by

no test coverage detected