Skip to content

Commit 0940199

Browse files
committed
msvc: fix make test without having to play PATH games
When building with Microsoft Visual C, we use NuGet to acquire the dependencies (such as OpenSSL, cURL, etc). We even unpack those dependencies. This patch teaches the test suite to add the directory with the unpacked .dll files to the PATH before running the tests. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 2ce58c9 commit 0940199

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2341,6 +2341,7 @@ GIT-BUILD-OPTIONS: FORCE
23412341
@echo NO_UNIX_SOCKETS=\''$(subst ','\'',$(subst ','\'',$(NO_UNIX_SOCKETS)))'\' >>$@+
23422342
@echo PAGER_ENV=\''$(subst ','\'',$(subst ','\'',$(PAGER_ENV)))'\' >>$@+
23432343
@echo DC_SHA1=\''$(subst ','\'',$(subst ','\'',$(DC_SHA1)))'\' >>$@+
2344+
@echo X=\'$(X)\' >>$@+
23442345
ifdef TEST_OUTPUT_DIRECTORY
23452346
@echo TEST_OUTPUT_DIRECTORY=\''$(subst ','\'',$(subst ','\'',$(TEST_OUTPUT_DIRECTORY)))'\' >>$@+
23462347
endif
@@ -2375,6 +2376,9 @@ ifdef GIT_INTEROP_MAKE_OPTS
23752376
endif
23762377
ifdef TEST_GIT_INDEX_VERSION
23772378
@echo TEST_GIT_INDEX_VERSION=\''$(subst ','\'',$(subst ','\'',$(TEST_GIT_INDEX_VERSION)))'\' >>$@+
2379+
endif
2380+
ifdef MSVC_DEPS
2381+
@echo MSVC_DEPS=\''$(subst ','\'',$(subst ','\'',$(MSVC_DEPS)))'\' >>$@+
23782382
endif
23792383
@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
23802384

t/test-lib-functions.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,7 @@ test_create_repo () {
797797
mkdir -p "$repo"
798798
(
799799
cd "$repo" || error "Cannot setup test environment"
800-
"$GIT_EXEC_PATH/git-init" "--template=$GIT_BUILD_DIR/templates/blt/" >&3 2>&4 ||
800+
"$GIT_EXEC_PATH/git$X" init "--template=$GIT_BUILD_DIR/templates/blt/" >&3 2>&4 ||
801801
error "cannot run git init -- have you built things yet?"
802802
mv .git/hooks .git/hooks-disabled
803803
) || exit

t/test-lib.sh

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,27 @@ GIT_BUILD_DIR="$TEST_DIRECTORY"/..
4444
: ${ASAN_OPTIONS=detect_leaks=0:abort_on_error=1}
4545
export ASAN_OPTIONS
4646

47+
if test ! -f "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
48+
then
49+
echo >&2 'error: GIT-BUILD-OPTIONS missing (has Git been built?).'
50+
exit 1
51+
fi
52+
53+
. "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
54+
export PERL_PATH SHELL_PATH
55+
56+
test -z "$MSVC_DEPS" ||
57+
PATH="$GIT_BUILD_DIR/$MSVC_DEPS/bin:$PATH"
58+
4759
################################################################
4860
# It appears that people try to run tests without building...
49-
"$GIT_BUILD_DIR/git" >/dev/null
61+
"$GIT_BUILD_DIR/git$X" >/dev/null
5062
if test $? != 1
5163
then
5264
echo >&2 'error: you do not seem to have built git yet.'
5365
exit 1
5466
fi
5567

56-
. "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
57-
export PERL_PATH SHELL_PATH
58-
5968
# if --tee was passed, write the output not only to the terminal, but
6069
# additionally to the file test-results/$BASENAME.out, too.
6170
case "$GIT_TEST_TEE_STARTED, $* " in

0 commit comments

Comments
 (0)