Subject: [PATCH v2 0/5] tests: various improvements to the GIT_TEST_INSTALLED feature

From: "Johannes Schindelin via GitGitGadget" <[email-masked]>
Date: Wed, 14 Nov 2018 08:32:02 -0800 (PST)

By setting the GIT_TEST_INSTALLED variable to the path of an installed Git
executable, it is possible to run the test suite also on a specific
installed version (as opposed to a version built from scratch).

The only thing this needs that is unlikely to be installed is the test
helper(s).

However, there have been a few rough edges around that, identified in my
(still ongoing) work to support building Git in Visual Studio (where we do
not want to run GNU Make, and where we have no canonical way to create, say,
hard-linked copies of the built-in commands, and other work to let Git for
Windows play better with BusyBox.

Triggered by a comment of AEvar
[https://public-inbox.org/git/[email-masked]/], I
hereby contribute these assorted fixes for the GIT_TEST_INSTALLED feature.

Changes since v1:

 * Now we verify in test-lib.sh also in the GIT_TEST_INSTALLED case whether
   the Git executable is working (thanks, Peff!).
 * The commit message of 5/5 was touched up.

Johannes Schindelin (5):
  tests: fix GIT_TEST_INSTALLED's PATH to include t/helper/
  tests: respect GIT_TEST_INSTALLED when initializing repositories
  t/lib-gettext: test installed git-sh-i18n if GIT_TEST_INSTALLED is set
  tests: do not require Git to be built when testing an installed Git
  tests: explicitly use `git.exe` on Windows

 Makefile                |  1 +
 t/lib-gettext.sh        |  7 ++++++-
 t/test-lib-functions.sh |  3 ++-
 t/test-lib.sh           | 22 ++++++++++++++++------
 4 files changed, 25 insertions(+), 8 deletions(-)

base-commit: d166e6afe5f257217836ef24a73764eba390c58d
Published-As: https://github.com/gitgitgadget/git/releases/tags/pr-73%2Fdscho%2Ftest-git-installed-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-73/dscho/test-git-installed-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/73

Range-diff vs v1:

 1:  2b04f9f086 = 1:  3b68e0fe8a tests: fix GIT_TEST_INSTALLED's PATH to include t/helper/
 2:  948b3dc146 = 2:  80d50d5932 tests: respect GIT_TEST_INSTALLED when initializing repositories
 3:  eddea552e4 = 3:  49e408677a t/lib-gettext: test installed git-sh-i18n if GIT_TEST_INSTALLED is set
 4:  316e215e54 < -:  ---------- tests: do not require Git to be built when testing an installed Git
 -:  ---------- > 4:  b801dc8027 tests: do not require Git to be built when testing an installed Git
 5:  cd314e1384 ! 5:  fbdb659de6 tests: explicitly use `git.exe` on Windows
     @@ -2,6 +2,17 @@
      
          tests: explicitly use `git.exe` on Windows
      
     +    On Windows, when we refer to `/an/absolute/path/to/git`, it magically
     +    resolves `git.exe` at that location. Except if something of the name
     +    `git` exists next to that `git.exe`. So if we call `$BUILD_DIR/git`, it
     +    will find `$BUILD_DIR/git.exe` *only* if there is not, say, a directory
     +    called `$BUILD_DIR/git`.
     +
     +    Such a directory, however, exists in Git for Windows when building with
     +    Visual Studio (our Visual Studio project generator defaults to putting
     +    the build files into a directory whose name is the base name of the
     +    corresponding `.exe`).
     +
          In the bin-wrappers/* scripts, we already take pains to use `git.exe`
          rather than `git`, as this could pick up the wrong thing on Windows
          (i.e. if there exists a `git` file or directory in the build directory).
     @@ -68,11 +79,12 @@
      +
       ################################################################
       # It appears that people try to run tests without building...
     --test -n "$GIT_TEST_INSTALLED" || "$GIT_BUILD_DIR/git" >/dev/null ||
     -+test -n "$GIT_TEST_INSTALLED" || "$GIT_BUILD_DIR/git$X" >/dev/null ||
     +-"${GIT_TEST_INSTALLED:-$GIT_BUILD_DIR}/git" >/dev/null
     ++"${GIT_TEST_INSTALLED:-$GIT_BUILD_DIR}/git$X" >/dev/null
       if test $? != 1
       then
     - 	echo >&2 'error: you do not seem to have built git yet.'
     + 	if test -n "$GIT_TEST_INSTALLED"
     +@@
       	exit 1
       fi

-- 
gitgitgadget