t / valgrind / valgrind.shon commit sequencer (rebase -i): add support for the 'fixup' and 'squash' commands (6e98de7)
   1#!/bin/sh
   2
   3base=$(basename "$0")
   4case "$base" in
   5test-*)
   6        program="$GIT_VALGRIND/../../t/helper/$base"
   7        ;;
   8*)
   9        program="$GIT_VALGRIND/../../$base"
  10        ;;
  11esac
  12
  13TOOL_OPTIONS='--leak-check=no'
  14
  15test -z "$GIT_VALGRIND_ENABLED" &&
  16exec "$program" "$@"
  17
  18case "$GIT_VALGRIND_MODE" in
  19memcheck-fast)
  20        ;;
  21memcheck)
  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"
  28        ;;
  29*)
  30        TOOL_OPTIONS="--tool=$GIT_VALGRIND_MODE"
  31esac
  32
  33exec 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" "$@"