Skip to content

Commit 36bfb0e

Browse files
peffgitster
authored andcommitted
tests: link shell libraries into valgrind directory
When we run tests under valgrind, we symlink anything executable that starts with git-* or test-* into a special valgrind bin directory, and then make that our GIT_EXEC_PATH. However, shell libraries like git-sh-setup do not have the executable bit marked, and did not get symlinked. This means that any test looking for shell libraries in our exec-path would fail to find them, even though that is a fine thing to do when testing against a regular git build (or in a git install, for that matter). t2300 demonstrated this problem. The fix is to symlink these shell libraries directly into the valgrind directory. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7ef4d6b commit 36bfb0e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

t/test-lib.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -884,8 +884,13 @@ then
884884
}
885885

886886
make_valgrind_symlink () {
887-
# handle only executables
888-
test -x "$1" || return
887+
# handle only executables, unless they are shell libraries that
888+
# need to be in the exec-path. We will just use "#!" as a
889+
# guess for a shell-script, since we have no idea what the user
890+
# may have configured as the shell path.
891+
test -x "$1" ||
892+
test "#!" = "$(head -c 2 <"$1")" ||
893+
return;
889894

890895
base=$(basename "$1")
891896
symlink_target=$GIT_BUILD_DIR/$base

0 commit comments

Comments
 (0)