Debian Codegraph @

t/Makefile

raw
1 # Run tests
2 #
3 # Copyright (c) 2011-2012 Mathias Lafeldt
4 # Copyright (c) 2005-2012 Git project
5 # Copyright (c) 2005-2012 Junio C Hamano
6 #
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 2 of the License, or
10 # (at your option) any later version.
11 #
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see http://www.gnu.org/licenses/ .
19
20 SHELL_PATH ?= /bin/bash
21 RM ?= rm -f
22 PROVE ?= prove
23 AGGREGATE_SCRIPT ?= aggregate-results.sh
24 DEFAULT_TEST_TARGET ?= test
25
26 T = $(sort $(wildcard *.t))
27
28 all: $(DEFAULT_TEST_TARGET)
29
30 test: pre-clean
31 $(MAKE) aggregate-results-and-cleanup
32
33 prove: pre-clean
34 @echo "*** prove ***"; $(PROVE) --exec '$(SHELL_PATH)' $(PROVE_OPTS) $(T) :: $(TEST_OPTS)
35 $(MAKE) clean-except-prove-cache
36
37 $(T):
38 @echo "*** $@ ***"; '$(SHELL_PATH)' $@ $(TEST_OPTS)
39
40 pre-clean:
41 $(RM) -r test-results
42
43 clean-except-prove-cache:
44 $(RM) -r 'trash.directory'.* test-results
45
46 clean: clean-except-prove-cache
47 $(RM) .prove
48
49 aggregate-results-and-cleanup: $(T)
50 $(MAKE) aggregate-results
51 $(MAKE) clean
52
53 aggregate-results:
54 for f in test-results/*.counts; do \
55 echo "$$f"; \
56 done | '$(SHELL_PATH)' '$(AGGREGATE_SCRIPT)'
57
58 .PHONY: all test prove $(T) pre-clean clean
59 .PHONY: aggregate-results-and-cleanup aggregate-results