fetch: run gc --auto after fetching
[git/gitweb.git] / t / Makefile
blob88e289fc8b790bad258fb29711e8dac675c7c3e9
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
17 # Shell quote;
18 SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
20 T = $(sort $(wildcard t[0-9][0-9][0-9][0-9]-*.sh))
21 TSVN = $(sort $(wildcard t91[0-9][0-9]-*.sh))
22 TGITWEB = $(sort $(wildcard t95[0-9][0-9]-*.sh))
24 all: $(DEFAULT_TEST_TARGET)
26 test: pre-clean $(TEST_LINT)
27 $(MAKE) aggregate-results-and-cleanup
29 prove: pre-clean $(TEST_LINT)
30 @echo "*** prove ***"; GIT_CONFIG=.git/config $(PROVE) --exec '$(SHELL_PATH_SQ)' $(GIT_PROVE_OPTS) $(T) :: $(GIT_TEST_OPTS)
31 $(MAKE) clean-except-prove-cache
33 $(T):
34 @echo "*** $@ ***"; GIT_CONFIG=.git/config '$(SHELL_PATH_SQ)' $@ $(GIT_TEST_OPTS)
36 pre-clean:
37 $(RM) -r test-results
39 clean-except-prove-cache:
40 $(RM) -r 'trash directory'.* test-results
41 $(RM) -r valgrind/bin
43 clean: clean-except-prove-cache
44 $(RM) .prove
46 test-lint: test-lint-duplicates test-lint-executable
48 test-lint-duplicates:
49 @dups=`echo $(T) | tr ' ' '\n' | sed 's/-.*//' | sort | uniq -d` && \
50 test -z "$$dups" || { \
51 echo >&2 "duplicate test numbers:" $$dups; exit 1; }
53 test-lint-executable:
54 @bad=`for i in $(T); do test -x "$$i" || echo $$i; done` && \
55 test -z "$$bad" || { \
56 echo >&2 "non-executable tests:" $$bad; exit 1; }
58 aggregate-results-and-cleanup: $(T)
59 $(MAKE) aggregate-results
60 $(MAKE) clean
62 aggregate-results:
63 for f in test-results/t*-*.counts; do \
64 echo "$$f"; \
65 done | '$(SHELL_PATH_SQ)' ./aggregate-results.sh
67 # we can test NO_OPTIMIZE_COMMITS independently of LC_ALL
68 full-svn-test:
69 $(MAKE) $(TSVN) GIT_SVN_NO_OPTIMIZE_COMMITS=1 LC_ALL=C
70 $(MAKE) $(TSVN) GIT_SVN_NO_OPTIMIZE_COMMITS=0 LC_ALL=en_US.UTF-8
72 gitweb-test:
73 $(MAKE) $(TGITWEB)
75 valgrind:
76 $(MAKE) GIT_TEST_OPTS="$(GIT_TEST_OPTS) --valgrind"
78 perf:
79 $(MAKE) -C perf/ all
81 # Smoke testing targets
82 -include ../GIT-VERSION-FILE
83 uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo unknown')
84 uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo unknown')
86 test-results:
87 mkdir -p test-results
89 test-results/git-smoke.tar.gz: test-results
90 $(PERL_PATH) ./harness \
91 --archive="test-results/git-smoke.tar.gz" \
92 $(T)
94 smoke: test-results/git-smoke.tar.gz
96 SMOKE_UPLOAD_FLAGS =
97 ifdef SMOKE_USERNAME
98 SMOKE_UPLOAD_FLAGS += -F username="$(SMOKE_USERNAME)" -F password="$(SMOKE_PASSWORD)"
99 endif
100 ifdef SMOKE_COMMENT
101 SMOKE_UPLOAD_FLAGS += -F comments="$(SMOKE_COMMENT)"
102 endif
103 ifdef SMOKE_TAGS
104 SMOKE_UPLOAD_FLAGS += -F tags="$(SMOKE_TAGS)"
105 endif
107 smoke_report: smoke
108 curl \
109 -H "Expect: " \
110 -F project=Git \
111 -F architecture="$(uname_M)" \
112 -F platform="$(uname_S)" \
113 -F revision="$(GIT_VERSION)" \
114 -F report_file=@test-results/git-smoke.tar.gz \
115 $(SMOKE_UPLOAD_FLAGS) \
116 http://smoke.git.nix.is/app/projects/process_add_report/1 \
117 | grep -v ^Redirecting
119 .PHONY: pre-clean $(T) aggregate-results clean valgrind perf