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 <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed Jan 29, 2019 at 06:19 UTC dd167a3001a18ca1e9bcb607dfbdffbfe5af2113
2 files changed +22 -6
t/README
+9
@@ -170,6 +170,15 @@ appropriately before running "make".
170 implied by other options like --valgrind and
171 GIT_TEST_INSTALLED.
172
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 +
182 --root=<directory>::
183 Create "trash" directories used to store all temporary data during
184 testing under <directory>, instead of the t/ directory.
t/test-lib.sh
+13 -6
@@ -111,6 +111,8 @@ do
111 test -z "$HARNESS_ACTIVE" && quiet=t ;;
112 --with-dashes)
113 with_dashes=t ;;
114 + --no-bin-wrappers)
115 + no_bin_wrappers=t ;;
116 --no-color)
117 color= ;;
118 --va|--val|--valg|--valgr|--valgri|--valgrin|--valgrind)
@@ -1214,16 +1216,21 @@ then
1216 PATH=$GIT_TEST_INSTALLED:$GIT_BUILD_DIR/t/helper:$PATH
1217 GIT_EXEC_PATH=${GIT_TEST_EXEC_PATH:-$GIT_EXEC_PATH}
1218 else # normal case, use ../bin-wrappers only unless $with_dashes:
1217 - git_bin_dir="$GIT_BUILD_DIR/bin-wrappers"
1218 - if ! test -x "$git_bin_dir/git"
1219 + if test -n "$no_bin_wrappers"
1220 then
1220 - if test -z "$with_dashes"
1221 + with_dashes=t
1222 + else
1223 + git_bin_dir="$GIT_BUILD_DIR/bin-wrappers"
1224 + if ! test -x "$git_bin_dir/git"
1225 then
1222 - say "$git_bin_dir/git is not executable; using GIT_EXEC_PATH"
1226 + if test -z "$with_dashes"
1227 + then
1228 + say "$git_bin_dir/git is not executable; using GIT_EXEC_PATH"
1229 + fi
1230 + with_dashes=t
1231 fi
1224 - with_dashes=t
1232 + PATH="$git_bin_dir:$PATH"
1233 fi
1226 - PATH="$git_bin_dir:$PATH"
1234 GIT_EXEC_PATH=$GIT_BUILD_DIR
1235 if test -n "$with_dashes"
1236 then