git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: greened@obbligato.org
To: git@vger.kernel.org
Cc: "David A. Greene" <greened@obbligato.org>
Subject: [PATCH 1/2] Allow Overriding GIT_BUILD_DIR
Date: Sun,  4 Mar 2012 17:23:56 -0600	[thread overview]
Message-ID: <1330903437-31386-1-git-send-email-greened@obbligato.org> (raw)

From: "David A. Greene" <greened@obbligato.org>

Let tests override GIT_BUILD_DIR so git will work if tests are not at
the same directory level as standard git tests.  Prior to this change,
GIT_BUILD_DIR is hardwired to be exactly one directory above where the
test lives.  A test within contrib/, for example, can now use
test-lib.sh and set an appropriate value for GIT_BUILD_DIR.

Signed-off-by: David A. Greene <greened@obbligato.org>
---
 t/test-lib.sh |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/t/test-lib.sh b/t/test-lib.sh
index a65dfc7..cb3a0a2 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -55,6 +55,7 @@ unset $(perl -e '
 		.*_TEST
 		PROVE
 		VALGRIND
+                BUILD_DIR
 	));
 	my @vars = grep(/^GIT_/ && !/^GIT_($ok)/o, @env);
 	print join("\n", @vars);
@@ -901,7 +902,20 @@ then
 	# itself.
 	TEST_DIRECTORY=$(pwd)
 fi
-GIT_BUILD_DIR="$TEST_DIRECTORY"/..
+
+if test -z "$GIT_BUILD_DIR"
+then
+	# We allow tests to override this, in case they want to run tests
+	# outside of t/.
+ 
+        # For in-tree test scripts, this is one level above the
+        # TEST_DIRECTORY (t/), but a test script that lives outside t/
+        # can set this variable to point at the right place so that it
+        # can find t/ directory that house test helpers like
+        # lib-pager*.sh and test vectors like t4013/ as well as
+        # previously built git tools.
+       GIT_BUILD_DIR="$TEST_DIRECTORY"/..
+fi
 
 if test -n "$valgrind"
 then
-- 
1.7.9.1

             reply	other threads:[~2012-03-04 23:27 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-04 23:23 greened [this message]
2012-03-04 23:23 ` [PATCH 2/2] Support Out-Of-Tree Valgrind Tests greened
2012-03-05  7:53   ` Thomas Rast
2012-03-05 18:11     ` David A. Greene
2012-03-06  8:46       ` Thomas Rast
2012-03-06 14:40         ` David A. Greene
2012-03-06 18:49           ` Junio C Hamano
2012-03-06 22:12             ` David A. Greene
2012-03-06 22:21               ` Junio C Hamano
2012-03-06 22:37                 ` Junio C Hamano
2012-03-06 23:00                   ` David A. Greene
2012-03-06 23:12                     ` Junio C Hamano
2012-03-06 22:54                 ` David A. Greene
2012-03-06 18:43         ` Junio C Hamano
2012-03-05  6:33 ` [PATCH 1/2] Allow Overriding GIT_BUILD_DIR Junio C Hamano
2012-03-05 18:10   ` David A. Greene
2012-03-05 20:08     ` Junio C Hamano
2012-03-06 14:21       ` David A. Greene

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1330903437-31386-1-git-send-email-greened@obbligato.org \
    --to=greened@obbligato.org \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).