libfprint/SOURCES/0036-tests-Add-setup-mode-to-run-tests-using-valgrind.patch
2021-09-09 20:12:48 +00:00

102 lines
2.1 KiB
Diff

From 47cb10a9c1e15b2782f1efd4b7d27bd0481324b6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
Date: Tue, 26 Nov 2019 18:50:18 +0100
Subject: [PATCH 036/181] tests: Add setup mode to run tests using valgrind
In such case we need to ignore the python errors, so including a suppression
file when using --setup=valgrind.
---
tests/meson.build | 16 +++++++++++
tests/valgrind-python.supp | 55 ++++++++++++++++++++++++++++++++++++++
2 files changed, 71 insertions(+)
create mode 100644 tests/valgrind-python.supp
diff --git a/tests/meson.build b/tests/meson.build
index 1645028..0fe8096 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -54,3 +54,19 @@ if gdb.found()
gdb.path())
])
endif
+
+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'
+ python_suppressions = '@0@/@1@'.format(meson.source_root(),
+ files('valgrind-python.supp')[0])
+ add_test_setup('valgrind',
+ timeout_multiplier: 10,
+ env: [
+ 'G_SLICE=always-malloc',
+ ('LIBFPRINT_TEST_WRAPPER=@0@ --tool=memcheck --leak-check=full ' +
+ '--suppressions=@1@ --suppressions=@2@').format(
+ valgrind.path(), glib_suppressions, python_suppressions)
+ ])
+endif
diff --git a/tests/valgrind-python.supp b/tests/valgrind-python.supp
new file mode 100644
index 0000000..395e801
--- /dev/null
+++ b/tests/valgrind-python.supp
@@ -0,0 +1,55 @@
+{
+ ignore_py_cond
+ Memcheck:Cond
+ ...
+ fun:Py*
+}
+
+{
+ ignore__py_cond
+ Memcheck:Cond
+ ...
+ fun:_Py*
+}
+
+{
+ ignore_py_value8
+ Memcheck:Value8
+ ...
+ fun:Py*
+}
+
+{
+ ignore__py_value8
+ Memcheck:Value8
+ ...
+ fun:_Py*
+}
+
+{
+ ignore_py_addr4
+ Memcheck:Addr4
+ ...
+ fun:Py*
+}
+
+{
+ ignore__py_addr4
+ Memcheck:Addr4
+ ...
+ fun:_Py*
+}
+
+{
+ ignore_py_leaks
+ Memcheck:Leak
+ ...
+ fun:Py*
+}
+
+{
+ ignore__py_leaks
+ Memcheck:Leak
+ ...
+ fun:_Py*
+}
--
2.24.1