From: Jeff King Date: Fri, 17 Jun 2011 20:36:32 +0000 (-0400) Subject: tests: link shell libraries into valgrind directory X-Git-Tag: v1.7.6-rc3~7 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=36bfb0e5f6004e4c4ac9334107dc185c316839a7;p=git.git 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 Signed-off-by: Junio C Hamano --- diff --git a/t/test-lib.sh b/t/test-lib.sh index 64390d716..8c57a0059 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -884,8 +884,13 @@ then } make_valgrind_symlink () { - # handle only executables - test -x "$1" || return + # handle only executables, unless they are shell libraries that + # need to be in the exec-path. We will just use "#!" as a + # guess for a shell-script, since we have no idea what the user + # may have configured as the shell path. + test -x "$1" || + test "#!" = "$(head -c 2 <"$1")" || + return; base=$(basename "$1") symlink_target=$GIT_BUILD_DIR/$base