From: Sebastian Harl Date: Wed, 14 May 2014 19:49:36 +0000 (+0200) Subject: t/: Run all unit tests through valgrind. X-Git-Tag: sysdb-0.1.0~18 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=7779e4a8cdc40068969290ac858cb7b32f3129e9;p=sysdb.git 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. --- 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 : +