diff options
| author | Jason Evans <jasone@canonware.com> | 2016-05-12 21:51:07 (GMT) |
|---|---|---|
| committer | Jason Evans <jasone@canonware.com> | 2016-05-12 21:53:25 (GMT) |
| commit | f70a254d44c8d30af2cd5d30531fb18fdabaae6d (patch) | |
| tree | 4e226a1bd0d56d742ca0950f69829ed7f0216e62 /test/src/test.c | |
| parent | e02b83cc5e3c4d30f93dba945162e3aa58d962d6 (diff) | |
| parent | 09f8585ce8a57baa387cc0327e51c0baffbdce6f (diff) | |
| download | jemalloc-4.2.0.zip jemalloc-4.2.0.tar.gz jemalloc-4.2.0.tar.bz2 | |
Merge branch 'dev'4.2.0
Diffstat (limited to 'test/src/test.c')
| -rw-r--r-- | test/src/test.c | 56 |
1 files changed, 41 insertions, 15 deletions
diff --git a/test/src/test.c b/test/src/test.c index 8173614..d70cc75 100644 --- a/test/src/test.c +++ b/test/src/test.c @@ -60,32 +60,30 @@ p_test_fini(void) malloc_printf("%s: %s\n", test_name, test_status_string(test_status)); } -test_status_t -p_test(test_t *t, ...) +static test_status_t +p_test_impl(bool do_malloc_init, test_t *t, va_list ap) { test_status_t ret; - va_list ap; - /* - * Make sure initialization occurs prior to running tests. Tests are - * special because they may use internal facilities prior to triggering - * initialization as a side effect of calling into the public API. This - * is a final safety that works even if jemalloc_constructor() doesn't - * run, as for MSVC builds. - */ - if (nallocx(1, 0) == 0) { - malloc_printf("Initialization error"); - return (test_status_fail); + if (do_malloc_init) { + /* + * Make sure initialization occurs prior to running tests. + * Tests are special because they may use internal facilities + * prior to triggering initialization as a side effect of + * calling into the public API. + */ + if (nallocx(1, 0) == 0) { + malloc_printf("Initialization error"); + return (test_status_fail); + } } ret = test_status_pass; - va_start(ap, t); for (; t != NULL; t = va_arg(ap, test_t *)) { t(); if (test_status > ret) ret = test_status; } - va_end(ap); malloc_printf("--- %s: %u/%u, %s: %u/%u, %s: %u/%u ---\n", test_status_string(test_status_pass), @@ -98,6 +96,34 @@ p_test(test_t *t, ...) return (ret); } +test_status_t +p_test(test_t *t, ...) +{ + test_status_t ret; + va_list ap; + + ret = test_status_pass; + va_start(ap, t); + ret = p_test_impl(true, t, ap); + va_end(ap); + + return (ret); +} + +test_status_t +p_test_no_malloc_init(test_t *t, ...) +{ + test_status_t ret; + va_list ap; + + ret = test_status_pass; + va_start(ap, t); + ret = p_test_impl(false, t, ap); + va_end(ap); + + return (ret); +} + void p_test_fail(const char *prefix, const char *message) { |
