]> granicus.if.org Git - p11-kit/commitdiff
Add a bit of infrastructure for running valgrind
authorStef Walter <stefw@gnome.org>
Wed, 20 Mar 2013 19:58:49 +0000 (20:58 +0100)
committerStef Walter <stefw@gnome.org>
Wed, 20 Mar 2013 21:22:18 +0000 (22:22 +0100)
 * make memcheck: Runs basic memory checking
 * make leakcheck: Also runs leak checking

13 files changed:
Makefile.am
build/Makefile.am
build/Makefile.decl [new file with mode: 0644]
build/Makefile.tests
common/Makefile.am
common/tests/Makefile.am
doc/Makefile.am
doc/manual/p11-kit-devel.xml
p11-kit/Makefile.am
tools/Makefile.am
tools/tests/Makefile.am
trust/Makefile.am
trust/tests/Makefile.am

index 863bc02c2eb1ae2a63bec325e46ca619aa72d450..13de2bb1f5928a1acb41cd9abd6539a58e771315 100644 (file)
@@ -1,4 +1,6 @@
 
+include $(top_srcdir)/build/Makefile.decl
+
 WEBHOST = anarchy.freedesktop.org
 WEBBASE = /srv/p11-glue.freedesktop.org/www
 
index de76c58b0b09bded9839ffe9ccd2ad0da8697b6f..6f80eab5586397252c2c1a7eaa2ef9de7f38015f 100644 (file)
@@ -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 (file)
index 0000000..c90c22b
--- /dev/null
@@ -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
index 9f41045cf2eae4b250e87133fa49d7d895c4b2af..3faa7f3d848c0c016f58561577862e9b89433745 100644 (file)
@@ -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
index 14432fc8afde3638e784ea53fd7e8a500938b950..bfed1d79e274281cba045c09003ba5dd79b10965 100644 (file)
@@ -1,4 +1,5 @@
-NULL =
+
+include $(top_srcdir)/build/Makefile.decl
 
 SUBDIRS = . tests
 
index 70f369c5b09ed23489ac19f529e867bdaf2a7b22..adc06cbc74f736aeaf7984cfaf89779cde9e8b0a 100644 (file)
@@ -1,8 +1,6 @@
 
 include $(top_srcdir)/build/Makefile.tests
 
-NULL =
-
 COMMON = $(top_srcdir)/common
 
 INCLUDES = \
index 27b5b4711921082da5a15ea3027950bfdc09a66a..de840c050f245d0b2dfb61f23d3fd6c64d684fd9 100644 (file)
@@ -1,2 +1,6 @@
 
 SUBDIRS = manual
+
+memcheck:
+
+leakcheck:
index 52535d355cdd87638657ad7da7fac84fe9f7f662..12beb5d10963494d145ccf1a333bc16e76eef9aa 100644 (file)
@@ -266,6 +266,10 @@ $ make install
                the tests. If you run it from a subdirectory only the tests in that
                directory will be run.</para>
 
+               <para>To check for memory errors or memory leaks, run <literal>make memcheck</literal>
+               or <literal>make leakcheck</literal> respectively. This requires valgrind
+               be installed.</para>
+
                <para>Build p11-kit with the <option>--enable-coverage</option> configure
                option to build code coverage support.</para>
 
index 0afa084dddf5f3e872dd83b4a2b74c6cce9d8fee..1967403175a738a3189c9612ff94fa37019de68c 100644 (file)
@@ -1,4 +1,5 @@
-NULL =
+
+include $(top_srcdir)/build/Makefile.decl
 
 SUBDIRS = . tests
 
index 49772218891cbbcc48ed866aa99f84875cc6ab7c..aaf7e99acb8c44bf1fe59868f57d91b35b1cd853 100644 (file)
@@ -1,4 +1,5 @@
-NULL =
+
+include $(top_srcdir)/build/Makefile.decl
 
 SUBDIRS = . tests
 
index a74c981424b3ce25b11c7a34656c98fadecf9e42..feffcc928d49ac7a51ea5af46c114f06de3cdbcc 100644 (file)
@@ -1,8 +1,6 @@
 
 include $(top_srcdir)/build/Makefile.tests
 
-NULL =
-
 EXTRA_DIST = files
 
 if WITH_ASN1
@@ -10,6 +8,8 @@ if WITH_ASN1
 COMMON = $(top_srcdir)/common
 TOOLS = $(top_srcdir)/tools
 
+TEST_RUNNER = libtool --mode=execute
+
 INCLUDES = \
        -I$(top_srcdir) \
        -I$(top_srcdir)/p11-kit \
index 38c6b984be17ab84b7341ee0c6e334b55b0ceb96..60323a8919d2149e73203bfd56f8aa479bd4b1a7 100644 (file)
@@ -1,4 +1,5 @@
-NULL =
+
+include $(top_srcdir)/build/Makefile.decl
 
 SUBDIRS = . tests
 
index 46175461e826cf68ca9201f1d09661d0432ab814..243b45ca50c7cf746c11b723b0df8f0aae223ff2 100644 (file)
@@ -1,8 +1,6 @@
 
 include $(top_srcdir)/build/Makefile.tests
 
-NULL =
-
 INCLUDES = \
        -I$(top_srcdir) \
        -I$(srcdir)/.. \