@matheusbsbs / matheus-bagliano / commits / 62f539043c
Fork 0

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>

Ævar Arnfjörð Bjarmason committed Aug 19, 2010 at 16:08 UTC 62f539043c714031ccb78d13ed6c49d350233604
1 file changed +7 -1
t/test-lib.sh
+7 -1
@@ -710,7 +710,13 @@ test_done () {
710
711 # Test the binaries we have just built. The tests are kept in
712 # t/ subdirectory and are run in 'trash directory' subdirectory.
713 -TEST_DIRECTORY=$(pwd)
713 +if test -z "$TEST_DIRECTORY"
714 +then
715 + # We allow tests to override this, in case they want to run tests
716 + # outside of t/, e.g. for running tests on the test library
717 + # itself.
718 + TEST_DIRECTORY=$(pwd)
719 +fi
720 GIT_BUILD_DIR="$TEST_DIRECTORY"/..
721
722 if test -n "$valgrind"