t/Makefile: Create test-results dir for smoke target
[git] / t / Makefile
1 # Run tests
2 #
3 # Copyright (c) 2005 Junio C Hamano
4 #
5
6 -include ../config.mak.autogen
7 -include ../config.mak
8
9 #GIT_TEST_OPTS=--verbose --debug
10 SHELL_PATH ?= $(SHELL)
11 PERL_PATH ?= /usr/bin/perl
12 TAR ?= $(TAR)
13 RM ?= rm -f
14
15 # Shell quote;
16 SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
17
18 T = $(wildcard t[0-9][0-9][0-9][0-9]-*.sh)
19 TSVN = $(wildcard t91[0-9][0-9]-*.sh)
20
21 all: pre-clean
22         $(MAKE) aggregate-results-and-cleanup
23
24 $(T):
25         @echo "*** $@ ***"; GIT_CONFIG=.git/config '$(SHELL_PATH_SQ)' $@ $(GIT_TEST_OPTS)
26
27 pre-clean:
28         $(RM) -r test-results
29
30 clean:
31         $(RM) -r 'trash directory'.* test-results
32         $(RM) t????/cvsroot/CVSROOT/?*
33         $(RM) -r valgrind/bin
34         $(RM) .prove
35
36 aggregate-results-and-cleanup: $(T)
37         $(MAKE) aggregate-results
38         $(MAKE) clean
39
40 aggregate-results:
41         for f in test-results/t*-*.counts; do \
42                 echo "$$f"; \
43         done | '$(SHELL_PATH_SQ)' ./aggregate-results.sh
44
45 # we can test NO_OPTIMIZE_COMMITS independently of LC_ALL
46 full-svn-test:
47         $(MAKE) $(TSVN) GIT_SVN_NO_OPTIMIZE_COMMITS=1 LC_ALL=C
48         $(MAKE) $(TSVN) GIT_SVN_NO_OPTIMIZE_COMMITS=0 LC_ALL=en_US.UTF-8
49
50 valgrind:
51         GIT_TEST_OPTS=--valgrind $(MAKE)
52
53 # Smoke testing targets
54 -include ../GIT-VERSION-FILE
55 uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo unknown')
56 uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo unknown')
57
58 test-results:
59         mkdir -p test-results
60
61 test-results/git-smoke.tar.gz: test-results
62         $(PERL_PATH) ./harness \
63                 --archive="test-results/git-smoke.tar.gz" \
64                 $(T)
65
66 smoke: test-results/git-smoke.tar.gz
67
68 SMOKE_UPLOAD_FLAGS =
69 ifdef SMOKE_USERNAME
70         SMOKE_UPLOAD_FLAGS += -F username="$(SMOKE_USERNAME)" -F password="$(SMOKE_PASSWORD)"
71 endif
72 ifdef SMOKE_COMMENT
73         SMOKE_UPLOAD_FLAGS += -F comments="$(SMOKE_COMMENT)"
74 endif
75 ifdef SMOKE_TAGS
76         SMOKE_UPLOAD_FLAGS += -F tags="$(SMOKE_TAGS)"
77 endif
78
79 smoke_report: smoke
80         curl \
81                 -H "Expect: " \
82                 -F project=Git \
83                 -F architecture="$(uname_M)" \
84                 -F platform="$(uname_S)" \
85                 -F revision="$(GIT_VERSION)" \
86                 -F report_file=@test-results/git-smoke.tar.gz \
87                 $(SMOKE_UPLOAD_FLAGS) \
88                 http://smoke.git.nix.is/app/projects/process_add_report/1 \
89         | grep -v ^Redirecting
90
91 .PHONY: pre-clean $(T) aggregate-results clean valgrind smoke smoke_report