1 #! /bin/sh
2 #
3 # collectd -- testwrapper.sh
4 #
5 # A wrapper script for running tests. If valgrind is available, memory
6 # checking will be enabled for all tests.
8 set -e
10 MEMCHECK=""
12 if test -n "$VALGRIND"; then
13 MEMCHECK="$VALGRIND --quiet --tool=memcheck --error-exitcode=1"
14 MEMCHECK="$MEMCHECK --trace-children=yes"
15 MEMCHECK="$MEMCHECK --leak-check=full"
16 MEMCHECK="$MEMCHECK --gen-suppressions=all"
18 for f in "valgrind.$( uname -s ).suppress" "valgrind.suppress"; do
19 filename="$( dirname "$0" )/src/$f"
20 if test -e "$filename"; then
21 # Valgrind supports up to 100 suppression files.
22 MEMCHECK="$MEMCHECK --suppressions=$filename"
23 fi
24 done
25 fi
27 exec $MEMCHECK "$@"
29 # vim: set tw=78 sw=4 ts=4 noexpandtab :