git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>
Date
Nov 14, 2018, 16:32 UTC
Message-ID
<pull.73.v2.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.73.git.gitgitgadget@gmail.com>

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/20181102223743.4331-1-avarab@gmail.com/], 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
Previous: Junio C HamanoNext: Johannes Schindelin via GitGitGadget
Message 22 of 27 in “tests: various improvements to the GIT_TEST_INSTALLED feature”
  1. 0/5 tests: various improvements to the GIT_TEST_INSTALLED featureJohannes Schindelin via GitGitGadget, Nov 12, 2018
  2. 1/5 tests: fix GIT_TEST_INSTALLED's PATH to include t/helper/Johannes Schindelin via GitGitGadget, Nov 12, 2018
  3. Junio C HamanoNov 14, 2018
  4. 3/5 t/lib-gettext: test installed git-sh-i18n if GIT_TEST_INSTALLED is setJohannes Schindelin via GitGitGadget, Nov 12, 2018
  5. Junio C HamanoNov 14, 2018
  6. 2/5 tests: respect GIT_TEST_INSTALLED when initializing repositoriesJohannes Schindelin via GitGitGadget, Nov 12, 2018
  7. Junio C HamanoNov 14, 2018
  8. Johannes SchindelinNov 14, 2018
  9. Junio C HamanoNov 14, 2018
  10. Jeff KingNov 14, 2018
  11. Johannes SchindelinNov 15, 2018
  12. Jeff KingNov 15, 2018
  13. 4/5 tests: do not require Git to be built when testing an installed GitJohannes Schindelin via GitGitGadget, Nov 12, 2018
  14. Junio C HamanoNov 14, 2018
  15. Johannes SchindelinNov 14, 2018
  16. Jeff KingNov 14, 2018
  17. Johannes SchindelinNov 14, 2018
  18. 5/5 tests: explicitly use `git.exe` on WindowsJohannes Schindelin via GitGitGadget, Nov 12, 2018
  19. Junio C HamanoNov 14, 2018
  20. Johannes SchindelinNov 14, 2018
  21. Junio C HamanoNov 14, 2018
  22. 0/5 tests: various improvements to the GIT_TEST_INSTALLED featureJohannes Schindelin via GitGitGadget, Nov 14, 2018
  23. 1/5 tests: fix GIT_TEST_INSTALLED's PATH to include t/helper/Johannes Schindelin via GitGitGadget, Nov 14, 2018
  24. 2/5 tests: respect GIT_TEST_INSTALLED when initializing repositoriesJohannes Schindelin via GitGitGadget, Nov 14, 2018
  25. 3/5 t/lib-gettext: test installed git-sh-i18n if GIT_TEST_INSTALLED is setJohannes Schindelin via GitGitGadget, Nov 14, 2018
  26. 4/5 tests: do not require Git to be built when testing an installed GitJohannes Schindelin via GitGitGadget, Nov 14, 2018
  27. 5/5 tests: explicitly use `git.exe` on WindowsJohannes Schindelin via GitGitGadget, Nov 14, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.