Code

t/: Run all unit tests through valgrind.
authorSebastian Harl <sh@tokkee.org>
Wed, 14 May 2014 19:49:36 +0000 (21:49 +0200)
committerSebastian Harl <sh@tokkee.org>
Wed, 14 May 2014 19:49:36 +0000 (21:49 +0200)
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
t/testwrapper.sh [new file with mode: 0755]

index 61f4a8b09b658e3b13c75dd17cc7249517a275d7..9e21eb2b1fe15a75eb6fbe08f4f613b0cd110830 100755 (executable)
@@ -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 (executable)
index 0000000..ccdbc6d
--- /dev/null
@@ -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 :
+