Fix: prof_recent_alloc_max_ctl_read() does not take tsd
This commit is contained in:
parent
730658f72f
commit
b8bdea6b26
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
/* Invariant before and after every test (when config_prof is on) */
|
/* Invariant before and after every test (when config_prof is on) */
|
||||||
static void
|
static void
|
||||||
confirm_prof_setup(tsd_t *tsd) {
|
confirm_prof_setup() {
|
||||||
/* Options */
|
/* Options */
|
||||||
assert_true(opt_prof, "opt_prof not on");
|
assert_true(opt_prof, "opt_prof not on");
|
||||||
assert_true(opt_prof_active, "opt_prof_active not on");
|
assert_true(opt_prof_active, "opt_prof_active not on");
|
||||||
@ -16,13 +16,13 @@ confirm_prof_setup(tsd_t *tsd) {
|
|||||||
|
|
||||||
/* Dynamics */
|
/* Dynamics */
|
||||||
assert_true(prof_active, "prof_active not on");
|
assert_true(prof_active, "prof_active not on");
|
||||||
assert_zd_eq(prof_recent_alloc_max_ctl_read(tsd), OPT_ALLOC_MAX,
|
assert_zd_eq(prof_recent_alloc_max_ctl_read(), OPT_ALLOC_MAX,
|
||||||
"prof_recent_alloc_max not set correctly");
|
"prof_recent_alloc_max not set correctly");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_BEGIN(test_confirm_setup) {
|
TEST_BEGIN(test_confirm_setup) {
|
||||||
test_skip_if(!config_prof);
|
test_skip_if(!config_prof);
|
||||||
confirm_prof_setup(tsd_fetch());
|
confirm_prof_setup();
|
||||||
}
|
}
|
||||||
TEST_END
|
TEST_END
|
||||||
|
|
||||||
@ -58,13 +58,11 @@ TEST_BEGIN(test_prof_recent_on) {
|
|||||||
ssize_t past, future;
|
ssize_t past, future;
|
||||||
size_t len = sizeof(ssize_t);
|
size_t len = sizeof(ssize_t);
|
||||||
|
|
||||||
tsd_t *tsd = tsd_fetch();
|
confirm_prof_setup();
|
||||||
|
|
||||||
confirm_prof_setup(tsd);
|
|
||||||
|
|
||||||
assert_d_eq(mallctl("experimental.prof_recent.alloc_max",
|
assert_d_eq(mallctl("experimental.prof_recent.alloc_max",
|
||||||
NULL, NULL, NULL, 0), 0, "no-op mallctl should be allowed");
|
NULL, NULL, NULL, 0), 0, "no-op mallctl should be allowed");
|
||||||
confirm_prof_setup(tsd);
|
confirm_prof_setup();
|
||||||
|
|
||||||
assert_d_eq(mallctl("experimental.prof_recent.alloc_max",
|
assert_d_eq(mallctl("experimental.prof_recent.alloc_max",
|
||||||
&past, &len, NULL, 0), 0, "Read error");
|
&past, &len, NULL, 0), 0, "Read error");
|
||||||
@ -93,7 +91,7 @@ TEST_BEGIN(test_prof_recent_on) {
|
|||||||
expect_zd_eq(past, -1,
|
expect_zd_eq(past, -1,
|
||||||
"Output should not be touched given invalid write");
|
"Output should not be touched given invalid write");
|
||||||
|
|
||||||
confirm_prof_setup(tsd);
|
confirm_prof_setup();
|
||||||
}
|
}
|
||||||
TEST_END
|
TEST_END
|
||||||
|
|
||||||
@ -151,9 +149,7 @@ TEST_BEGIN(test_prof_recent_alloc) {
|
|||||||
prof_recent_t *n;
|
prof_recent_t *n;
|
||||||
ssize_t future;
|
ssize_t future;
|
||||||
|
|
||||||
tsd_t *tsd = tsd_fetch();
|
confirm_prof_setup();
|
||||||
|
|
||||||
confirm_prof_setup(tsd);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* First batch of 2 * OPT_ALLOC_MAX allocations. After the
|
* First batch of 2 * OPT_ALLOC_MAX allocations. After the
|
||||||
@ -190,7 +186,7 @@ TEST_BEGIN(test_prof_recent_alloc) {
|
|||||||
free(p);
|
free(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
confirm_prof_setup(tsd);
|
confirm_prof_setup();
|
||||||
|
|
||||||
b = false;
|
b = false;
|
||||||
assert_d_eq(mallctl("prof.active", NULL, NULL, &b, sizeof(bool)), 0,
|
assert_d_eq(mallctl("prof.active", NULL, NULL, &b, sizeof(bool)), 0,
|
||||||
@ -219,7 +215,7 @@ TEST_BEGIN(test_prof_recent_alloc) {
|
|||||||
assert_d_eq(mallctl("prof.active", NULL, NULL, &b, sizeof(bool)), 0,
|
assert_d_eq(mallctl("prof.active", NULL, NULL, &b, sizeof(bool)), 0,
|
||||||
"mallctl for turning on prof_active failed");
|
"mallctl for turning on prof_active failed");
|
||||||
|
|
||||||
confirm_prof_setup(tsd);
|
confirm_prof_setup();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Third batch of OPT_ALLOC_MAX allocations. Since prof_active is
|
* Third batch of OPT_ALLOC_MAX allocations. Since prof_active is
|
||||||
@ -338,7 +334,7 @@ TEST_BEGIN(test_prof_recent_alloc) {
|
|||||||
assert_true(ql_empty(&prof_recent_alloc_list),
|
assert_true(ql_empty(&prof_recent_alloc_list),
|
||||||
"Recent list should be empty");
|
"Recent list should be empty");
|
||||||
|
|
||||||
confirm_prof_setup(tsd);
|
confirm_prof_setup();
|
||||||
}
|
}
|
||||||
TEST_END
|
TEST_END
|
||||||
|
|
||||||
@ -485,8 +481,7 @@ confirm_record(const char *template,
|
|||||||
TEST_BEGIN(test_prof_recent_alloc_dump) {
|
TEST_BEGIN(test_prof_recent_alloc_dump) {
|
||||||
test_skip_if(!config_prof);
|
test_skip_if(!config_prof);
|
||||||
|
|
||||||
tsd_t *tsd = tsd_fetch();
|
confirm_prof_setup();
|
||||||
confirm_prof_setup(tsd);
|
|
||||||
|
|
||||||
ssize_t future;
|
ssize_t future;
|
||||||
void *p, *q;
|
void *p, *q;
|
||||||
@ -531,7 +526,7 @@ TEST_BEGIN(test_prof_recent_alloc_dump) {
|
|||||||
future = OPT_ALLOC_MAX;
|
future = OPT_ALLOC_MAX;
|
||||||
assert_d_eq(mallctl("experimental.prof_recent.alloc_max",
|
assert_d_eq(mallctl("experimental.prof_recent.alloc_max",
|
||||||
NULL, NULL, &future, sizeof(ssize_t)), 0, "Write error");
|
NULL, NULL, &future, sizeof(ssize_t)), 0, "Write error");
|
||||||
confirm_prof_setup(tsd);
|
confirm_prof_setup();
|
||||||
}
|
}
|
||||||
TEST_END
|
TEST_END
|
||||||
|
|
||||||
@ -588,7 +583,7 @@ f_thread(void *arg) {
|
|||||||
} else if (rand % 5 == 0) {
|
} else if (rand % 5 == 0) {
|
||||||
prof_recent_alloc_dump(tsd, test_write_cb, NULL);
|
prof_recent_alloc_dump(tsd, test_write_cb, NULL);
|
||||||
} else if (rand % 5 == 1) {
|
} else if (rand % 5 == 1) {
|
||||||
last_max = prof_recent_alloc_max_ctl_read(tsd);
|
last_max = prof_recent_alloc_max_ctl_read();
|
||||||
} else if (rand % 5 == 2) {
|
} else if (rand % 5 == 2) {
|
||||||
last_max =
|
last_max =
|
||||||
prof_recent_alloc_max_ctl_write(tsd, test_max * 2);
|
prof_recent_alloc_max_ctl_write(tsd, test_max * 2);
|
||||||
@ -613,8 +608,7 @@ f_thread(void *arg) {
|
|||||||
TEST_BEGIN(test_prof_recent_stress) {
|
TEST_BEGIN(test_prof_recent_stress) {
|
||||||
test_skip_if(!config_prof);
|
test_skip_if(!config_prof);
|
||||||
|
|
||||||
tsd_t *tsd = tsd_fetch();
|
confirm_prof_setup();
|
||||||
confirm_prof_setup(tsd);
|
|
||||||
|
|
||||||
test_max = OPT_ALLOC_MAX;
|
test_max = OPT_ALLOC_MAX;
|
||||||
for (size_t i = 0; i < N_THREADS; i++) {
|
for (size_t i = 0; i < N_THREADS; i++) {
|
||||||
@ -643,7 +637,7 @@ TEST_BEGIN(test_prof_recent_stress) {
|
|||||||
test_max = OPT_ALLOC_MAX;
|
test_max = OPT_ALLOC_MAX;
|
||||||
assert_d_eq(mallctl("experimental.prof_recent.alloc_max",
|
assert_d_eq(mallctl("experimental.prof_recent.alloc_max",
|
||||||
NULL, NULL, &test_max, sizeof(ssize_t)), 0, "Write error");
|
NULL, NULL, &test_max, sizeof(ssize_t)), 0, "Write error");
|
||||||
confirm_prof_setup(tsd);
|
confirm_prof_setup();
|
||||||
}
|
}
|
||||||
TEST_END
|
TEST_END
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user