Files
pam-fprint-grosshack/tests/pam/meson.build
Marco Trevisan (Treviño) 184e1bd4d0 build: Support running tests with address sanitizer
Make possible to run tests with address sanitizer to quickly check for
memory errors, although we have to disable the error exit code in case of
leaks because we have some which are due to something else down in the stack
(and LSAN suppression files doesn't allow to define the stack to ignore
as we can in valgrind).

However, we'd abort in case of memory errors anyways, so this still helps
to prevent major problems, while still logging the leaks.

In order to run pam module tests with ASAN we need to manually pass the
library to LD_PRELOAD, as we do for the wrapper.
2020-04-01 13:58:08 +00:00

59 lines
1.6 KiB
Meson

subdir('services')
tests = [
'test_pam_fprintd',
]
preloaded_libs = []
pam_tests_ld_preload = []
if address_sanitizer
# ASAN has to be the first in list
preloaded_libs += 'asan'
endif
preloaded_libs += 'pam_wrapper'
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 += [
{
'name': t,
'file': files(meson.current_source_dir() / t + '.py')[0],
'env': [
'TOPBUILDDIR=' + meson.build_root(),
'TOPSRCDIR=' + meson.source_root(),
'LD_PRELOAD=' + ' '.join(pam_tests_ld_preload),
'PAM_WRAPPER=1',
'PAM_WRAPPER_DEBUGLEVEL=2',
'PAM_WRAPPER_SERVICE_DIR=' + meson.current_build_dir() / 'services',
'G_DEBUG=fatal-warnings',
],
'depends': [
pam_fprintd,
pam_service_file,
],
'suite': ['PAM'],
}
]
endforeach