1 #include "test/jemalloc_test.h" 2 3 const char *malloc_conf = "dirty_decay_ms:1234,confirm_conf:true"; 4 5 TEST_BEGIN(test_confirm_conf_two_pass) { 6 #ifdef _WIN32 7 test_skip("not supported on win32"); 8 #endif 9 10 bool confirm_conf; 11 size_t sz = sizeof(confirm_conf); 12 13 int err = mallctl("opt.confirm_conf", &confirm_conf, &sz, NULL, 0); 14 assert_d_eq(err, 0, "Unexpected mallctl failure"); 15 expect_true(confirm_conf, 16 "confirm_conf should be true (processed in pass 1)"); 17 } 18 TEST_END 19 20 TEST_BEGIN(test_conf_option_applied_in_second_pass) { 21 #ifdef _WIN32 22 test_skip("not supported on win32"); 23 #endif 24 25 ssize_t dirty_decay_ms; 26 size_t sz = sizeof(dirty_decay_ms); 27 28 int err = mallctl("opt.dirty_decay_ms", &dirty_decay_ms, &sz, NULL, 0); 29 assert_d_eq(err, 0, "Unexpected mallctl failure"); 30 expect_zd_eq(dirty_decay_ms, 1234, 31 "dirty_decay_ms should be 1234 (processed in pass 2)"); 32 } 33 TEST_END 34 35 int 36 main(void) { 37 return test(test_confirm_conf_two_pass, 38 test_conf_option_applied_in_second_pass); 39 } 40