xref: /freebsd/crypto/openssh/regress/valgrind-unit.sh (revision 405c3050f102b8c74782f0366c8ead927bd07b68)
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, except that we unconditionally enable
11# leak checking because the unit tests should be clean.
12VG_LEAK="--leak-check=full"
13VG_TEST=`basename $UNIT_BINARY`
14VG_LOG="$OBJ/valgrind-out/${VG_TEST}.%p"
15VG_OPTS="--track-origins=yes $VG_LEAK --log-file=${VG_LOG}"
16VG_OPTS="$VG_OPTS --trace-children=yes"
17VG_PATH="valgrind"
18if [ "x$VALGRIND_PATH" != "x" ]; then
19	VG_PATH="$VALGRIND_PATH"
20fi
21
22exec $VG_PATH $VG_OPTS $UNIT_BINARY $UNIT_ARGS
23