build: Run tests with leak-sanitizer suppressions

cf. the never-ending saga of how we can't neuter the fontconfig leaks,
also pass our CI leak-sanitizer suppression file when running tests
locally. This makes it easier to run with ASan enabled in your local
environment.

Signed-off-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
Daniel Stone 2023-06-21 13:49:08 +01:00
parent 386dcd904f
commit 249f68adb0
2 changed files with 9 additions and 0 deletions

View File

@ -45,6 +45,7 @@ dir_lib_pc = dir_lib / 'pkgconfig'
dir_man = dir_prefix / get_option('mandir')
dir_protocol_libweston = 'libweston-@0@'.format(libweston_major) / 'protocols'
dir_sysconf = dir_prefix / get_option('sysconfdir')
dir_gitlab_ci = meson.project_source_root() / '.gitlab-ci'
public_inc = include_directories('include')
common_inc = [ include_directories('.'), public_inc ]

View File

@ -408,6 +408,13 @@ test_config_h.set_quoted('TESTSUITE_PLUGIN_PATH', exe_plugin_test.full_path())
test_config_h.set10('WESTON_TEST_SKIP_IS_FAILURE', get_option('test-skip-is-failure'))
configure_file(output: 'test-config.h', configuration: test_config_h)
test_env = {}
# there are some leaks in fontconfig we can't fix;
if get_option('b_sanitize') in ['address', 'address,undefined' ]
test_env += { 'LSAN_OPTIONS': 'suppressions=@0@'.format(dir_gitlab_ci / 'leak-sanitizer.supp') }
endif
foreach t : tests
t_name = 'test-' + t.get('name')
t_sources = t.get('sources', [t.get('name') + '-test.c'])
@ -434,6 +441,7 @@ foreach t : tests
test(
t.get('name'),
t_exe,
env: test_env,
depends: t.get('test_deps', []),
timeout: 120,
protocol: 'tap',