[PATCH v2 3/4] test-lib: Allow overriding of TEST_DIRECTORY
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Aug 19, 2010, 16:06 UTC
- Message-ID
- <1282233961-27203-4-git-send-email-avarab@gmail.com>
- In-Reply-To
- <1282138473-15613-1-git-send-email-avarab@gmail.com>
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> --- t/test-lib.sh | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/t/test-lib.sh b/t/test-lib.sh index 689aa29..01ddf3e 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -747,7 +747,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"
-- 1.7.2.1.414.g9bf49