t / Makefileon commit test: Add check-non-portable-shell.pl (c7ce70a)
   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))
  19PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
  20
  21T = $(sort $(wildcard t[0-9][0-9][0-9][0-9]-*.sh))
  22TSVN = $(sort $(wildcard t91[0-9][0-9]-*.sh))
  23TGITWEB = $(sort $(wildcard t95[0-9][0-9]-*.sh))
  24
  25all: $(DEFAULT_TEST_TARGET)
  26
  27test: pre-clean $(TEST_LINT)
  28        $(MAKE) aggregate-results-and-cleanup
  29
  30prove: 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
  33
  34$(T):
  35        @echo "*** $@ ***"; GIT_CONFIG=.git/config '$(SHELL_PATH_SQ)' $@ $(GIT_TEST_OPTS)
  36
  37pre-clean:
  38        $(RM) -r test-results
  39
  40clean-except-prove-cache:
  41        $(RM) -r 'trash directory'.* test-results
  42        $(RM) -r valgrind/bin
  43
  44clean: clean-except-prove-cache
  45        $(RM) .prove
  46
  47test-lint: test-lint-duplicates test-lint-executable test-lint-shell-syntax
  48
  49test-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; }
  53
  54test-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; }
  58
  59test-lint-shell-syntax:
  60        @'$(PERL_PATH_SQ)' check-non-portable-shell.pl $(T)
  61
  62aggregate-results-and-cleanup: $(T)
  63        $(MAKE) aggregate-results
  64        $(MAKE) clean
  65
  66aggregate-results:
  67        for f in test-results/t*-*.counts; do \
  68                echo "$$f"; \
  69        done | '$(SHELL_PATH_SQ)' ./aggregate-results.sh
  70
  71# we can test NO_OPTIMIZE_COMMITS independently of LC_ALL
  72full-svn-test:
  73        $(MAKE) $(TSVN) GIT_SVN_NO_OPTIMIZE_COMMITS=1 LC_ALL=C
  74        $(MAKE) $(TSVN) GIT_SVN_NO_OPTIMIZE_COMMITS=0 LC_ALL=en_US.UTF-8
  75
  76gitweb-test:
  77        $(MAKE) $(TGITWEB)
  78
  79valgrind:
  80        $(MAKE) GIT_TEST_OPTS="$(GIT_TEST_OPTS) --valgrind"
  81
  82perf:
  83        $(MAKE) -C perf/ all
  84
  85# Smoke testing targets
  86-include ../GIT-VERSION-FILE
  87uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo unknown')
  88uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo unknown')
  89
  90test-results:
  91        mkdir -p test-results
  92
  93test-results/git-smoke.tar.gz: test-results
  94        '$(PERL_PATH_SQ)' ./harness \
  95                --archive="test-results/git-smoke.tar.gz" \
  96                $(T)
  97
  98smoke: test-results/git-smoke.tar.gz
  99
 100SMOKE_UPLOAD_FLAGS =
 101ifdef SMOKE_USERNAME
 102        SMOKE_UPLOAD_FLAGS += -F username="$(SMOKE_USERNAME)" -F password="$(SMOKE_PASSWORD)"
 103endif
 104ifdef SMOKE_COMMENT
 105        SMOKE_UPLOAD_FLAGS += -F comments="$(SMOKE_COMMENT)"
 106endif
 107ifdef SMOKE_TAGS
 108        SMOKE_UPLOAD_FLAGS += -F tags="$(SMOKE_TAGS)"
 109endif
 110
 111smoke_report: smoke
 112        curl \
 113                -H "Expect: " \
 114                -F project=Git \
 115                -F architecture="$(uname_M)" \
 116                -F platform="$(uname_S)" \
 117                -F revision="$(GIT_VERSION)" \
 118                -F report_file=@test-results/git-smoke.tar.gz \
 119                $(SMOKE_UPLOAD_FLAGS) \
 120                http://smoke.git.nix.is/app/projects/process_add_report/1 \
 121        | grep -v ^Redirecting
 122
 123.PHONY: pre-clean $(T) aggregate-results clean valgrind perf