From 7779e4a8cdc40068969290ac858cb7b32f3129e9 Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Wed, 14 May 2014 21:49:36 +0200 Subject: [PATCH] t/: Run all unit tests through valgrind. This is implemented through a wrapper script which will run its arguments through valgrind if the first parameter matches "unit/". It is passed in to 'make test' using automake's TESTS_ENVIRONMENT variable. --- t/cibuild.sh | 2 +- t/testwrapper.sh | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100755 t/testwrapper.sh diff --git a/t/cibuild.sh b/t/cibuild.sh index 61f4a8b..9e21eb2 100755 --- a/t/cibuild.sh +++ b/t/cibuild.sh @@ -17,7 +17,7 @@ case "$CICFLAGS" in # skip regular tests ;; *) - make test + make test TESTS_ENVIRONMENT="./testwrapper.sh" ;; esac diff --git a/t/testwrapper.sh b/t/testwrapper.sh new file mode 100755 index 0000000..ccdbc6d --- /dev/null +++ b/t/testwrapper.sh @@ -0,0 +1,23 @@ +#! /bin/bash +# +# SysDB -- t/testwrapper.sh +# +# A wrapper script for running tests. + +set -e + +MEMCHECK="valgrind --quiet --tool=memcheck --error-exitcode=1" +MEMCHECK="$MEMCHECK --trace-children=yes" +MEMCHECK="$MEMCHECK --leak-check=full" + +case "$1" in + *unit/*) + exec $MEMCHECK "$@" + ;; + *) + exec "$@" + ;; +esac + +# vim: set tw=78 sw=4 ts=4 noexpandtab : + -- 2.30.2