These tests check that the built `pam_malcontent.so` module can be loaded using `dlopen()` and that it exports the right symbol. This should mean that PAM can load it and use it. Unfortunately, we can’t actually run the module, since PAM hard-codes its configuration path as being in `/etc`, and there seems to be no way to override that to load a dummy configuration from a test directory. So the only way to test the PAM module is to use a file system bind mount to fake `/etc` (which requires privileges); or to actually install it on your system and integrate it into your real PAM configuration. Neither of those are acceptable for a unit test. It might be possible to re-execute a test under `bwrap` (if installed) to achieve this, bind mounting a dummy `/etc/pam.d/dummy` service file into the subprocess’ mount namespace, and otherwise bind mounting `/` to `/`. It would need a mock malcontent D-Bus API to talk to. Something to experiment with another time. (See `_pam_init_handlers()` in https://github.com/linux-pam/linux-pam/blob/master/libpam/pam_handlers.c for details of how PAM modules are loaded.) Signed-off-by: Philip Withnall <withnall@endlessm.com>
25 lines
693 B
Meson
25 lines
693 B
Meson
libpam = cc.find_library('pam', required: true)
|
|
libpam_misc = cc.find_library('pam_misc', required: true)
|
|
|
|
pam_malcontent = shared_library('pam_malcontent',
|
|
files('pam_malcontent.c'),
|
|
name_prefix: '',
|
|
link_args: [
|
|
'-shared',
|
|
'-Wl,--version-script=' + join_paths(meson.current_source_dir(), 'pam_malcontent.sym'),
|
|
],
|
|
dependencies: [
|
|
dependency('gio-2.0', version: '>= 2.44'),
|
|
dependency('glib-2.0', version: '>= 2.54.2'),
|
|
dependency('gobject-2.0', version: '>= 2.54'),
|
|
libmalcontent_dep,
|
|
libpam,
|
|
libpam_misc,
|
|
],
|
|
link_depends: files('pam_malcontent.sym'),
|
|
include_directories: root_inc,
|
|
install: true,
|
|
install_dir: pamlibdir)
|
|
|
|
subdir('tests')
|