From 8e5ac009ac03032139e86034a712f95db8acf30e Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 11 Jul 2018 16:41:01 +0100 Subject: [PATCH 8/9] Use AX_VALGRIND_CHECK to set up partial valgrind test coverage This deliberately doesn't cover name-test/ yet. Signed-off-by: Simon McVittie --- README.valgrind | 6 ++++++ configure.ac | 5 +++++ test/Makefile.am | 5 +++++ test/dbus.supp | 19 +++++++++++++++++++ test/name-test/Makefile.am | 11 +++++++++++ 5 files changed, 46 insertions(+) create mode 100644 test/dbus.supp diff --git a/README.valgrind b/README.valgrind index c13f5304..bb1d458b 100644 --- a/README.valgrind +++ b/README.valgrind @@ -22,3 +22,9 @@ Your Valgrind log should now be free of any (spurious) libdbus-related leaks. For the curious, the DBUS_MESSAGE_CACHE=0 is required because by default, libdbus uses a recyclable pool of message structs. These help performance a bit. + +Running tests on dbus itself with Valgrind +==== + +You need debug symbols available for at least libc and GLib, otherwise +you will get false positives. diff --git a/configure.ac b/configure.ac index 917279d3..f30a59a1 100644 --- a/configure.ac +++ b/configure.ac @@ -1199,6 +1199,11 @@ fi AC_SUBST([NETWORK_libs]) +# Add check-valgrind, etc. targets +AX_VALGRIND_CHECK +AM_EXTRA_RECURSIVE_TARGETS([check-valgrind]) +AM_EXTRA_RECURSIVE_TARGETS([check-valgrind-memcheck]) + AC_ARG_WITH([valgrind], [AS_HELP_STRING([--with-valgrind], [Add instrumentation to help valgrind to understand our allocator])], diff --git a/test/Makefile.am b/test/Makefile.am index 5153ab6c..a5f10238 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -654,3 +654,8 @@ $(installable_test_meta_with_config): %_with_config.test: %$(EXEEXT) Makefile # Add rules for code-coverage testing, as defined by AX_CODE_COVERAGE @CODE_COVERAGE_RULES@ + +# Add rules for valgrind testing, as defined by AX_VALGRIND_CHECK +@VALGRIND_CHECK_RULES@ +VALGRIND_SUPPRESSIONS_FILES = $(srcdir)/dbus.supp +EXTRA_DIST += dbus.supp diff --git a/test/dbus.supp b/test/dbus.supp new file mode 100644 index 00000000..f964fb56 --- /dev/null +++ b/test/dbus.supp @@ -0,0 +1,19 @@ +{ + GLib type registrations + Memcheck:Leak + ... + fun:g_type_register_fundamental +} +{ + gobject_init + Memcheck:Leak + ... + fun:gobject_init +} +{ + + Memcheck:Leak + ... + fun:g_thread_new + fun:g_get_worker_context +} diff --git a/test/name-test/Makefile.am b/test/name-test/Makefile.am index 40096350..487adcad 100644 --- a/test/name-test/Makefile.am +++ b/test/name-test/Makefile.am @@ -88,3 +88,14 @@ test_privserver_client_LDADD=../libdbus-testutils.la test_autolaunch_LDADD=../libdbus-testutils.la endif + +# Don't use VALGRIND_CHECK_RULES here yet: we're very reliant on +# LOG_COMPILER for the tests in this directory, and can't cope with +# AX_VALGRIND_CHECK overriding it to be a valgrind tool. +check-valgrind-am-dummy: + @echo valgrind not supported for test/name-test/ yet +check-valgrind-am: check-valgrind-am-dummy +check-valgrind-drd-am: check-valgrind-am-dummy +check-valgrind-helgrind-am: check-valgrind-am-dummy +check-valgrind-memcheck-am: check-valgrind-am-dummy +check-valgrind-sgcheck-am: check-valgrind-am-dummy -- 2.18.0