Deduplicate prof hook ctl handlers

This commit is contained in:
Slobodan Predolac 2026-05-21 17:15:14 -07:00
parent 366a2cd9c0
commit bbe86b591f
2 changed files with 54 additions and 93 deletions

View file

@ -334,9 +334,23 @@ TEST_BEGIN(test_prof_sample_hooks) {
}
TEST_END
TEST_BEGIN(test_prof_hook_noop) {
test_skip_if(!config_prof);
const char *hooks[] = {"experimental.hooks.prof_backtrace",
"experimental.hooks.prof_dump", "experimental.hooks.prof_sample",
"experimental.hooks.prof_sample_free"};
for (unsigned i = 0; i < sizeof(hooks) / sizeof(hooks[0]); i++) {
expect_d_eq(mallctl(hooks[i], NULL, NULL, NULL, 0), EINVAL,
"Unexpected noop hook mallctl result");
}
}
TEST_END
int
main(void) {
return test(test_prof_backtrace_hook_replace,
test_prof_backtrace_hook_augment, test_prof_dump_hook,
test_prof_sample_hooks);
test_prof_sample_hooks, test_prof_hook_noop);
}