Rename hooks module to test_hooks.
"Hooks" is really the best name for the module that will contain the publicly exposed hooks. So lets rename the current "hooks" module (that hook external dependencies, for reentrancy testing) to "test_hooks".
This commit is contained in:
committed by
David Goldblatt
parent
e870829e64
commit
c7a87e0e0b
@@ -69,7 +69,7 @@ static const bool config_debug =
|
||||
|
||||
# define JEMALLOC_N(n) @private_namespace@##n
|
||||
# include "jemalloc/internal/private_namespace.h"
|
||||
# include "jemalloc/internal/hooks.h"
|
||||
# include "jemalloc/internal/test_hooks.h"
|
||||
|
||||
/* Hermetic headers. */
|
||||
# include "jemalloc/internal/assert.h"
|
||||
|
@@ -48,12 +48,12 @@ do_hook(bool *hook_ran, void (**hook)()) {
|
||||
|
||||
static void
|
||||
libc_reentrancy_hook() {
|
||||
do_hook(&libc_hook_ran, &hooks_libc_hook);
|
||||
do_hook(&libc_hook_ran, &test_hooks_libc_hook);
|
||||
}
|
||||
|
||||
static void
|
||||
arena_new_reentrancy_hook() {
|
||||
do_hook(&arena_new_hook_ran, &hooks_arena_new_hook);
|
||||
do_hook(&arena_new_hook_ran, &test_hooks_arena_new_hook);
|
||||
}
|
||||
|
||||
/* Actual test infrastructure. */
|
||||
@@ -131,7 +131,7 @@ p_test_impl(bool do_malloc_init, bool do_reentrant, test_t *t, va_list ap) {
|
||||
for (; t != NULL; t = va_arg(ap, test_t *)) {
|
||||
/* Non-reentrant run. */
|
||||
reentrancy = non_reentrant;
|
||||
hooks_arena_new_hook = hooks_libc_hook = NULL;
|
||||
test_hooks_arena_new_hook = test_hooks_libc_hook = NULL;
|
||||
t();
|
||||
if (test_status > ret) {
|
||||
ret = test_status;
|
||||
@@ -139,16 +139,16 @@ p_test_impl(bool do_malloc_init, bool do_reentrant, test_t *t, va_list ap) {
|
||||
/* Reentrant run. */
|
||||
if (do_reentrant) {
|
||||
reentrancy = libc_reentrant;
|
||||
hooks_arena_new_hook = NULL;
|
||||
hooks_libc_hook = &libc_reentrancy_hook;
|
||||
test_hooks_arena_new_hook = NULL;
|
||||
test_hooks_libc_hook = &libc_reentrancy_hook;
|
||||
t();
|
||||
if (test_status > ret) {
|
||||
ret = test_status;
|
||||
}
|
||||
|
||||
reentrancy = arena_new_reentrant;
|
||||
hooks_libc_hook = NULL;
|
||||
hooks_arena_new_hook = &arena_new_reentrancy_hook;
|
||||
test_hooks_libc_hook = NULL;
|
||||
test_hooks_arena_new_hook = &arena_new_reentrancy_hook;
|
||||
t();
|
||||
if (test_status > ret) {
|
||||
ret = test_status;
|
||||
|
@@ -12,10 +12,10 @@ func_to_hook(int arg1, int arg2) {
|
||||
return arg1 + arg2;
|
||||
}
|
||||
|
||||
#define func_to_hook JEMALLOC_HOOK(func_to_hook, hooks_libc_hook)
|
||||
#define func_to_hook JEMALLOC_HOOK(func_to_hook, test_hooks_libc_hook)
|
||||
|
||||
TEST_BEGIN(unhooked_call) {
|
||||
hooks_libc_hook = NULL;
|
||||
test_hooks_libc_hook = NULL;
|
||||
hook_called = false;
|
||||
assert_d_eq(3, func_to_hook(1, 2), "Hooking changed return value.");
|
||||
assert_false(hook_called, "Nulling out hook didn't take.");
|
||||
@@ -23,7 +23,7 @@ TEST_BEGIN(unhooked_call) {
|
||||
TEST_END
|
||||
|
||||
TEST_BEGIN(hooked_call) {
|
||||
hooks_libc_hook = &hook;
|
||||
test_hooks_libc_hook = &hook;
|
||||
hook_called = false;
|
||||
assert_d_eq(3, func_to_hook(1, 2), "Hooking changed return value.");
|
||||
assert_true(hook_called, "Hook should have executed.");
|
Reference in New Issue
Block a user