Skip to content

Commit 6720721

Browse files
Michael J Grubergitster
authored andcommitted
test-lib.sh: Allow running the test suite against installed git
Introduce variables GIT_TEST_INSTALLED and GIT_TEST_EXEC_PATH such that the test suite can be run against a git which is installed at GIT_TEST_INSTALLED with subcommands at GIT_TEST_EXEC_PATH. GIT_TEST_INSTALLED defaults to the git.git checkout, GIT_TEST_EXEC_PATH defaults to the output of '$GIT_TEST_INSTALLED/git --exec-path'. Run the suite e.g. as GIT_TEST_INSTALLED=/some/path make test but note that this requires and uses parts of a compiled git in the git.git checkout: test helpers, templates and perl libraries are taken from there. Signed-off-by: Michael J Gruber <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7ee3760 commit 6720721

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

t/test-lib.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,8 +514,16 @@ test_done () {
514514
TEST_DIRECTORY=$(pwd)
515515
if test -z "$valgrind"
516516
then
517-
PATH=$TEST_DIRECTORY/..:$PATH
518-
GIT_EXEC_PATH=$TEST_DIRECTORY/..
517+
if test -z "$GIT_TEST_INSTALLED"
518+
then
519+
PATH=$TEST_DIRECTORY/..:$PATH
520+
GIT_EXEC_PATH=$TEST_DIRECTORY/..
521+
else
522+
GIT_EXEC_PATH=$($GIT_TEST_INSTALLED/git --exec-path) ||
523+
error "Cannot run git from $GIT_TEST_INSTALLED."
524+
PATH=$GIT_TEST_INSTALLED:$TEST_DIRECTORY/..:$PATH
525+
GIT_EXEC_PATH=${GIT_TEST_EXEC_PATH:-$GIT_EXEC_PATH}
526+
fi
519527
else
520528
make_symlink () {
521529
test -h "$2" &&

0 commit comments

Comments
 (0)