aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2010-08-19 16:08:11 +0000
committerJunio C Hamano <gitster@pobox.com>2010-08-31 12:12:01 -0700
commit62f539043c714031ccb78d13ed6c49d350233604 (patch)
tree48284466b66f1c08189135e61ecb017a6f8a5c9a
parent6cec5c683535c8eacf6055064c9c5753b47bb031 (diff)
downloadgit-62f539043c714031ccb78d13ed6c49d350233604.tar.gz
git-62f539043c714031ccb78d13ed6c49d350233604.tar.xz
test-lib: Allow overriding of TEST_DIRECTORY
Tests that test the test-lib.sh itself need to be executed in the dynamically created trash directory, so we can't assume $TEST_DIRECTORY is ../ for those. As a side benefit this change also makes it easy for us to move the t/*.sh tests into subdirectories if we ever want to do that. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--t/test-lib.sh8
1 files changed, 7 insertions, 1 deletions
diff --git a/t/test-lib.sh b/t/test-lib.sh
index eb51bc234..416713825 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -710,7 +710,13 @@ test_done () {
# Test the binaries we have just built. The tests are kept in
# t/ subdirectory and are run in 'trash directory' subdirectory.
-TEST_DIRECTORY=$(pwd)
+if test -z "$TEST_DIRECTORY"
+then
+ # We allow tests to override this, in case they want to run tests
+ # outside of t/, e.g. for running tests on the test library
+ # itself.
+ TEST_DIRECTORY=$(pwd)
+fi
GIT_BUILD_DIR="$TEST_DIRECTORY"/..
if test -n "$valgrind"