summaryrefslogtreecommitdiff
path: root/regress/valgrind-unit.sh
blob: c353c2cbce88dfaab44d3825daafff013adf4186 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh

UNIT_BINARY="$1"
shift
UNIT_ARGS="$@"

test "x$OBJ" = "x" && OBJ=$PWD

# This mostly replicates the logic in test-exec.sh for running the
# regress tests under valgrind.
VG_LEAK="--leak-check=no"
if [ x"$VALGRIND_CHECK_LEAKS" = "x" ]; then
	VG_LEAK="--leak-check=full"
fi
VG_TEST=`basename $UNIT_BINARY`
VG_LOG="$OBJ/valgrind-out/${VG_TEST}.%p"
VG_OPTS="--track-origins=yes $VG_LEAK --log-file=${VG_LOG}"
VG_OPTS="$VG_OPTS --trace-children=yes"
VG_PATH="valgrind"
if [ "x$VALGRIND_PATH" != "x" ]; then
	VG_PATH="$VALGRIND_PATH"
fi

exec $VG_PATH $VG_OPTS $UNIT_BINARY $UNIT_ARGS