Skip to content

Commit 54bb901

Browse files
johnkeepinggitster
authored andcommitted
t/Makefile: fix result handling with TEST_OUTPUT_DIRECTORY
When TEST_OUTPUT_DIRECTORY is set, the test results will be generated in "$TEST_OUTPUT_DIRECTORY/test-results", which may not be the same as "test-results" in t/Makefile. This causes the aggregate-results target to fail as it finds no count files. Fix this by introducing TEST_RESULTS_DIRECTORY and using it wherever test-results is referenced. Signed-off-by: John Keeping <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4a9a4f0 commit 54bb901

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

t/Makefile

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,16 @@ PROVE ?= prove
1515
DEFAULT_TEST_TARGET ?= test
1616
TEST_LINT ?= test-lint-duplicates test-lint-executable
1717

18+
ifdef TEST_OUTPUT_DIRECTORY
19+
TEST_RESULTS_DIRECTORY = $(TEST_RESULTS_DIRECTORY)/test-results
20+
else
21+
TEST_RESULTS_DIRECTORY = test-results
22+
endif
23+
1824
# Shell quote;
1925
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
2026
PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
27+
TEST_RESULTS_DIRECTORY_SQ = $(subst ','\'',$(TEST_RESULTS_DIRECTORY))
2128

2229
T = $(sort $(wildcard t[0-9][0-9][0-9][0-9]-*.sh))
2330
TSVN = $(sort $(wildcard t91[0-9][0-9]-*.sh))
@@ -36,10 +43,10 @@ $(T):
3643
@echo "*** $@ ***"; GIT_CONFIG=.git/config '$(SHELL_PATH_SQ)' $@ $(GIT_TEST_OPTS)
3744

3845
pre-clean:
39-
$(RM) -r test-results
46+
$(RM) -r '$(TEST_RESULTS_DIRECTORY_SQ)'
4047

4148
clean-except-prove-cache:
42-
$(RM) -r 'trash directory'.* test-results
49+
$(RM) -r 'trash directory'.* '$(TEST_RESULTS_DIRECTORY_SQ)'
4350
$(RM) -r valgrind/bin
4451

4552
clean: clean-except-prove-cache
@@ -65,7 +72,7 @@ aggregate-results-and-cleanup: $(T)
6572
$(MAKE) clean
6673

6774
aggregate-results:
68-
for f in test-results/t*-*.counts; do \
75+
for f in '$(TEST_RESULTS_DIRECTORY_SQ)'/t*-*.counts; do \
6976
echo "$$f"; \
7077
done | '$(SHELL_PATH_SQ)' ./aggregate-results.sh
7178

0 commit comments

Comments
 (0)