Fix an interaction between the oversize_threshold test and bgthds.

Also added the shared utility to check if background_thread is enabled.
This commit is contained in:
Qi Wang
2021-05-12 16:00:38 -07:00
committed by Qi Wang
parent 5417938215
commit 08089589f7
6 changed files with 30 additions and 34 deletions

View File

@@ -2,18 +2,6 @@
#include "test/extent_hooks.h"
static bool
check_background_thread_enabled(void) {
bool enabled;
size_t sz = sizeof(bool);
int ret = mallctl("background_thread", (void *)&enabled, &sz, NULL,0);
if (ret == ENOENT) {
return false;
}
expect_d_eq(ret, 0, "Unexpected mallctl error");
return enabled;
}
static void
test_extent_body(unsigned arena_ind) {
void *p;
@@ -177,7 +165,7 @@ test_manual_hook_body(void) {
expect_ptr_ne(old_hooks->merge, extent_merge_hook,
"Unexpected extent_hooks error");
if (!check_background_thread_enabled()) {
if (!is_background_thread_enabled()) {
test_extent_body(arena_ind);
}
@@ -235,7 +223,7 @@ TEST_BEGIN(test_extent_auto_hook) {
expect_d_eq(mallctl("arenas.create", (void *)&arena_ind, &sz,
(void *)&new_hooks, new_size), 0, "Unexpected mallctl() failure");
test_skip_if(check_background_thread_enabled());
test_skip_if(is_background_thread_enabled());
test_extent_body(arena_ind);
}
TEST_END