mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-09-28 10:07:13 +02:00
memcheck: Add a 'make memcheck' target that runs valgrind
Checks for memory errors and leaks https://bugzilla.gnome.org/show_bug.cgi?id=711744
This commit is contained in:
16
build/glib-test.supp
Normal file
16
build/glib-test.supp
Normal file
@@ -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
|
||||
...
|
||||
}
|
@@ -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
|
||||
|
18
glib-tap.mk
18
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"
|
||||
|
13
glib.mk
13
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"
|
||||
|
Reference in New Issue
Block a user