Skip to content

Commit 28fab7b

Browse files
rscharfegitster
authored andcommitted
valgrind: support test helpers
Tests run with --valgrind call git commands through a wrapper script that invokes valgrind on them. This script (valgrind.sh) is in turn invoked through symlinks created for each command in t/valgrind/bin/. Since e6e7530 (test helpers: move test-* to t/helper/ subdirectory) these symlinks have been broken for test helpers -- they point to the old locations in the root of the build directory. Fix that by teaching the code for creating the links about the new location of the binaries, and do the same in the wrapper script to allow it to find its payload. Signed-off-by: Rene Scharfe <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 503e224 commit 28fab7b

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

t/test-lib.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,14 @@ then
766766
return;
767767

768768
base=$(basename "$1")
769-
symlink_target=$GIT_BUILD_DIR/$base
769+
case "$base" in
770+
test-*)
771+
symlink_target="$GIT_BUILD_DIR/t/helper/$base"
772+
;;
773+
*)
774+
symlink_target="$GIT_BUILD_DIR/$base"
775+
;;
776+
esac
770777
# do not override scripts
771778
if test -x "$symlink_target" &&
772779
test ! -d "$symlink_target" &&

t/valgrind/valgrind.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
#!/bin/sh
22

33
base=$(basename "$0")
4+
case "$base" in
5+
test-*)
6+
program="$GIT_VALGRIND/../../t/helper/$base"
7+
;;
8+
*)
9+
program="$GIT_VALGRIND/../../$base"
10+
;;
11+
esac
412

513
TOOL_OPTIONS='--leak-check=no'
614

715
test -z "$GIT_VALGRIND_ENABLED" &&
8-
exec "$GIT_VALGRIND"/../../"$base" "$@"
16+
exec "$program" "$@"
917

1018
case "$GIT_VALGRIND_MODE" in
1119
memcheck-fast)
@@ -29,4 +37,4 @@ exec valgrind -q --error-exitcode=126 \
2937
--log-fd=4 \
3038
--input-fd=4 \
3139
$GIT_VALGRIND_OPTIONS \
32-
"$GIT_VALGRIND"/../../"$base" "$@"
40+
"$program" "$@"

0 commit comments

Comments
 (0)