From: Daniel Baston Date: Tue, 30 Oct 2018 18:18:06 +0000 (+0000) Subject: Add env vars to control valgrind for cunit tests X-Git-Tag: 3.0.0alpha1~309 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7c3f2c674e3aea0c15ad3aebec7274e51fbb29dc;p=postgis Add env vars to control valgrind for cunit tests Valgrind will be run with CUNIT_VALGRIND_FLAGS when CUNIT_WITH_VALGRIND is set to YES. Also update the Travis configuration to use valgrind. Closes #4219 Closes https://github.com/postgis/postgis/pull/323 git-svn-id: http://svn.osgeo.org/postgis/trunk@16962 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/ci/travis/run_tests.sh b/ci/travis/run_tests.sh index 126a28bee..d7bd40bea 100644 --- a/ci/travis/run_tests.sh +++ b/ci/travis/run_tests.sh @@ -10,6 +10,9 @@ LDFLAGS_STD="-Wl,-Bsymbolic-functions -Wl,-z,relro" CFLAGS_COV="-g -O0 --coverage" LDFLAGS_COV="--coverage" +export CUNIT_WITH_VALGRIND=YES +export CUNIT_VALGRIND_FLAGS="--leak-check=full --error-exitcode=1" + /usr/local/pgsql/bin/pg_ctl -c -l /tmp/logfile start ./autogen.sh diff --git a/liblwgeom/cunit/Makefile.in b/liblwgeom/cunit/Makefile.in index 0a3c06513..952d34fc4 100644 --- a/liblwgeom/cunit/Makefile.in +++ b/liblwgeom/cunit/Makefile.in @@ -20,6 +20,10 @@ CUNIT_CPPFLAGS=@CUNIT_CPPFLAGS@ -I.. CFLAGS=@WARNFLAGS@ @CFLAGS@ @GEOS_CPPFLAGS@ @PROJ_CPPFLAGS@ $(CUNIT_CPPFLAGS) LDFLAGS = @GEOS_LDFLAGS@ -lgeos_c $(CUNIT_LDFLAGS) -lm +ifeq ($(CUNIT_WITH_VALGRIND), YES) + LIBTOOL_VALGRIND := valgrind $(CUNIT_VALGRIND_FLAGS) +endif + # ADD YOUR NEW TEST FILE HERE (1/1) OBJS= \ cu_algorithm.o \ @@ -85,7 +89,7 @@ all: cu_tester # Build and run the unit tester check: cu_tester - @./cu_tester + $(LIBTOOL) --mode=execute $(LIBTOOL_VALGRIND) ./cu_tester endif