Merge branch 'nd/test-helpers' into maint
authorJunio C Hamano <gitster@pobox.com>
Tue, 29 Nov 2016 21:28:00 +0000 (13:28 -0800)
committerJunio C Hamano <gitster@pobox.com>
Tue, 29 Nov 2016 21:28:00 +0000 (13:28 -0800)
Update to the test framework made in 2.9 timeframe broke running
the tests under valgrind, which has been fixed.

* nd/test-helpers:
valgrind: support test helpers

t/test-lib.sh
t/valgrind/valgrind.sh
index 21e4aa2e542a1d7806f33c33e97aa46b104af38d..b021329e03eeef257afb8fb36a40644e000079b5 100644 (file)
@@ -809,7 +809,14 @@ then
                return;
 
                base=$(basename "$1")
-               symlink_target=$GIT_BUILD_DIR/$base
+               case "$base" in
+               test-*)
+                       symlink_target="$GIT_BUILD_DIR/t/helper/$base"
+                       ;;
+               *)
+                       symlink_target="$GIT_BUILD_DIR/$base"
+                       ;;
+               esac
                # do not override scripts
                if test -x "$symlink_target" &&
                    test ! -d "$symlink_target" &&
index 42153036dcfdee66e54fa4bd777ad3c36233d640..669ebaf68be006ee53911f02da72e56cb5a100f0 100755 (executable)
@@ -1,11 +1,19 @@
 #!/bin/sh
 
 base=$(basename "$0")
+case "$base" in
+test-*)
+       program="$GIT_VALGRIND/../../t/helper/$base"
+       ;;
+*)
+       program="$GIT_VALGRIND/../../$base"
+       ;;
+esac
 
 TOOL_OPTIONS='--leak-check=no'
 
 test -z "$GIT_VALGRIND_ENABLED" &&
-exec "$GIT_VALGRIND"/../../"$base" "$@"
+exec "$program" "$@"
 
 case "$GIT_VALGRIND_MODE" in
 memcheck-fast)
@@ -29,4 +37,4 @@ exec valgrind -q --error-exitcode=126 \
        --log-fd=4 \
        --input-fd=4 \
        $GIT_VALGRIND_OPTIONS \
-       "$GIT_VALGRIND"/../../"$base" "$@"
+       "$program" "$@"