[PATCH] test-lib: Allow to be used by contrib projects
- From
- Santi 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