tests: Be stricter on valgrind leak checks

We used to ignore leaks, and we are ending up in having various of them,
so let's make valgrind to exit with error when using the valgrind test
setup (so in CI) to catch them better.
This commit is contained in:
Marco Trevisan (Treviño)
2022-09-27 19:58:53 +02:00
parent 2718dc02e0
commit 892c9767a2
2 changed files with 29 additions and 1 deletions

19
tests/libfprint.supp Normal file
View File

@@ -0,0 +1,19 @@
{
<ignore_dl_open_leaks>
Memcheck:Leak
fun:malloc
...
fun:dlopen*
}
{
<ignore-gusb-get-string-desc-uninitialized-memory>
Memcheck:Param
socketcall.sendto(msg)
...
fun:send
...
fun:g_usb_device_get_string_descriptor
...
}

View File

@@ -234,17 +234,26 @@ valgrind = find_program('valgrind', required: false)
if valgrind.found()
glib_share = glib_dep.get_pkgconfig_variable('prefix') / 'share' / glib_dep.name()
glib_suppressions = glib_share + '/valgrind/glib.supp'
libfprint_suppressions = '@0@/@1@'.format(meson.source_root(),
files('libfprint.supp')[0])
python_suppressions = '@0@/@1@'.format(meson.source_root(),
files('valgrind-python.supp')[0])
libfprint_wrapper = [
valgrind.path(),
'--tool=memcheck',
'--leak-check=full',
'--leak-resolution=high',
'--error-exitcode=1',
'--errors-for-leak-kinds=definite',
'--track-origins=yes',
'--show-leak-kinds=definite,possible',
'--show-error-list=yes',
'--suppressions=' + libfprint_suppressions,
'--suppressions=' + glib_suppressions,
'--suppressions=' + python_suppressions,
]
add_test_setup('valgrind',
timeout_multiplier: 10,
timeout_multiplier: 15,
exe_wrapper: libfprint_wrapper,
env: [
'G_SLICE=always-malloc',