Skip to content

Commit 1d07640

Browse files
committed
Merge branch 'ps/t0000-output-directory-fix'
"TEST_OUTPUT_DIRECTORY=there make test" failed to work, which has been corrected. * ps/t0000-output-directory-fix: t0000: fix test if run with TEST_OUTPUT_DIRECTORY
2 parents 7f554a4 + ade1552 commit 1d07640

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

t/t0000-basic.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,11 @@ _run_sub_test_lib_test_common () {
106106
EOF
107107
cat >>"$name.sh" &&
108108
export TEST_DIRECTORY &&
109-
TEST_OUTPUT_DIRECTORY=$(pwd) &&
110-
export TEST_OUTPUT_DIRECTORY &&
109+
# The child test re-sources GIT-BUILD-OPTIONS and may thus
110+
# override the test output directory. We thus pass it as an
111+
# explicit override to the child.
112+
TEST_OUTPUT_DIRECTORY_OVERRIDE=$(pwd) &&
113+
export TEST_OUTPUT_DIRECTORY_OVERRIDE &&
111114
GIT_SKIP_TESTS=$skip &&
112115
export GIT_SKIP_TESTS &&
113116
sane_unset GIT_TEST_FAIL_PREREQS &&

t/test-lib.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,15 @@ fi
5757
. "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
5858
export PERL_PATH SHELL_PATH
5959

60+
# In t0000, we need to override test directories of nested testcases. In case
61+
# the developer has TEST_OUTPUT_DIRECTORY part of his build options, then we'd
62+
# reset this value to instead contain what the developer has specified. We thus
63+
# have this knob to allow overriding the directory.
64+
if test -n "${TEST_OUTPUT_DIRECTORY_OVERRIDE}"
65+
then
66+
TEST_OUTPUT_DIRECTORY="${TEST_OUTPUT_DIRECTORY_OVERRIDE}"
67+
fi
68+
6069
# Disallow the use of abbreviated options in the test suite by default
6170
if test -z "${GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS}"
6271
then

0 commit comments

Comments
 (0)