Skip to content

tests: various improvements to the GIT_TEST_INSTALLED feature - #73

Closed
dscho wants to merge 5 commits into
gitgitgadget:masterfrom
dscho:test-git-installed
Closed

dscho wants to merge 5 commits into
gitgitgadget:masterfrom
dscho:test-git-installed

Conversation

@dscho

@dscho dscho commented Nov 12, 2018 •

Copy link
Copy Markdown
Member

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, 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.

@dscho

dscho commented Nov 12, 2018

Copy link
Copy Markdown
Member Author

/submit

@gitgitgadget

gitgitgadget Bot commented Nov 12, 2018

Copy link
Copy Markdown

Submitted as pull.73.git.gitgitgadget@gmail.com

@dscho dscho mentioned this pull request Nov 13, 2018
35 tasks done
We really need to be able to find the test helpers... Really. This
change was forgotten when we moved the test helpers into t/helper/

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
It really makes very, very little sense to use a different git
executable than the one the caller indicated via setting the environment
variable GIT_TEST_INSTALLED.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
It makes very, very little sense to test the built git-sh-i18n when the
user asked specifically to test another one.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
We really only need the test helpers to be built in the worktree in that
case, but that is not what we test for.

On the other hand it is a perfect opportunity to verify that
`GIT_TEST_INSTALLED` points to a working Git.

So let's test the appropriate Git executable. While at it, also adjust
the error message in the `GIT_TEST_INSTALLED` case.

This patch is best viewed with `-w --patience`.

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
@dscho
dscho force-pushed the test-git-installed branch from cd314e1 to 6e535fa Compare November 14, 2018 13:43
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).

Now we do the same in the tests' start-up code.

This also helps when testing an installed Git, as there might be even
more likely some stray file or directory in the way.

Note: the only way we can record whether the `.exe` suffix is by writing
it to the `GIT-BUILD-OPTIONS` file and sourcing it at the beginning of
`t/test-lib.sh`. This is not a requirement introduced by this patch, but
we move the call to be able to use the `$X` variable that holds the file
extension, if any.

Note also: the many, many calls to `git this` and `git that` are
unaffected, as the regular PATH search will find the `.exe` files on
Windows (and not be confused by a directory of the name `git` that is
in one of the directories listed in the `PATH` variable), while
`/path/to/git` would not, per se, know that it is looking for an
executable and happily prefer such a directory.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
@dscho
dscho force-pushed the test-git-installed branch from 6e535fa to fbdb659 Compare November 14, 2018 16:31
@dscho

dscho commented Nov 14, 2018

Copy link
Copy Markdown
Member Author

/submit

@gitgitgadget

gitgitgadget Bot commented Nov 14, 2018

Copy link
Copy Markdown

Submitted as pull.73.v2.git.gitgitgadget@gmail.com

@gitgitgadget

gitgitgadget Bot commented Dec 15, 2018

Copy link
Copy Markdown

This branch is now known as js/test-git-installed.

@gitgitgadget

gitgitgadget Bot commented Dec 15, 2018

Copy link
Copy Markdown

This patch series was integrated into pu via git@2488849.

@gitgitgadget

gitgitgadget Bot commented Dec 15, 2018

Copy link
Copy Markdown

This patch series was integrated into next via git@2488849.

@gitgitgadget

gitgitgadget Bot commented Dec 15, 2018

Copy link
Copy Markdown

This patch series was integrated into master via git@2488849.

@gitgitgadget

gitgitgadget Bot commented Dec 15, 2018

Copy link
Copy Markdown

This patch series was integrated into maint via git@2488849.

@gitgitgadget

gitgitgadget Bot commented Dec 15, 2018

Copy link
Copy Markdown

Closed via 2488849.

@dscho
dscho deleted the test-git-installed branch December 15, 2018 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant