]> git.ipfire.org Git - thirdparty/git.git/blame - contrib/subtree/t/Makefile
Merge branch 'jk/clone-allow-bare-and-o-together'
[thirdparty/git.git] / contrib / subtree / t / Makefile
CommitLineData
c3d884a6
DG
1# Run tests
2#
3# Copyright (c) 2005 Junio C Hamano
4#
5
6-include ../../../config.mak.autogen
7-include ../../../config.mak
8
9#GIT_TEST_OPTS=--verbose --debug
10SHELL_PATH ?= $(SHELL)
11PERL_PATH ?= /usr/bin/perl
12TAR ?= $(TAR)
13RM ?= rm -f
14PROVE ?= prove
15DEFAULT_TEST_TARGET ?= test
b0638aa2
TZ
16TEST_LINT ?= test-lint
17
18ifdef TEST_OUTPUT_DIRECTORY
19TEST_RESULTS_DIRECTORY = $(TEST_OUTPUT_DIRECTORY)/test-results
20else
21TEST_RESULTS_DIRECTORY = ../../../t/test-results
22endif
c3d884a6
DG
23
24# Shell quote;
25SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
b0638aa2
TZ
26PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
27TEST_RESULTS_DIRECTORY_SQ = $(subst ','\'',$(TEST_RESULTS_DIRECTORY))
c3d884a6 28
b0638aa2
TZ
29T = $(sort $(wildcard t[0-9][0-9][0-9][0-9]-*.sh))
30TSVN = $(sort $(wildcard t91[0-9][0-9]-*.sh))
31TGITWEB = $(sort $(wildcard t95[0-9][0-9]-*.sh))
32THELPERS = $(sort $(filter-out $(T),$(wildcard *.sh)))
c3d884a6
DG
33
34all: $(DEFAULT_TEST_TARGET)
35
36test: pre-clean $(TEST_LINT)
37 $(MAKE) aggregate-results-and-cleanup
38
39prove: pre-clean $(TEST_LINT)
40 @echo "*** prove ***"; GIT_CONFIG=.git/config $(PROVE) --exec '$(SHELL_PATH_SQ)' $(GIT_PROVE_OPTS) $(T) :: $(GIT_TEST_OPTS)
b0638aa2 41 $(MAKE) clean-except-prove-cache
c3d884a6
DG
42
43$(T):
44 @echo "*** $@ ***"; GIT_CONFIG=.git/config '$(SHELL_PATH_SQ)' $@ $(GIT_TEST_OPTS)
45
46pre-clean:
b0638aa2 47 $(RM) -r '$(TEST_RESULTS_DIRECTORY_SQ)'
c3d884a6 48
b0638aa2 49clean-except-prove-cache:
fee65b19 50 $(RM) -r 'trash directory'.*
c3d884a6 51 $(RM) -r valgrind/bin
b0638aa2
TZ
52
53clean: clean-except-prove-cache
d11b8751 54 $(RM) -r '$(TEST_RESULTS_DIRECTORY_SQ)'
c3d884a6
DG
55 $(RM) .prove
56
b0638aa2 57test-lint: test-lint-duplicates test-lint-executable test-lint-shell-syntax
c3d884a6
DG
58
59test-lint-duplicates:
60 @dups=`echo $(T) | tr ' ' '\n' | sed 's/-.*//' | sort | uniq -d` && \
61 test -z "$$dups" || { \
62 echo >&2 "duplicate test numbers:" $$dups; exit 1; }
63
64test-lint-executable:
65 @bad=`for i in $(T); do test -x "$$i" || echo $$i; done` && \
66 test -z "$$bad" || { \
67 echo >&2 "non-executable tests:" $$bad; exit 1; }
68
b0638aa2
TZ
69test-lint-shell-syntax:
70 @'$(PERL_PATH_SQ)' ../../../t/check-non-portable-shell.pl $(T) $(THELPERS)
71
c3d884a6
DG
72aggregate-results-and-cleanup: $(T)
73 $(MAKE) aggregate-results
74 $(MAKE) clean
75
76aggregate-results:
b0638aa2 77 for f in '$(TEST_RESULTS_DIRECTORY_SQ)'/t*-*.counts; do \
c3d884a6
DG
78 echo "$$f"; \
79 done | '$(SHELL_PATH_SQ)' ../../../t/aggregate-results.sh
80
81valgrind:
82 $(MAKE) GIT_TEST_OPTS="$(GIT_TEST_OPTS) --valgrind"
83
84test-results:
85 mkdir -p test-results
86
87.PHONY: pre-clean $(T) aggregate-results clean valgrind