git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] test-lib: Allow to be used by contrib projects
@ 2008-06-12 19:13 Santi Béjar
  2008-06-12 19:13 ` [PATCH] contrib/what: "git status" for am/bisect/cherry-pick/merge/rebase/revert Santi Béjar
  0 siblings, 1 reply; 2+ messages in thread
From: Santi Béjar @ 2008-06-12 19:13 UTC (permalink / raw)
  To: git; +Cc: Santi Béjar

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-06-12 19:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-12 19:13 [PATCH] test-lib: Allow to be used by contrib projects Santi Béjar
2008-06-12 19:13 ` [PATCH] contrib/what: "git status" for am/bisect/cherry-pick/merge/rebase/revert Santi Béjar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).