archive: handle commits with an empty tree
[git/jnareb-git.git] / t / Makefile
blob5c6de8169bfc02fc280d2dcb8cf34a912f0b0f6a
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))
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
34 $(T):
35 @echo "*** $@ ***"; GIT_CONFIG=.git/config '$(SHELL_PATH_SQ)' $@ $(GIT_TEST_OPTS)
37 pre-clean:
38 $(RM) -r test-results
40 clean-except-prove-cache:
41 $(RM) -r 'trash directory'.* test-results
42 $(RM) -r valgrind/bin
44 clean: clean-except-prove-cache
45 $(RM) .prove
47 test-lint: test-lint-duplicates test-lint-executable
49 test-lint-duplicates:
50 @dups=`echo $(T) | tr ' ' '\n' | sed 's/-.*//' | sort | uniq -d` && \
51 test -z "$$dups" || { \
52 echo >&2 "duplicate test numbers:" $$dups; exit 1; }
54 test-lint-executable:
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
61 $(MAKE) clean
63 aggregate-results:
64 for f in test-results/t*-*.counts; do \
65 echo "$$f"; \
66 done | '$(SHELL_PATH_SQ)' ./aggregate-results.sh
68 # we can test NO_OPTIMIZE_COMMITS independently of LC_ALL
69 full-svn-test:
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
73 gitweb-test:
74 $(MAKE) $(TGITWEB)
76 valgrind:
77 $(MAKE) GIT_TEST_OPTS="$(GIT_TEST_OPTS) --valgrind"
79 perf:
80 $(MAKE) -C perf/ all
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')
87 test-results:
88 mkdir -p test-results
90 test-results/git-smoke.tar.gz: test-results
91 $(PERL_PATH) ./harness \
92 --archive="test-results/git-smoke.tar.gz" \
93 $(T)
95 smoke: test-results/git-smoke.tar.gz
97 SMOKE_UPLOAD_FLAGS =
98 ifdef SMOKE_USERNAME
99 SMOKE_UPLOAD_FLAGS += -F username="$(SMOKE_USERNAME)" -F password="$(SMOKE_PASSWORD)"
100 endif
101 ifdef SMOKE_COMMENT
102 SMOKE_UPLOAD_FLAGS += -F comments="$(SMOKE_COMMENT)"
103 endif
104 ifdef SMOKE_TAGS
105 SMOKE_UPLOAD_FLAGS += -F tags="$(SMOKE_TAGS)"
106 endif
108 smoke_report: smoke
109 curl \
110 -H "Expect: " \
111 -F project=Git \
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