doc: describe git svn init --ignore-refs
[git/git-svn.git] / contrib / subtree / t / Makefile
blob276898eb6bd720ac63a87a0f3d7a2bebb542cb37
1 # Run tests
3 # Copyright (c) 2005 Junio C Hamano
6 -include ../../../config.mak.autogen
7 -include ../../../config.mak
9 #GIT_TEST_OPTS=--verbose --debug
10 SHELL_PATH ?= $(SHELL)
11 PERL_PATH ?= /usr/bin/perl
12 TAR ?= $(TAR)
13 RM ?= rm -f
14 PROVE ?= prove
15 DEFAULT_TEST_TARGET ?= test
16 TEST_LINT ?= test-lint
18 ifdef TEST_OUTPUT_DIRECTORY
19 TEST_RESULTS_DIRECTORY = $(TEST_OUTPUT_DIRECTORY)/test-results
20 else
21 TEST_RESULTS_DIRECTORY = ../../../t/test-results
22 endif
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))
29 T = $(sort $(wildcard t[0-9][0-9][0-9][0-9]-*.sh))
30 TSVN = $(sort $(wildcard t91[0-9][0-9]-*.sh))
31 TGITWEB = $(sort $(wildcard t95[0-9][0-9]-*.sh))
32 THELPERS = $(sort $(filter-out $(T),$(wildcard *.sh)))
34 all: $(DEFAULT_TEST_TARGET)
36 test: pre-clean $(TEST_LINT)
37 $(MAKE) aggregate-results-and-cleanup
39 prove: pre-clean $(TEST_LINT)
40 @echo "*** prove ***"; GIT_CONFIG=.git/config $(PROVE) --exec '$(SHELL_PATH_SQ)' $(GIT_PROVE_OPTS) $(T) :: $(GIT_TEST_OPTS)
41 $(MAKE) clean-except-prove-cache
43 $(T):
44 @echo "*** $@ ***"; GIT_CONFIG=.git/config '$(SHELL_PATH_SQ)' $@ $(GIT_TEST_OPTS)
46 pre-clean:
47 $(RM) -r '$(TEST_RESULTS_DIRECTORY_SQ)'
49 clean-except-prove-cache:
50 $(RM) -r 'trash directory'.* '$(TEST_RESULTS_DIRECTORY_SQ)'
51 $(RM) -r valgrind/bin
53 clean: clean-except-prove-cache
54 $(RM) .prove
56 test-lint: test-lint-duplicates test-lint-executable test-lint-shell-syntax
58 test-lint-duplicates:
59 @dups=`echo $(T) | tr ' ' '\n' | sed 's/-.*//' | sort | uniq -d` && \
60 test -z "$$dups" || { \
61 echo >&2 "duplicate test numbers:" $$dups; exit 1; }
63 test-lint-executable:
64 @bad=`for i in $(T); do test -x "$$i" || echo $$i; done` && \
65 test -z "$$bad" || { \
66 echo >&2 "non-executable tests:" $$bad; exit 1; }
68 test-lint-shell-syntax:
69 @'$(PERL_PATH_SQ)' ../../../t/check-non-portable-shell.pl $(T) $(THELPERS)
71 aggregate-results-and-cleanup: $(T)
72 $(MAKE) aggregate-results
73 $(MAKE) clean
75 aggregate-results:
76 for f in '$(TEST_RESULTS_DIRECTORY_SQ)'/t*-*.counts; do \
77 echo "$$f"; \
78 done | '$(SHELL_PATH_SQ)' ../../../t/aggregate-results.sh
80 valgrind:
81 $(MAKE) GIT_TEST_OPTS="$(GIT_TEST_OPTS) --valgrind"
83 test-results:
84 mkdir -p test-results
86 .PHONY: pre-clean $(T) aggregate-results clean valgrind