2005-05-14 09:50:32 +04:00
|
|
|
# Run tests
|
|
|
|
#
|
|
|
|
# Copyright (c) 2005 Junio C Hamano
|
|
|
|
#
|
2005-05-14 19:58:22 +04:00
|
|
|
|
2010-05-14 13:31:38 +04:00
|
|
|
-include ../config.mak.autogen
|
2009-08-09 12:50:37 +04:00
|
|
|
-include ../config.mak
|
|
|
|
|
2005-05-14 19:58:22 +04:00
|
|
|
#GIT_TEST_OPTS=--verbose --debug
|
2005-09-24 23:50:29 +04:00
|
|
|
SHELL_PATH ?= $(SHELL)
|
2010-08-08 18:49:26 +04:00
|
|
|
PERL_PATH ?= /usr/bin/perl
|
2005-10-01 00:31:16 +04:00
|
|
|
TAR ?= $(TAR)
|
2007-07-14 21:51:44 +04:00
|
|
|
RM ?= rm -f
|
2010-10-14 12:53:36 +04:00
|
|
|
PROVE ?= prove
|
|
|
|
DEFAULT_TEST_TARGET ?= test
|
2005-05-14 09:50:32 +04:00
|
|
|
|
2005-10-11 00:50:01 +04:00
|
|
|
# Shell quote;
|
2006-02-18 14:40:22 +03:00
|
|
|
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
|
2005-10-11 00:50:01 +04:00
|
|
|
|
t/Makefile: Use $(sort ...) explicitly where needed
Starting from GNU Make 3.82 $(wildcard ...) no longer sorts the result
(from NEWS):
* WARNING: Backward-incompatibility!
Wildcards were not documented as returning sorted values, but the results
have been sorted up until this release.. If your makefiles require sorted
results from wildcard expansions, use the $(sort ...) function to request
it explicitly.
http://repo.or.cz/w/make.git/commitdiff/2a59dc32aaf0681dec569f32a9d7ab88a379d34f
I usually watch test progress visually, and if tests are sorted, even
with make -j4 they go more or less incrementally by their t number. On
the other side, without sorting, tests are executed in seemingly random
order even for -j1. Let's please maintain sane tests order for perceived
prettyness.
Another note is that in GNU Make sort also works as uniq, so after sort
being removed, we might expect e.g. $(wildcard *.sh a.*) to produce
duplicates for e.g. "a.sh". From this point of view, adding sort could
be seen as hardening t/Makefile from accidentally introduced dups.
It turned out that prevous releases of GNU Make did not perform full
sort in $(wildcard), only sorting results for each pattern, that's why
explicit sort-as-uniq is relevant even for older makes.
Signed-off-by: Kirill Smelkov <kirr@navytux.spb.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-04 00:41:21 +04:00
|
|
|
T = $(sort $(wildcard t[0-9][0-9][0-9][0-9]-*.sh))
|
|
|
|
TSVN = $(sort $(wildcard t91[0-9][0-9]-*.sh))
|
|
|
|
TGITWEB = $(sort $(wildcard t95[0-9][0-9]-*.sh))
|
2005-05-14 09:50:32 +04:00
|
|
|
|
2010-10-14 12:53:36 +04:00
|
|
|
all: $(DEFAULT_TEST_TARGET)
|
|
|
|
|
2010-12-13 20:22:38 +03:00
|
|
|
test: pre-clean $(TEST_LINT)
|
tests: Clarify dependencies between tests, 'aggregate-results' and 'clean'
The Makefile targets 'aggregate-results' and 'clean' pretended to be
independent. This is not true, of course, since aggregate-results
needs the results _before_ they are removed.
Likewise, the tests should have been run already when the results are
to be aggregated.
However, as it is legitimate to run only a few tests, and then aggregate
just those results, so another target is introduced, that depends on all
tests, then aggregates the results, and only then removes the results.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-08 09:59:18 +04:00
|
|
|
$(MAKE) aggregate-results-and-cleanup
|
2005-11-08 12:51:10 +03:00
|
|
|
|
2010-12-13 20:22:38 +03:00
|
|
|
prove: pre-clean $(TEST_LINT)
|
2010-10-14 12:53:36 +04:00
|
|
|
@echo "*** prove ***"; GIT_CONFIG=.git/config $(PROVE) --exec '$(SHELL_PATH_SQ)' $(GIT_PROVE_OPTS) $(T) :: $(GIT_TEST_OPTS)
|
|
|
|
$(MAKE) clean
|
|
|
|
|
2005-11-08 12:51:10 +03:00
|
|
|
$(T):
|
2006-06-20 02:51:58 +04:00
|
|
|
@echo "*** $@ ***"; GIT_CONFIG=.git/config '$(SHELL_PATH_SQ)' $@ $(GIT_TEST_OPTS)
|
2005-05-14 09:50:32 +04:00
|
|
|
|
2008-06-08 18:04:35 +04:00
|
|
|
pre-clean:
|
|
|
|
$(RM) -r test-results
|
|
|
|
|
2005-05-14 19:57:32 +04:00
|
|
|
clean:
|
2009-03-28 04:57:18 +03:00
|
|
|
$(RM) -r 'trash directory'.* test-results
|
2010-03-13 23:41:20 +03:00
|
|
|
$(RM) -r valgrind/bin
|
2010-07-24 02:58:44 +04:00
|
|
|
$(RM) .prove
|
2005-11-08 12:51:10 +03:00
|
|
|
|
2010-12-13 20:22:38 +03:00
|
|
|
test-lint: test-lint-duplicates test-lint-executable
|
|
|
|
|
|
|
|
test-lint-duplicates:
|
|
|
|
@dups=`echo $(T) | tr ' ' '\n' | sed 's/-.*//' | sort | uniq -d` && \
|
|
|
|
test -z "$$dups" || { \
|
|
|
|
echo >&2 "duplicate test numbers:" $$dups; exit 1; }
|
|
|
|
|
|
|
|
test-lint-executable:
|
|
|
|
@bad=`for i in $(T); do test -x "$$i" || echo $$i; done` && \
|
|
|
|
test -z "$$bad" || { \
|
|
|
|
echo >&2 "non-executable tests:" $$bad; exit 1; }
|
|
|
|
|
tests: Clarify dependencies between tests, 'aggregate-results' and 'clean'
The Makefile targets 'aggregate-results' and 'clean' pretended to be
independent. This is not true, of course, since aggregate-results
needs the results _before_ they are removed.
Likewise, the tests should have been run already when the results are
to be aggregated.
However, as it is legitimate to run only a few tests, and then aggregate
just those results, so another target is introduced, that depends on all
tests, then aggregates the results, and only then removes the results.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-08 09:59:18 +04:00
|
|
|
aggregate-results-and-cleanup: $(T)
|
|
|
|
$(MAKE) aggregate-results
|
|
|
|
$(MAKE) clean
|
|
|
|
|
2008-06-08 18:04:35 +04:00
|
|
|
aggregate-results:
|
2010-07-16 13:37:44 +04:00
|
|
|
for f in test-results/t*-*.counts; do \
|
2010-06-02 04:13:44 +04:00
|
|
|
echo "$$f"; \
|
|
|
|
done | '$(SHELL_PATH_SQ)' ./aggregate-results.sh
|
2008-06-08 18:04:35 +04:00
|
|
|
|
2006-07-06 11:14:16 +04:00
|
|
|
# we can test NO_OPTIMIZE_COMMITS independently of LC_ALL
|
|
|
|
full-svn-test:
|
2006-12-28 12:16:19 +03:00
|
|
|
$(MAKE) $(TSVN) GIT_SVN_NO_OPTIMIZE_COMMITS=1 LC_ALL=C
|
2006-12-16 10:58:07 +03:00
|
|
|
$(MAKE) $(TSVN) GIT_SVN_NO_OPTIMIZE_COMMITS=0 LC_ALL=en_US.UTF-8
|
2006-07-06 11:14:16 +04:00
|
|
|
|
2010-09-26 17:02:26 +04:00
|
|
|
gitweb-test:
|
|
|
|
$(MAKE) $(TGITWEB)
|
|
|
|
|
2009-02-04 02:26:18 +03:00
|
|
|
valgrind:
|
2011-06-17 12:29:57 +04:00
|
|
|
$(MAKE) GIT_TEST_OPTS="$(GIT_TEST_OPTS) --valgrind"
|
2009-02-04 02:26:18 +03:00
|
|
|
|
2012-02-17 14:25:09 +04:00
|
|
|
perf:
|
|
|
|
$(MAKE) -C perf/ all
|
|
|
|
|
|
|
|
# Smoke testing targets
|
|
|
|
-include ../GIT-VERSION-FILE
|
|
|
|
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo unknown')
|
|
|
|
uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo unknown')
|
|
|
|
|
|
|
|
test-results:
|
|
|
|
mkdir -p test-results
|
|
|
|
|
|
|
|
test-results/git-smoke.tar.gz: test-results
|
|
|
|
$(PERL_PATH) ./harness \
|
|
|
|
--archive="test-results/git-smoke.tar.gz" \
|
|
|
|
$(T)
|
|
|
|
|
|
|
|
smoke: test-results/git-smoke.tar.gz
|
|
|
|
|
|
|
|
SMOKE_UPLOAD_FLAGS =
|
|
|
|
ifdef SMOKE_USERNAME
|
|
|
|
SMOKE_UPLOAD_FLAGS += -F username="$(SMOKE_USERNAME)" -F password="$(SMOKE_PASSWORD)"
|
|
|
|
endif
|
|
|
|
ifdef SMOKE_COMMENT
|
|
|
|
SMOKE_UPLOAD_FLAGS += -F comments="$(SMOKE_COMMENT)"
|
|
|
|
endif
|
|
|
|
ifdef SMOKE_TAGS
|
|
|
|
SMOKE_UPLOAD_FLAGS += -F tags="$(SMOKE_TAGS)"
|
|
|
|
endif
|
|
|
|
|
|
|
|
smoke_report: smoke
|
|
|
|
curl \
|
|
|
|
-H "Expect: " \
|
|
|
|
-F project=Git \
|
|
|
|
-F architecture="$(uname_M)" \
|
|
|
|
-F platform="$(uname_S)" \
|
|
|
|
-F revision="$(GIT_VERSION)" \
|
|
|
|
-F report_file=@test-results/git-smoke.tar.gz \
|
|
|
|
$(SMOKE_UPLOAD_FLAGS) \
|
|
|
|
http://smoke.git.nix.is/app/projects/process_add_report/1 \
|
|
|
|
| grep -v ^Redirecting
|
|
|
|
|
|
|
|
.PHONY: pre-clean $(T) aggregate-results clean valgrind perf
|