Merge branch 'sl/clean-d-ignored-fix'
[alt-git.git] / t / valgrind / valgrind.sh
blob669ebaf68be006ee53911f02da72e56cb5a100f0
1 #!/bin/sh
3 base=$(basename "$0")
4 case "$base" in
5 test-*)
6 program="$GIT_VALGRIND/../../t/helper/$base"
7 ;;
8 *)
9 program="$GIT_VALGRIND/../../$base"
11 esac
13 TOOL_OPTIONS='--leak-check=no'
15 test -z "$GIT_VALGRIND_ENABLED" &&
16 exec "$program" "$@"
18 case "$GIT_VALGRIND_MODE" in
19 memcheck-fast)
21 memcheck)
22 VALGRIND_VERSION=$(valgrind --version)
23 VALGRIND_MAJOR=$(expr "$VALGRIND_VERSION" : '[^0-9]*\([0-9]*\)')
24 VALGRIND_MINOR=$(expr "$VALGRIND_VERSION" : '[^0-9]*[0-9]*\.\([0-9]*\)')
25 test 3 -gt "$VALGRIND_MAJOR" ||
26 test 3 -eq "$VALGRIND_MAJOR" -a 4 -gt "$VALGRIND_MINOR" ||
27 TOOL_OPTIONS="$TOOL_OPTIONS --track-origins=yes"
30 TOOL_OPTIONS="--tool=$GIT_VALGRIND_MODE"
31 esac
33 exec valgrind -q --error-exitcode=126 \
34 --gen-suppressions=all \
35 --suppressions="$GIT_VALGRIND/default.supp" \
36 $TOOL_OPTIONS \
37 --log-fd=4 \
38 --input-fd=4 \
39 $GIT_VALGRIND_OPTIONS \
40 "$program" "$@"