xref: /freebsd/crypto/openssh/regress/valgrind-unit.sh (revision 0b3105a37d7adcadcb720112fed4dc4e8040be99)
1#!/bin/sh
2
3UNIT_BINARY="$1"
4shift
5UNIT_ARGS="$@"
6
7test "x$OBJ" = "x" && OBJ=$PWD
8
9# This mostly replicates the logic in test-exec.sh for running the
10# regress tests under valgrind.
11VG_TEST=`basename $UNIT_BINARY`
12VG_LOG="$OBJ/valgrind-out/${VG_TEST}.%p"
13VG_OPTS="--track-origins=yes --leak-check=full --log-file=${VG_LOG}"
14VG_OPTS="$VG_OPTS --trace-children=yes"
15VG_PATH="valgrind"
16if [ "x$VALGRIND_PATH" != "x" ]; then
17	VG_PATH="$VALGRIND_PATH"
18fi
19
20exec $VG_PATH $VG_OPTS $UNIT_BINARY $UNIT_ARGS
21