]> granicus.if.org Git - postgis/commitdiff
Add env vars to control valgrind for cunit tests
authorDaniel Baston <dbaston@gmail.com>
Tue, 30 Oct 2018 18:18:06 +0000 (18:18 +0000)
committerDaniel Baston <dbaston@gmail.com>
Tue, 30 Oct 2018 18:18:06 +0000 (18:18 +0000)
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

ci/travis/run_tests.sh
liblwgeom/cunit/Makefile.in

index 126a28bee3c6a024c35bb2c4396768915e679ca1..d7bd40bea6e353a93bd11d8716e2e39f5f8474fa 100644 (file)
@@ -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
 
index 0a3c06513d2e64fe3b2780450cf23442deb5ddb4..952d34fc49cfb64f28d66129c1caf345b6d1322e 100644 (file)
@@ -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