3 # Copyright (c) 2005 Junio C Hamano
6 -include ../config.mak.autogen
9 #GIT_TEST_OPTS = --verbose --debug
10 SHELL_PATH ?= $(SHELL)
11 PERL_PATH ?= /usr/bin/perl
15 DEFAULT_TEST_TARGET ?= test
16 TEST_LINT ?= test-lint-duplicates test-lint-executable
19 SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
21 T = $(sort $(wildcard t[0-9][0-9][0-9][0-9]-*.sh))
22 TSVN = $(sort $(wildcard t91[0-9][0-9]-*.sh))
23 TGITWEB = $(sort $(wildcard t95[0-9][0-9]-*.sh))
25 all: $(DEFAULT_TEST_TARGET)
27 test: pre-clean $(TEST_LINT)
28 $(MAKE) aggregate-results-and-cleanup
30 prove: pre-clean $(TEST_LINT)
31 @echo "*** prove ***"; GIT_CONFIG=.git/config $(PROVE) --exec '$(SHELL_PATH_SQ)' $(GIT_PROVE_OPTS) $(T) :: $(GIT_TEST_OPTS)
32 $(MAKE) clean-except-prove-cache
35 @echo "*** $@ ***"; GIT_CONFIG=.git/config '$(SHELL_PATH_SQ)' $@ $(GIT_TEST_OPTS)
40 clean-except-prove-cache:
41 $(RM) -r 'trash directory'.* test-results
44 clean: clean-except-prove-cache
47 test-lint: test-lint-duplicates test-lint-executable
50 @dups=`echo $(T) | tr ' ' '\n' | sed 's/-.*//' | sort | uniq -d` && \
51 test -z "$$dups" || { \
52 echo >&2 "duplicate test numbers:" $$dups; exit 1; }
55 @bad=`for i in $(T); do test -x "$$i" || echo $$i; done` && \
56 test -z "$$bad" || { \
57 echo >&2 "non-executable tests:" $$bad; exit 1; }
59 aggregate-results-and-cleanup: $(T)
60 $(MAKE) aggregate-results
64 for f in test-results/t*-*.counts; do \
66 done | '$(SHELL_PATH_SQ)' ./aggregate-results.sh
68 # we can test NO_OPTIMIZE_COMMITS independently of LC_ALL
70 $(MAKE) $(TSVN) GIT_SVN_NO_OPTIMIZE_COMMITS=1 LC_ALL=C
71 $(MAKE) $(TSVN) GIT_SVN_NO_OPTIMIZE_COMMITS=0 LC_ALL=en_US.UTF-8
77 $(MAKE) GIT_TEST_OPTS="$(GIT_TEST_OPTS) --valgrind"
82 # Smoke testing targets
83 -include ../GIT-VERSION-FILE
84 uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo unknown')
85 uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo unknown')
90 test-results/git-smoke.tar.gz: test-results
91 $(PERL_PATH) ./harness \
92 --archive="test-results/git-smoke.tar.gz" \
95 smoke: test-results/git-smoke.tar.gz
99 SMOKE_UPLOAD_FLAGS += -F username="$(SMOKE_USERNAME)" -F password="$(SMOKE_PASSWORD)"
102 SMOKE_UPLOAD_FLAGS += -F comments="$(SMOKE_COMMENT)"
105 SMOKE_UPLOAD_FLAGS += -F tags="$(SMOKE_TAGS)"
112 -F architecture="$(uname_M)" \
113 -F platform="$(uname_S)" \
114 -F revision="$(GIT_VERSION)" \
115 -F report_file=@test-results/git-smoke.tar.gz \
116 $(SMOKE_UPLOAD_FLAGS) \
117 http://smoke.git.nix.is/app/projects/process_add_report/1 \
118 | grep -v ^Redirecting
120 .PHONY: pre-clean $(T) aggregate-results clean valgrind perf