summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorStef Walter <stefw@gnome.org>2013-03-20 20:58:49 +0100
committerStef Walter <stefw@gnome.org>2013-03-20 22:22:18 +0100
commit9cf89e4b43e5e018bb3103be1873a3993769ce4a (patch)
tree9a69429d69f4d22d49fcfe51f0d495ec8ab9ba97 /build
parent0ecabc858dd6c1c2055f53202a01251e2ad7d2c2 (diff)
Add a bit of infrastructure for running valgrind
* make memcheck: Runs basic memory checking * make leakcheck: Also runs leak checking
Diffstat (limited to 'build')
-rw-r--r--build/Makefile.am4
-rw-r--r--build/Makefile.decl11
-rw-r--r--build/Makefile.tests11
3 files changed, 26 insertions, 0 deletions
diff --git a/build/Makefile.am b/build/Makefile.am
index de76c58..6f80eab 100644
--- a/build/Makefile.am
+++ b/build/Makefile.am
@@ -11,3 +11,7 @@ noinst_LTLIBRARIES = \
libcutest_la_SOURCES = \
cutest/CuTest.c \
cutest/CuTest.h
+
+memcheck:
+
+leakcheck:
diff --git a/build/Makefile.decl b/build/Makefile.decl
new file mode 100644
index 0000000..c90c22b
--- /dev/null
+++ b/build/Makefile.decl
@@ -0,0 +1,11 @@
+NULL =
+
+memcheck:
+ @for dir in $(SUBDIRS); do \
+ test "$$dir" = "." || $(MAKE) -C $$dir memcheck; \
+ done
+
+leakcheck:
+ @for dir in $(SUBDIRS); do \
+ test "$$dir" = "." || $(MAKE) -C $$dir leakcheck; \
+ done
diff --git a/build/Makefile.tests b/build/Makefile.tests
index 9f41045..3faa7f3 100644
--- a/build/Makefile.tests
+++ b/build/Makefile.tests
@@ -1,3 +1,4 @@
+NULL =
CUTEST_CFLAGS = \
-I$(top_srcdir)/build/cutest \
@@ -6,3 +7,13 @@ CUTEST_CFLAGS = \
-DP11_KIT_FUTURE_UNSTABLE_API
CUTEST_LIBS = $(top_builddir)/build/libcutest.la
+
+MEMCHECK_ENV = $(TEST_RUNNER) valgrind --error-exitcode=80 --quiet --trace-children=yes
+
+LEAKCHECK_ENV = $(TEST_RUNNER) valgrind --error-exitcode=81 --quiet --leak-check=yes
+
+memcheck: all
+ make $(AM_MAKEFLAGS) TESTS_ENVIRONMENT="$(MEMCHECK_ENV)" check-TESTS
+
+leakcheck: all
+ make $(AM_MAKEFLAGS) TESTS_ENVIRONMENT="$(LEAKCHECK_ENV)" check-TESTS