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