Skip to content

Commit 2488849

Browse files
committed
Merge branch 'js/test-git-installed'
Update the "test installed Git" mode of our test suite to work better. * js/test-git-installed: tests: explicitly use `git.exe` on Windows tests: do not require Git to be built when testing an installed Git t/lib-gettext: test installed git-sh-i18n if GIT_TEST_INSTALLED is set tests: respect GIT_TEST_INSTALLED when initializing repositories tests: fix GIT_TEST_INSTALLED's PATH to include t/helper/
2 parents 1c6e646 + 8abfdf4 commit 2488849

File tree

4 files changed

+25
-8
lines changed

4 files changed

+25
-8
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2592,6 +2592,7 @@ GIT-BUILD-OPTIONS: FORCE
25922592
@echo NO_UNIX_SOCKETS=\''$(subst ','\'',$(subst ','\'',$(NO_UNIX_SOCKETS)))'\' >>$@+
25932593
@echo PAGER_ENV=\''$(subst ','\'',$(subst ','\'',$(PAGER_ENV)))'\' >>$@+
25942594
@echo DC_SHA1=\''$(subst ','\'',$(subst ','\'',$(DC_SHA1)))'\' >>$@+
2595+
@echo X=\'$(X)\' >>$@+
25952596
ifdef TEST_OUTPUT_DIRECTORY
25962597
@echo TEST_OUTPUT_DIRECTORY=\''$(subst ','\'',$(subst ','\'',$(TEST_OUTPUT_DIRECTORY)))'\' >>$@+
25972598
endif

t/lib-gettext.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@ GIT_TEXTDOMAINDIR="$GIT_BUILD_DIR/po/build/locale"
1010
GIT_PO_PATH="$GIT_BUILD_DIR/po"
1111
export GIT_TEXTDOMAINDIR GIT_PO_PATH
1212

13-
. "$GIT_BUILD_DIR"/git-sh-i18n
13+
if test -n "$GIT_TEST_INSTALLED"
14+
then
15+
. "$(git --exec-path)"/git-sh-i18n
16+
else
17+
. "$GIT_BUILD_DIR"/git-sh-i18n
18+
fi
1419

1520
if test_have_prereq GETTEXT && test_have_prereq C_LOCALE_OUTPUT
1621
then

t/test-lib-functions.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -923,7 +923,8 @@ test_create_repo () {
923923
mkdir -p "$repo"
924924
(
925925
cd "$repo" || error "Cannot setup test environment"
926-
"$GIT_EXEC_PATH/git-init" "--template=$GIT_BUILD_DIR/templates/blt/" >&3 2>&4 ||
926+
"${GIT_TEST_INSTALLED:-$GIT_EXEC_PATH}/git$X" init \
927+
"--template=$GIT_BUILD_DIR/templates/blt/" >&3 2>&4 ||
927928
error "cannot run git init -- have you built things yet?"
928929
mv .git/hooks .git/hooks-disabled
929930
) || exit

t/test-lib.sh

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,28 @@ export ASAN_OPTIONS
4949
: ${LSAN_OPTIONS=abort_on_error=1}
5050
export LSAN_OPTIONS
5151

52+
if test ! -f "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
53+
then
54+
echo >&2 'error: GIT-BUILD-OPTIONS missing (has Git been built?).'
55+
exit 1
56+
fi
57+
. "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
58+
export PERL_PATH SHELL_PATH
59+
5260
################################################################
5361
# It appears that people try to run tests without building...
54-
"$GIT_BUILD_DIR/git" >/dev/null
62+
"${GIT_TEST_INSTALLED:-$GIT_BUILD_DIR}/git$X" >/dev/null
5563
if test $? != 1
5664
then
57-
echo >&2 'error: you do not seem to have built git yet.'
65+
if test -n "$GIT_TEST_INSTALLED"
66+
then
67+
echo >&2 "error: there is no working Git at '$GIT_TEST_INSTALLED'"
68+
else
69+
echo >&2 'error: you do not seem to have built git yet.'
70+
fi
5871
exit 1
5972
fi
6073

61-
. "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
62-
export PERL_PATH SHELL_PATH
63-
6474
# if --tee was passed, write the output not only to the terminal, but
6575
# additionally to the file test-results/$BASENAME.out, too.
6676
case "$GIT_TEST_TEE_STARTED, $* " in
@@ -967,7 +977,7 @@ elif test -n "$GIT_TEST_INSTALLED"
967977
then
968978
GIT_EXEC_PATH=$($GIT_TEST_INSTALLED/git --exec-path) ||
969979
error "Cannot run git from $GIT_TEST_INSTALLED."
970-
PATH=$GIT_TEST_INSTALLED:$GIT_BUILD_DIR:$PATH
980+
PATH=$GIT_TEST_INSTALLED:$GIT_BUILD_DIR/t/helper:$PATH
971981
GIT_EXEC_PATH=${GIT_TEST_EXEC_PATH:-$GIT_EXEC_PATH}
972982
else # normal case, use ../bin-wrappers only unless $with_dashes:
973983
git_bin_dir="$GIT_BUILD_DIR/bin-wrappers"

0 commit comments

Comments
 (0)