mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-23 21:23:06 +00:00
Add unit tests for conf parsing and its helpers
This commit is contained in:
committed by
Guangli Dai
parent
ad726adf75
commit
86b7219213
@@ -1,6 +1,6 @@
|
||||
#include "test/jemalloc_test.h"
|
||||
|
||||
const char *malloc_conf = "dirty_decay_ms:1000";
|
||||
const char *malloc_conf = "dirty_decay_ms:1000,muzzy_decay_ms:2000";
|
||||
const char *malloc_conf_2_conf_harder = "dirty_decay_ms:1234";
|
||||
|
||||
TEST_BEGIN(test_malloc_conf_2) {
|
||||
@@ -49,7 +49,27 @@ TEST_BEGIN(test_mallctl_global_var) {
|
||||
}
|
||||
TEST_END
|
||||
|
||||
TEST_BEGIN(test_non_conflicting_var) {
|
||||
#ifdef _WIN32
|
||||
bool windows = true;
|
||||
#else
|
||||
bool windows = false;
|
||||
#endif
|
||||
/* Windows doesn't support weak symbol linker trickery. */
|
||||
test_skip_if(windows);
|
||||
|
||||
ssize_t muzzy_decay_ms;
|
||||
size_t sz = sizeof(muzzy_decay_ms);
|
||||
|
||||
int err = mallctl("opt.muzzy_decay_ms", &muzzy_decay_ms, &sz, NULL, 0);
|
||||
assert_d_eq(err, 0, "Unexpected mallctl failure");
|
||||
expect_zd_eq(muzzy_decay_ms, 2000,
|
||||
"Non-conflicting option from malloc_conf should pass through");
|
||||
}
|
||||
TEST_END
|
||||
|
||||
int
|
||||
main(void) {
|
||||
return test(test_malloc_conf_2, test_mallctl_global_var);
|
||||
return test(test_malloc_conf_2, test_mallctl_global_var,
|
||||
test_non_conflicting_var);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user