Skip to content

Commit 1709567

Browse files
committed
Fix CTest failures (#3977)
When building Git via Visual Studio and then running the tests via CTest (which is made very easy by Visual Studio), there are test failures. This PR intends to address those. This closes #3966
2 parents 7f487e0 + 0bcb7ba commit 1709567

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

t/test-lib.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,16 @@ then
5151
TEST_OUTPUT_DIRECTORY=$TEST_DIRECTORY
5252
fi
5353
GIT_BUILD_DIR="${TEST_DIRECTORY%/t}"
54-
if test "$TEST_DIRECTORY" = "$GIT_BUILD_DIR"
54+
if test -f "$GIT_BUILD_DIR/GIT-BUILD-DIR"
55+
then
56+
GIT_BUILD_DIR="$(cat "$GIT_BUILD_DIR/GIT-BUILD-DIR")" || exit 1
57+
# On Windows, we must convert Windows paths lest they contain a colon
58+
case "$(uname -s)" in
59+
*MINGW*)
60+
GIT_BUILD_DIR="$(cygpath -au "$GIT_BUILD_DIR")"
61+
;;
62+
esac
63+
elif test "$TEST_DIRECTORY" = "$GIT_BUILD_DIR"
5564
then
5665
echo "PANIC: Running in a $TEST_DIRECTORY that doesn't end in '/t'?" >&2
5766
exit 1

0 commit comments

Comments
 (0)