1
0
mirror of https://github.com/git/git.git synced 2024-09-21 09:42:22 +02:00
git/t/valgrind/valgrind.sh
Thomas Rast 952af3511c tests: parameterize --valgrind option
Running tests under helgrind and DRD recently proved useful in
tracking down thread interaction issues.  This can unfortunately not
be done through GIT_VALGRIND_OPTIONS because any tool other than
memcheck would complain about unknown options.

Let --valgrind take an optional parameter that describes the valgrind
tool to invoke.  The default mode is to run memcheck as before.

Signed-off-by: Thomas Rast <trast@inf.ethz.ch>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-01 07:45:37 -07:00

28 lines
704 B
Bash
Executable File

#!/bin/sh
base=$(basename "$0")
TOOL_OPTIONS='--leak-check=no'
case "$GIT_VALGRIND_MODE" in
memcheck)
VALGRIND_VERSION=$(valgrind --version)
VALGRIND_MAJOR=$(expr "$VALGRIND_VERSION" : '[^0-9]*\([0-9]*\)')
VALGRIND_MINOR=$(expr "$VALGRIND_VERSION" : '[^0-9]*[0-9]*\.\([0-9]*\)')
test 3 -gt "$VALGRIND_MAJOR" ||
test 3 -eq "$VALGRIND_MAJOR" -a 4 -gt "$VALGRIND_MINOR" ||
TOOL_OPTIONS="$TOOL_OPTIONS --track-origins=yes"
;;
*)
TOOL_OPTIONS="--tool=$GIT_VALGRIND_MODE"
esac
exec valgrind -q --error-exitcode=126 \
--gen-suppressions=all \
--suppressions="$GIT_VALGRIND/default.supp" \
$TOOL_OPTIONS \
--log-fd=4 \
--input-fd=4 \
$GIT_VALGRIND_OPTIONS \
"$GIT_VALGRIND"/../../"$base" "$@"