xref: /netbsd-src/external/bsd/jemalloc/dist/test/unit/malloc_conf_2.c (revision 7bdf38e5b7a28439665f2fdeff81e36913eef7dd)
1*7bdf38e5Schristos #include "test/jemalloc_test.h"
2*7bdf38e5Schristos 
3*7bdf38e5Schristos const char *malloc_conf = "dirty_decay_ms:1000";
4*7bdf38e5Schristos const char *malloc_conf_2_conf_harder = "dirty_decay_ms:1234";
5*7bdf38e5Schristos 
6*7bdf38e5Schristos TEST_BEGIN(test_malloc_conf_2) {
7*7bdf38e5Schristos #ifdef _WIN32
8*7bdf38e5Schristos 	bool windows = true;
9*7bdf38e5Schristos #else
10*7bdf38e5Schristos 	bool windows = false;
11*7bdf38e5Schristos #endif
12*7bdf38e5Schristos 	/* Windows doesn't support weak symbol linker trickery. */
13*7bdf38e5Schristos 	test_skip_if(windows);
14*7bdf38e5Schristos 
15*7bdf38e5Schristos 	ssize_t dirty_decay_ms;
16*7bdf38e5Schristos 	size_t sz = sizeof(dirty_decay_ms);
17*7bdf38e5Schristos 
18*7bdf38e5Schristos 	int err = mallctl("opt.dirty_decay_ms", &dirty_decay_ms, &sz, NULL, 0);
19*7bdf38e5Schristos 	assert_d_eq(err, 0, "Unexpected mallctl failure");
20*7bdf38e5Schristos 	expect_zd_eq(dirty_decay_ms, 1234,
21*7bdf38e5Schristos 	    "malloc_conf_2 setting didn't take effect");
22*7bdf38e5Schristos }
23*7bdf38e5Schristos TEST_END
24*7bdf38e5Schristos 
25*7bdf38e5Schristos int
26*7bdf38e5Schristos main(void) {
27*7bdf38e5Schristos 	return test(
28*7bdf38e5Schristos 	    test_malloc_conf_2);
29*7bdf38e5Schristos }
30