Thread (3 messages) flat view 3 messages, 2 authors, 2016-06-15
DORMANTno replies

[PATCH 1/2] Allow Overriding GIT_BUILD_DIR

From: <hidden>
Date: 2016-06-15 22:53:13
Subsystem: the rest · Maintainer: Linus Torvalds

From: "David A. Greene" <redacted>

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 <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help