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

[PATCH] test-lib: Allow to be used by contrib projects

From
SBSanti Béjar <sbejar@gmail.com>
Date
Jun 12, 2008, 19:13 UTC
Message-ID
<1213298033-6086-1-git-send-email-sbejar@gmail.com>
The contrib project can have test scripts like the ones in git.git.
They only need a test-lib.sh and a Makefile like the following:
[test-lib.sh]

GIT_TEST_DIR=$(pwd)/../../../t PATH=$(pwd)/..:$PATH . ../../../t/test-lib.sh

[end of test-lib.sh]

[Makefile] include ../../../t/Makefile

Signed-off-by: Santi Béjar <sbejar@gmail.com>
---
 t/test-lib.sh |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 7a8bd27..62976da 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -387,28 +387,29 @@ test_done () {
 
 # Test the binaries we have just built.  The tests are kept in
 # t/ subdirectory and are run in trash subdirectory.
-PATH=$(pwd)/..:$PATH
-GIT_EXEC_PATH=$(pwd)/..
-GIT_TEMPLATE_DIR=$(pwd)/../templates/blt
+[ -z "$GIT_TEST_DIR" ] && GIT_TEST_DIR=$(pwd)
+PATH=$GIT_TEST_DIR/..:$PATH
+GIT_EXEC_PATH=$GIT_TEST_DIR/..
+GIT_TEMPLATE_DIR=$GIT_TEST_DIR/../templates/blt
 unset GIT_CONFIG
 unset GIT_CONFIG_LOCAL
 GIT_CONFIG_NOSYSTEM=1
 GIT_CONFIG_NOGLOBAL=1
 export PATH GIT_EXEC_PATH GIT_TEMPLATE_DIR GIT_CONFIG_NOSYSTEM GIT_CONFIG_NOGLOBAL
 
-GITPERLLIB=$(pwd)/../perl/blib/lib:$(pwd)/../perl/blib/arch/auto/Git
+GITPERLLIB=$GIT_TEST_DIR/../perl/blib/lib:$GIT_TEST_DIR/../perl/blib/arch/auto/Git
 export GITPERLLIB
-test -d ../templates/blt || {
+test -d "$GIT_TEMPLATE_DIR" || {
 	error "You haven't built things yet, have you?"
 }
 
-if ! test -x ../test-chmtime; then
+if ! test -x $GIT_TEST_DIR/../test-chmtime; then
 	echo >&2 'You need to build test-chmtime:'
 	echo >&2 'Run "make test-chmtime" in the source (toplevel) directory'
 	exit 1
 fi
 
-. ../GIT-BUILD-OPTIONS
+. $GIT_TEST_DIR/../GIT-BUILD-OPTIONS
 
 # Test repository
 test="trash directory"
-- 
1.5.5.3
Next: Santi Béjar
Message 1 of 2 in “test-lib: Allow to be used by contrib projects”
  1. test-lib: Allow to be used by contrib projectsSanti Béjar, Jun 12, 2008
  2. contrib/what: "git status" for am/bisect/cherry-pick/merge/rebase/revertSanti Béjar, Jun 12, 2008

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.