build: Support running tests with memory sanitizers

When memory sanitizers are set, tests may fail because we are indirectly
LD_PRELOAD'ing (through umockdev). While we could ensure that sanitizer
libraries are loaded first, it's just something we don't care because we
don't want to test the launcher wrappers themselves.

So, let's just ignore the link order and live with it
This commit is contained in:
Marco Trevisan (Treviño)
2025-02-13 20:17:42 +01:00
committed by Marco Trevisan
parent 6b914a2070
commit 830a9977c0
2 changed files with 19 additions and 2 deletions

View File

@@ -332,7 +332,7 @@ test('udev-hwdb',
env: envs)
gdb = find_program('gdb', required: false)
if gdb.found()
if gdb.found() and libfprint_sanitizers.length() == 0
libfprint_wrapper = [
gdb.full_path(),
'-batch',
@@ -347,8 +347,19 @@ if gdb.found()
])
endif
if ('address' in libfprint_sanitizers or
'undefined' in libfprint_sanitizers or
'leak' in libfprint_sanitizers)
add_test_setup('sanitizers',
is_default: true,
timeout_multiplier: 3,
env: [
'ASAN_OPTIONS=verify_asan_link_order=0',
])
endif
valgrind = find_program('valgrind', required: false)
if valgrind.found()
if valgrind.found() and libfprint_sanitizers.length() == 0
glib_share = glib_dep.get_variable(pkgconfig: 'prefix') / 'share' / glib_dep.name()
glib_suppressions = glib_share + '/valgrind/glib.supp'
libfprint_suppressions = '@0@/@1@'.format(meson.project_source_root(),