t5004: avoid using tar for checking emptiness of archive
[git/mjg.git] / t / Makefile
blob44ca7d32dc7b1165712ad24784e14b34f3bf0c51
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-duplicates test-lint-executable
18 # Shell quote;
19 SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
20 PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
22 T = $(sort $(wildcard t[0-9][0-9][0-9][0-9]-*.sh))
23 TSVN = $(sort $(wildcard t91[0-9][0-9]-*.sh))
24 TGITWEB = $(sort $(wildcard t95[0-9][0-9]-*.sh))
26 all: $(DEFAULT_TEST_TARGET)
28 test: pre-clean $(TEST_LINT)
29 $(MAKE) aggregate-results-and-cleanup
31 prove: pre-clean $(TEST_LINT)
32 @echo "*** prove ***"; GIT_CONFIG=.git/config $(PROVE) --exec '$(SHELL_PATH_SQ)' $(GIT_PROVE_OPTS) $(T) :: $(GIT_TEST_OPTS)
33 $(MAKE) clean-except-prove-cache
35 $(T):
36 @echo "*** $@ ***"; GIT_CONFIG=.git/config '$(SHELL_PATH_SQ)' $@ $(GIT_TEST_OPTS)
38 pre-clean:
39 $(RM) -r test-results
41 clean-except-prove-cache:
42 $(RM) -r 'trash directory'.* test-results
43 $(RM) -r valgrind/bin
45 clean: clean-except-prove-cache
46 $(RM) .prove
48 test-lint: test-lint-duplicates test-lint-executable test-lint-shell-syntax
50 test-lint-duplicates:
51 @dups=`echo $(T) | tr ' ' '\n' | sed 's/-.*//' | sort | uniq -d` && \
52 test -z "$$dups" || { \
53 echo >&2 "duplicate test numbers:" $$dups; exit 1; }
55 test-lint-executable:
56 @bad=`for i in $(T); do test -x "$$i" || echo $$i; done` && \
57 test -z "$$bad" || { \
58 echo >&2 "non-executable tests:" $$bad; exit 1; }
60 test-lint-shell-syntax:
61 @'$(PERL_PATH_SQ)' check-non-portable-shell.pl $(T)
63 aggregate-results-and-cleanup: $(T)
64 $(MAKE) aggregate-results
65 $(MAKE) clean
67 aggregate-results:
68 for f in test-results/t*-*.counts; do \
69 echo "$$f"; \
70 done | '$(SHELL_PATH_SQ)' ./aggregate-results.sh
72 # we can test NO_OPTIMIZE_COMMITS independently of LC_ALL
73 full-svn-test:
74 $(MAKE) $(TSVN) GIT_SVN_NO_OPTIMIZE_COMMITS=1 LC_ALL=C
75 $(MAKE) $(TSVN) GIT_SVN_NO_OPTIMIZE_COMMITS=0 LC_ALL=en_US.UTF-8
77 gitweb-test:
78 $(MAKE) $(TGITWEB)
80 valgrind:
81 $(MAKE) GIT_TEST_OPTS="$(GIT_TEST_OPTS) --valgrind"
83 perf:
84 $(MAKE) -C perf/ all
86 .PHONY: pre-clean $(T) aggregate-results clean valgrind perf