[glib/wip/gcleanup: 20/79] memcheck: Add a 'make memcheck' target that runs valgrind
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/gcleanup: 20/79] memcheck: Add a 'make memcheck' target that runs valgrind
- Date: Sun, 10 Nov 2013 15:21:12 +0000 (UTC)
commit 3956ac1d1f8c75277fde260422897aee65ceb243
Author: Stef Walter <stefw gnome org>
Date: Sat Nov 9 22:56:04 2013 +0100
memcheck: Add a 'make memcheck' target that runs valgrind
Checks for memory errors and leaks
https://bugzilla.gnome.org/show_bug.cgi?id=711744
build/glib-test.supp | 16 ++++++++++++++++
configure.ac | 1 +
glib-tap.mk | 18 ++++++++++++++++--
glib.mk | 13 +++++++++++++
4 files changed, 46 insertions(+), 2 deletions(-)
---
diff --git a/build/glib-test.supp b/build/glib-test.supp
new file mode 100644
index 0000000..90ab4df
--- /dev/null
+++ b/build/glib-test.supp
@@ -0,0 +1,16 @@
+{
+ glibc-tls-allocation
+ Memcheck:Leak
+ fun:calloc
+ fun:_dl_allocate_tls
+ fun:pthread_create@@GLIBC_2.2.5
+ ...
+}
+
+{
+ pthread-exit
+ Memcheck:Leak
+ ...
+ fun:pthread_exit
+ ...
+}
diff --git a/configure.ac b/configure.ac
index 9712f80..d78a037 100644
--- a/configure.ac
+++ b/configure.ac
@@ -65,6 +65,7 @@ cflags_set=${CFLAGS+set}
AM_INIT_AUTOMAKE([1.11 -Wno-portability no-define no-dist-gzip dist-xz tar-ustar])
AM_MAINTAINER_MODE([enable])
+AM_EXTRA_RECURSIVE_TARGETS([memcheck])
# Support silent build rules. Disable
# by either passing --disable-silent-rules to configure or passing V=1
diff --git a/glib-tap.mk b/glib-tap.mk
index 6b9d107..1722f3c 100644
--- a/glib-tap.mk
+++ b/glib-tap.mk
@@ -1,9 +1,9 @@
# GLIB - Library of useful C routines
-TESTS_ENVIRONMENT= \
+AM_TESTS_ENVIRONMENT= \
G_TEST_SRCDIR="$(abs_srcdir)" \
G_TEST_BUILDDIR="$(abs_builddir)" \
- G_DEBUG=gc-friendly \
+ G_DEBUG="gc-friendly cleanup" \
MALLOC_CHECK_=2 \
MALLOC_PERTURB_=$$(($${RANDOM:-256} % 256))
TEST_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/tap-driver.sh
@@ -132,3 +132,17 @@ installed_test_meta_DATA = $(installed_testcases:=.test)
CLEANFILES += $(installed_test_meta_DATA)
endif
+
+VALGRIND_ARGS = \
+ --leak-check=full \
+ --show-leak-kinds=all \
+ --child-silent-after-fork=yes \
+ --suppressions=$(abs_top_srcdir)/build/glib-test.supp \
+ --num-callers=18 \
+ $(NULL)
+
+memcheck-local: $(all_test_programs)
+ $(MAKE) check-am TESTS="$(all_test_programs)" \
+ TESTS_ENVIRONMENT="G_DEBUG='gc-friendly cleanup'" \
+ LOG_COMPILER="libtool --mode=execute valgrind $(VALGRIND_ARGS) --quiet --log-fd=7" \
+ AM_TESTS_FD_REDIRECT="7>&2"
diff --git a/glib.mk b/glib.mk
index de87d58..90ccc57 100644
--- a/glib.mk
+++ b/glib.mk
@@ -168,3 +168,16 @@ installed_test_meta_DATA = $(installed_testcases:=.test)
CLEANFILES += $(installed_test_meta_DATA)
endif
+
+VALGRIND_ARGS = \
+ --leak-check=full \
+ --show-leak-kinds=all \
+ --child-silent-after-fork=yes \
+ --suppressions=$(abs_top_srcdir)/build/glib-test.supp \
+ $(NULL)
+
+memcheck-local: $(all_test_programs)
+ $(MAKE) check-am TESTS="$(all_test_programs)" \
+ TESTS_ENVIRONMENT="G_DEBUG='gc-friendly cleanup'" \
+ LOG_COMPILER="libtool --mode=execute valgrind $(VALGRIND_ARGS) --quiet --log-fd=7" \
+ AM_TESTS_FD_REDIRECT="7>&2"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]