diff options
author | antirez <antirez@gmail.com> | 2015-10-06 16:18:30 +0200 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2015-10-06 16:55:37 +0200 |
commit | a9951b1b6a326532163e0fe4ee1a26e972258a1e (patch) | |
tree | ca555f37238537175cc1b34aa62a9f873026047f /deps/jemalloc/test/src/test.c | |
parent | e3ded0273c43986a49ddd9d5fb4a20d187d015de (diff) | |
download | redis-a9951b1b6a326532163e0fe4ee1a26e972258a1e.tar.gz |
Jemalloc updated to 4.0.3.
Diffstat (limited to 'deps/jemalloc/test/src/test.c')
-rw-r--r-- | deps/jemalloc/test/src/test.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/deps/jemalloc/test/src/test.c b/deps/jemalloc/test/src/test.c index 528d85831..8173614cf 100644 --- a/deps/jemalloc/test/src/test.c +++ b/deps/jemalloc/test/src/test.c @@ -5,7 +5,7 @@ static test_status_t test_counts[test_status_count] = {0, 0, 0}; static test_status_t test_status = test_status_pass; static const char * test_name = ""; -JEMALLOC_ATTR(format(printf, 1, 2)) +JEMALLOC_FORMAT_PRINTF(1, 2) void test_skip(const char *format, ...) { @@ -18,7 +18,7 @@ test_skip(const char *format, ...) test_status = test_status_skip; } -JEMALLOC_ATTR(format(printf, 1, 2)) +JEMALLOC_FORMAT_PRINTF(1, 2) void test_fail(const char *format, ...) { @@ -61,13 +61,26 @@ p_test_fini(void) } test_status_t -p_test(test_t* t, ...) +p_test(test_t *t, ...) { - test_status_t ret = test_status_pass; + 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); + } + + ret = test_status_pass; va_start(ap, t); - for (; t != NULL; t = va_arg(ap, test_t*)) { + for (; t != NULL; t = va_arg(ap, test_t *)) { t(); if (test_status > ret) ret = test_status; |