meson: add a test setup to run tests under valgrind

This commit is contained in:
George Kiagiadakis 2021-06-09 11:46:24 +03:00
parent 86fde56ddd
commit b39514a455
4 changed files with 37 additions and 2 deletions

View file

@ -16,8 +16,11 @@ run: all
WIREPLUMBER_DEBUG=$(WIREPLUMBER_DEBUG) \
./wp-uninstalled.sh $(DBG) ./build/src/wireplumber
test: all
ninja -C build test
test:
meson test -C build
test_valgrind:
meson test -C build --setup=valgrind
gdb:
$(MAKE) run DBG=gdb

View file

@ -68,6 +68,7 @@ endif
gnome = import('gnome')
pkgconfig = import('pkgconfig')
fs = import('fs')
wp_lib_include_dir = include_directories('lib')

View file

@ -21,3 +21,5 @@ option('systemd-user-unit-dir',
description : 'Directory for user systemd units')
option('wpipc', type : 'feature', value : 'disabled',
description: 'Build the wpipc library and module-ipc')
option('glib-supp', type : 'string', value : '',
description: 'The glib.supp valgrind suppressions file to be used when running valgrind')

View file

@ -1,3 +1,32 @@
valgrind = find_program('valgrind', required: false)
if valgrind.found()
glib_supp = get_option('glib-supp')
if glib_supp == ''
glib_supp = glib_dep.get_pkgconfig_variable('prefix')
glib_supp = glib_supp / 'share' / 'glib-2.0' / 'valgrind' / 'glib.supp'
endif
if fs.is_file(glib_supp)
message('Using glib.supp:', glib_supp)
else
message('glib.supp not found, valgrind tests will not work correctly')
endif
valgrind_env = environment({
'G_SLICE': 'always-malloc',
})
add_test_setup('valgrind',
exe_wrapper: [ valgrind,
'--suppressions=' + glib_supp,
'--leak-check=full',
'--gen-suppressions=all',
'--error-exitcode=3',
],
env: valgrind_env,
timeout_multiplier: 2)
endif
subdir('wp')
subdir('wplua')
subdir('wpipc', if_found: wpipc_dep)