[postgis-tickets] r16962 - Add env vars to control valgrind for cunit tests

Daniel Baston dbaston at gmail.com
Tue Oct 30 11:18:06 PDT 2018


Author: dbaston
Date: 2018-10-30 11:18:06 -0700 (Tue, 30 Oct 2018)
New Revision: 16962

Modified:
   trunk/ci/travis/run_tests.sh
   trunk/liblwgeom/cunit/Makefile.in
Log:
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





Modified: trunk/ci/travis/run_tests.sh
===================================================================
--- trunk/ci/travis/run_tests.sh	2018-10-30 02:57:55 UTC (rev 16961)
+++ trunk/ci/travis/run_tests.sh	2018-10-30 18:18:06 UTC (rev 16962)
@@ -10,6 +10,9 @@
 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
 

Modified: trunk/liblwgeom/cunit/Makefile.in
===================================================================
--- trunk/liblwgeom/cunit/Makefile.in	2018-10-30 02:57:55 UTC (rev 16961)
+++ trunk/liblwgeom/cunit/Makefile.in	2018-10-30 18:18:06 UTC (rev 16962)
@@ -20,6 +20,10 @@
 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 @@
 
 # Build and run the unit tester
 check: cu_tester
-	@./cu_tester
+	$(LIBTOOL) --mode=execute $(LIBTOOL_VALGRIND) ./cu_tester
 
 endif
 



More information about the postgis-tickets mailing list