Skip to content

Commit 62f5390

Browse files
avargitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6cec5c6 commit 62f5390

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

t/test-lib.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,13 @@ test_done () {
710710

711711
# Test the binaries we have just built. The tests are kept in
712712
# 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
714720
GIT_BUILD_DIR="$TEST_DIRECTORY"/..
715721

716722
if test -n "$valgrind"

0 commit comments

Comments
 (0)