Skip to content

Commit b7ad7e9

Browse files
committed
tests: optionally skip bin-wrappers/
This speeds up the tests by a bit on Windows, where running Unix shell scripts (and spawning processes) is not exactly a cheap operation. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent d65f915 commit b7ad7e9

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

t/README

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,15 @@ appropriately before running "make".
169169
implied by other options like --valgrind and
170170
GIT_TEST_INSTALLED.
171171

172+
--no-bin-wrappers::
173+
By default, the test suite uses the wrappers in
174+
`../bin-wrappers/` to execute `git` and friends. With this option,
175+
`../git` and friends are run directly. This is not recommended
176+
in general, as the wrappers contain safeguards to ensure that no
177+
files from an installed Git are used, but can speed up test runs
178+
especially on platforms where running shell scripts is expensive
179+
(most notably, Windows).
180+
172181
--root=<directory>::
173182
Create "trash" directories used to store all temporary data during
174183
testing under <directory>, instead of the t/ directory.

t/test-lib.sh

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,8 @@ do
259259
test -z "$HARNESS_ACTIVE" && quiet=t; shift ;;
260260
--with-dashes)
261261
with_dashes=t; shift ;;
262+
--no-bin-wrappers)
263+
no_bin_wrappers=t; shift ;;
262264
--no-color)
263265
color=; shift ;;
264266
--va|--val|--valg|--valgr|--valgri|--valgrin|--valgrind)
@@ -1069,16 +1071,21 @@ then
10691071
PATH=$GIT_TEST_INSTALLED$PATH_SEP$GIT_BUILD_DIR/t/helper$PATH_SEP$PATH
10701072
GIT_EXEC_PATH=${GIT_TEST_EXEC_PATH:-$GIT_EXEC_PATH}
10711073
else # normal case, use ../bin-wrappers only unless $with_dashes:
1072-
git_bin_dir="$GIT_BUILD_DIR/bin-wrappers"
1073-
if ! test -x "$git_bin_dir/git"
1074+
if test -n "$no_bin_wrappers"
10741075
then
1075-
if test -z "$with_dashes"
1076+
with_dashes=t
1077+
else
1078+
git_bin_dir="$GIT_BUILD_DIR/bin-wrappers"
1079+
if ! test -x "$git_bin_dir/git"
10761080
then
1077-
say "$git_bin_dir/git is not executable; using GIT_EXEC_PATH"
1081+
if test -z "$with_dashes"
1082+
then
1083+
say "$git_bin_dir/git is not executable; using GIT_EXEC_PATH"
1084+
fi
1085+
with_dashes=t
10781086
fi
1079-
with_dashes=t
1087+
PATH="$git_bin_dir$PATH_SEP$PATH"
10801088
fi
1081-
PATH="$git_bin_dir$PATH_SEP$PATH"
10821089
GIT_EXEC_PATH=$GIT_BUILD_DIR
10831090
if test -n "$with_dashes"
10841091
then

0 commit comments

Comments
 (0)