mirror of
https://gitlab.com/mishakmak/pam-fprint-grosshack.git
synced 2026-04-08 20:03:34 +02:00
pam: Get preloaded libraries paths using compiler
In order to run pam module tests we need to pass the libraries via LD_PRELOAD, this supports a list of library paths, so use the compiler in order to find their full paths (with soname) and check their presence. In order to support linker scripts we need to introduce a workaround. See meson issue https://github.com/mesonbuild/meson/issues/6880
This commit is contained in:
committed by
Bastien Nocera
parent
3dd0018f23
commit
f401f399a8
@ -4,6 +4,31 @@ tests = [
|
||||
'test_pam_fprintd',
|
||||
]
|
||||
|
||||
preloaded_libs = [
|
||||
'pam_wrapper'
|
||||
]
|
||||
pam_tests_ld_preload = []
|
||||
|
||||
foreach libname: preloaded_libs
|
||||
lib = run_command(meson.get_compiler('c'),
|
||||
'-print-file-name=lib@0@.so'.format(libname)
|
||||
).stdout().strip()
|
||||
|
||||
# Support linker script files
|
||||
if run_command('grep', '-qI', '^INPUT', files(lib)).returncode() == 0
|
||||
out = run_command('cat', lib).stdout()
|
||||
lib = out.split('(')[1].split(')')[0].strip()
|
||||
endif
|
||||
|
||||
if lib != '' and lib[0] == '/'
|
||||
message('Found library @0@ as @1@'.format(libname, lib))
|
||||
pam_tests_ld_preload += '@0@'.format(files(lib)[0])
|
||||
else
|
||||
tests = []
|
||||
warning('No library found for ' + libname + ', skipping PAM tests')
|
||||
endif
|
||||
endforeach
|
||||
|
||||
foreach t: tests
|
||||
python_tests += [
|
||||
{
|
||||
@ -12,7 +37,7 @@ foreach t: tests
|
||||
'env': [
|
||||
'TOPBUILDDIR=' + meson.build_root(),
|
||||
'TOPSRCDIR=' + meson.source_root(),
|
||||
'LD_PRELOAD=libpam_wrapper.so',
|
||||
'LD_PRELOAD=' + ' '.join(pam_tests_ld_preload),
|
||||
'PAM_WRAPPER=1',
|
||||
'PAM_WRAPPER_DEBUGLEVEL=2',
|
||||
'PAM_WRAPPER_SERVICE_DIR=' + meson.current_build_dir() / 'services',
|
||||
|
||||
Reference in New Issue
Block a user