Skip to content

Commit 2d14e13

Browse files
johnkeepinggitster
authored andcommitted
test output: respect $TEST_OUTPUT_DIRECTORY
Most test results go in $TEST_OUTPUT_DIRECTORY, but the output files for tests run with --tee or --valgrind just use bare "test-results". Changes these so that they do respect $TEST_OUTPUT_DIRECTORY. As a result of this, the valgrind/analyze.sh script may no longer inspect the correct files so it is also updated to respect $TEST_OUTPUT_DIRECTORY by adding it to GIT-BUILD-OPTIONS. This may be a regression for people who have TEST_OUTPUT_DIRECTORY in their config.mak but want to override it in the environment, but this change merely brings it into line with GIT_TEST_OPTS which already cannot be overridden if it is specified in config.mak. Signed-off-by: John Keeping <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 54bb901 commit 2d14e13

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2153,6 +2153,9 @@ GIT-BUILD-OPTIONS: FORCE
21532153
@echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@
21542154
@echo NO_PYTHON=\''$(subst ','\'',$(subst ','\'',$(NO_PYTHON)))'\' >>$@
21552155
@echo NO_UNIX_SOCKETS=\''$(subst ','\'',$(subst ','\'',$(NO_UNIX_SOCKETS)))'\' >>$@
2156+
ifdef TEST_OUTPUT_DIRECTORY
2157+
@echo TEST_OUTPUT_DIRECTORY=\''$(subst ','\'',$(subst ','\'',$(TEST_OUTPUT_DIRECTORY)))'\' >>$@
2158+
endif
21562159
ifdef GIT_TEST_OPTS
21572160
@echo GIT_TEST_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_OPTS)))'\' >>$@
21582161
endif

t/test-lib.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ done,*)
5454
# do not redirect again
5555
;;
5656
*' --tee '*|*' --va'*)
57-
mkdir -p test-results
58-
BASE=test-results/$(basename "$0" .sh)
57+
mkdir -p "$TEST_OUTPUT_DIRECTORY/test-results"
58+
BASE="$TEST_OUTPUT_DIRECTORY/test-results/$(basename "$0" .sh)"
5959
(GIT_TEST_TEE_STARTED=done ${SHELL_PATH} "$0" "$@" 2>&1;
6060
echo $? > $BASE.exit) | tee $BASE.out
6161
test "$(cat $BASE.exit)" = 0

t/valgrind/analyze.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
#!/bin/sh
22

3-
out_prefix=$(dirname "$0")/../test-results/valgrind.out
3+
# Get TEST_OUTPUT_DIRECTORY from GIT-BUILD-OPTIONS if it's there...
4+
. "$(dirname "$0")/../../GIT-BUILD-OPTIONS"
5+
# ... otherwise set it to the default value.
6+
: ${TEST_OUTPUT_DIRECTORY=$(dirname "$0")/..}
7+
48
output=
59
count=0
610
total_count=0
@@ -115,7 +119,7 @@ handle_one () {
115119
finish_output
116120
}
117121

118-
for test_script in "$(dirname "$0")"/../test-results/*.out
122+
for test_script in "$TEST_OUTPUT_DIRECTORY"/test-results/*.out
119123
do
120124
handle_one $test_script
121125
done

0 commit comments

Comments
 (0)