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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux