Skip to content

Commit a336083

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 bfd2879 commit a336083

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
@@ -170,6 +170,15 @@ appropriately before running "make".
170170
implied by other options like --valgrind and
171171
GIT_TEST_INSTALLED.
172172

173+
--no-bin-wrappers::
174+
By default, the test suite uses the wrappers in
175+
`../bin-wrappers/` to execute `git` and friends. With this option,
176+
`../git` and friends are run directly. This is not recommended
177+
in general, as the wrappers contain safeguards to ensure that no
178+
files from an installed Git are used, but can speed up test runs
179+
especially on platforms where running shell scripts is expensive
180+
(most notably, Windows).
181+
173182
--root=<directory>::
174183
Create "trash" directories used to store all temporary data during
175184
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
@@ -294,6 +294,8 @@ do
294294
test -z "$HARNESS_ACTIVE" && quiet=t; shift ;;
295295
--with-dashes)
296296
with_dashes=t; shift ;;
297+
--no-bin-wrappers)
298+
no_bin_wrappers=t; shift ;;
297299
--no-color)
298300
color=; shift ;;
299301
--va|--val|--valg|--valgr|--valgri|--valgrin|--valgrind)
@@ -1081,16 +1083,21 @@ then
10811083
PATH=$GIT_TEST_INSTALLED:$GIT_BUILD_DIR/t/helper:$PATH
10821084
GIT_EXEC_PATH=${GIT_TEST_EXEC_PATH:-$GIT_EXEC_PATH}
10831085
else # normal case, use ../bin-wrappers only unless $with_dashes:
1084-
git_bin_dir="$GIT_BUILD_DIR/bin-wrappers"
1085-
if ! test -x "$git_bin_dir/git"
1086+
if test -n "$no_bin_wrappers"
10861087
then
1087-
if test -z "$with_dashes"
1088+
with_dashes=t
1089+
else
1090+
git_bin_dir="$GIT_BUILD_DIR/bin-wrappers"
1091+
if ! test -x "$git_bin_dir/git"
10881092
then
1089-
say "$git_bin_dir/git is not executable; using GIT_EXEC_PATH"
1093+
if test -z "$with_dashes"
1094+
then
1095+
say "$git_bin_dir/git is not executable; using GIT_EXEC_PATH"
1096+
fi
1097+
with_dashes=t
10901098
fi
1091-
with_dashes=t
1099+
PATH="$git_bin_dir:$PATH"
10921100
fi
1093-
PATH="$git_bin_dir:$PATH"
10941101
GIT_EXEC_PATH=$GIT_BUILD_DIR
10951102
if test -n "$with_dashes"
10961103
then

0 commit comments

Comments
 (0)