t / valgrind / valgrind.shon commit Merge branch 'nd/no-more-fnmatch' (650c90a)
   1#!/bin/sh
   2
   3base=$(basename "$0")
   4
   5TOOL_OPTIONS='--leak-check=no'
   6
   7test -z "$GIT_VALGRIND_ENABLED" &&
   8exec "$GIT_VALGRIND"/../../"$base" "$@"
   9
  10case "$GIT_VALGRIND_MODE" in
  11memcheck-fast)
  12        ;;
  13memcheck)
  14        VALGRIND_VERSION=$(valgrind --version)
  15        VALGRIND_MAJOR=$(expr "$VALGRIND_VERSION" : '[^0-9]*\([0-9]*\)')
  16        VALGRIND_MINOR=$(expr "$VALGRIND_VERSION" : '[^0-9]*[0-9]*\.\([0-9]*\)')
  17        test 3 -gt "$VALGRIND_MAJOR" ||
  18        test 3 -eq "$VALGRIND_MAJOR" -a 4 -gt "$VALGRIND_MINOR" ||
  19        TOOL_OPTIONS="$TOOL_OPTIONS --track-origins=yes"
  20        ;;
  21*)
  22        TOOL_OPTIONS="--tool=$GIT_VALGRIND_MODE"
  23esac
  24
  25exec valgrind -q --error-exitcode=126 \
  26        --gen-suppressions=all \
  27        --suppressions="$GIT_VALGRIND/default.supp" \
  28        $TOOL_OPTIONS \
  29        --log-fd=4 \
  30        --input-fd=4 \
  31        $GIT_VALGRIND_OPTIONS \
  32        "$GIT_VALGRIND"/../../"$base" "$@"