diff --git a/meson.build b/meson.build index b70ec5d..be9c365 100644 --- a/meson.build +++ b/meson.build @@ -49,6 +49,7 @@ libglib_testing_dep = dependency( config_h = configuration_data() config_h.set_quoted('GETTEXT_PACKAGE', 'malcontent') config_h.set_quoted('PACKAGE_LOCALE_DIR', join_paths(get_option('prefix'), get_option('localedir'))) +config_h.set_quoted('PAMLIBDIR', pamlibdir) config_h.set_quoted('VERSION', meson.project_version()) configure_file( output: 'config.h', diff --git a/pam/tests/pam_malcontent.c b/pam/tests/pam_malcontent.c index 871516b..8aebb3d 100644 --- a/pam/tests/pam_malcontent.c +++ b/pam/tests/pam_malcontent.c @@ -24,6 +24,7 @@ #include #include #include +#include "config.h" /* Test that the `pam_malcontent.so` module can be loaded using dlopen() and * that it exports the appropriate symbols for PAM to be able to use it. */ @@ -37,6 +38,13 @@ test_pam_malcontent_dlopen (void) module_path = g_test_build_filename (G_TEST_BUILT, "..", "pam_malcontent.so", NULL); + /* Installed tests version. */ + if (!g_file_test (module_path, G_FILE_TEST_EXISTS)) + { + g_free (module_path); + module_path = g_build_filename (PAMLIBDIR, "pam_malcontent.so", NULL); + } + /* Check the module can be loaded. */ handle = dlopen (module_path, RTLD_NOW); g_assert_nonnull (handle);