From 892c9767a25b4a583c325b132fa9b82545c0009b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Tue, 27 Sep 2022 19:58:53 +0200 Subject: [PATCH] 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. --- tests/libfprint.supp | 19 +++++++++++++++++++ tests/meson.build | 11 ++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 tests/libfprint.supp diff --git a/tests/libfprint.supp b/tests/libfprint.supp new file mode 100644 index 00000000..30a41454 --- /dev/null +++ b/tests/libfprint.supp @@ -0,0 +1,19 @@ +{ + + Memcheck:Leak + fun:malloc + ... + fun:dlopen* +} + +{ + + Memcheck:Param + socketcall.sendto(msg) + ... + fun:send + ... + fun:g_usb_device_get_string_descriptor + ... +} + diff --git a/tests/meson.build b/tests/meson.build index 94d47100..97a5bfa1 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -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',