tests: Respect pamlibdir in installed tests

The build allows configuring pam module installation path but then it did
not respect it in installed tests.
This commit is contained in:
Jan Tojnar 2020-03-26 02:56:33 +01:00 committed by Philip Withnall
parent 0d60138e0a
commit 38c1170bda
2 changed files with 9 additions and 0 deletions

View file

@ -24,6 +24,7 @@
#include <glib.h>
#include <locale.h>
#include <stdlib.h>
#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);