diff --git a/tests/ns/meson.build b/tests/ns/meson.build index ca0270ca37..7d4e2e30fa 100644 --- a/tests/ns/meson.build +++ b/tests/ns/meson.build @@ -14,12 +14,6 @@ foreach unit : [ 'plugin', 'query', ] - linkargs = '' - if unit == 'plugin' - linkargs = [ - '-Wl,--wrap=isc_file_exists', - ] - endif test_bin = executable( unit, files(f'@unit@_test.c', 'netmgr_wrap.c'), @@ -37,7 +31,6 @@ foreach unit : [ cmocka_dep, nghttp2_dep, ], - link_args: linkargs, ) test( diff --git a/tests/ns/plugin_test.c b/tests/ns/plugin_test.c index 1de3e7c989..3a23d43476 100644 --- a/tests/ns/plugin_test.c +++ b/tests/ns/plugin_test.c @@ -34,17 +34,18 @@ #include -#include "../ns/hooks.c" - -bool -__wrap_isc_file_exists(const char *pathname); - -bool -__wrap_isc_file_exists(const char *pathname) { +/* + * Mocking isc_file_exists() as it's used inside the tested + * ns_plugin_expandpath() function defined in lib/ns/hooks.c + */ +static bool +isc_file_exists(const char *pathname) { UNUSED(pathname); return mock(); } +#include "../ns/hooks.c" + #include /*% @@ -75,7 +76,7 @@ run_full_path_test(const ns_plugin_expandpath_test_params_t *test, REQUIRE(test->result != ISC_R_SUCCESS || test->output != NULL); if (test->result == ISC_R_SUCCESS) { - will_return(__wrap_isc_file_exists, test->exists); + will_return(isc_file_exists, test->exists); } /*