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 <john@keeping.me.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>

John Keeping committed Apr 26, 2013 at 19:55 UTC 54bb9015c817728371b48e908257fdf6a078eb60
1 file changed +10 -3
t/Makefile
+10 -3
@@ -15,9 +15,16 @@ PROVE ?= prove
15 DEFAULT_TEST_TARGET ?= test
16 TEST_LINT ?= test-lint-duplicates test-lint-executable
17
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 +
24 # Shell quote;
25 SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
26 PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
27 +TEST_RESULTS_DIRECTORY_SQ = $(subst ','\'',$(TEST_RESULTS_DIRECTORY))
28
29 T = $(sort $(wildcard t[0-9][0-9][0-9][0-9]-*.sh))
30 TSVN = $(sort $(wildcard t91[0-9][0-9]-*.sh))
@@ -36,10 +43,10 @@ $(T):
43 @echo "*** $@ ***"; GIT_CONFIG=.git/config '$(SHELL_PATH_SQ)' $@ $(GIT_TEST_OPTS)
44
45 pre-clean:
39 - $(RM) -r test-results
46 + $(RM) -r '$(TEST_RESULTS_DIRECTORY_SQ)'
47
48 clean-except-prove-cache:
42 - $(RM) -r 'trash directory'.* test-results
49 + $(RM) -r 'trash directory'.* '$(TEST_RESULTS_DIRECTORY_SQ)'
50 $(RM) -r valgrind/bin
51
52 clean: clean-except-prove-cache
@@ -65,7 +72,7 @@ aggregate-results-and-cleanup: $(T)
72 $(MAKE) clean
73
74 aggregate-results:
68 - for f in test-results/t*-*.counts; do \
75 + for f in '$(TEST_RESULTS_DIRECTORY_SQ)'/t*-*.counts; do \
76 echo "$$f"; \
77 done | '$(SHELL_PATH_SQ)' ./aggregate-results.sh
78