2012-02-05 23:29:06 +01:00
|
|
|
# Run tests
|
|
|
|
#
|
|
|
|
# Copyright (c) 2005 Junio C Hamano
|
|
|
|
#
|
|
|
|
|
|
|
|
-include ../../../config.mak.autogen
|
|
|
|
-include ../../../config.mak
|
|
|
|
|
|
|
|
#GIT_TEST_OPTS=--verbose --debug
|
|
|
|
SHELL_PATH ?= $(SHELL)
|
|
|
|
PERL_PATH ?= /usr/bin/perl
|
|
|
|
TAR ?= $(TAR)
|
|
|
|
RM ?= rm -f
|
|
|
|
PROVE ?= prove
|
|
|
|
DEFAULT_TEST_TARGET ?= test
|
2015-11-13 03:32:30 +01:00
|
|
|
TEST_LINT ?= test-lint
|
|
|
|
|
|
|
|
ifdef TEST_OUTPUT_DIRECTORY
|
|
|
|
TEST_RESULTS_DIRECTORY = $(TEST_OUTPUT_DIRECTORY)/test-results
|
|
|
|
else
|
|
|
|
TEST_RESULTS_DIRECTORY = ../../../t/test-results
|
|
|
|
endif
|
2012-02-05 23:29:06 +01:00
|
|
|
|
|
|
|
# Shell quote;
|
|
|
|
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
|
2015-11-13 03:32:30 +01:00
|
|
|
PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
|
|
|
|
TEST_RESULTS_DIRECTORY_SQ = $(subst ','\'',$(TEST_RESULTS_DIRECTORY))
|
2012-02-05 23:29:06 +01:00
|
|
|
|
2015-11-13 03:32:30 +01: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))
|
|
|
|
THELPERS = $(sort $(filter-out $(T),$(wildcard *.sh)))
|
2012-02-05 23:29:06 +01:00
|
|
|
|
|
|
|
all: $(DEFAULT_TEST_TARGET)
|
|
|
|
|
|
|
|
test: pre-clean $(TEST_LINT)
|
|
|
|
$(MAKE) aggregate-results-and-cleanup
|
|
|
|
|
|
|
|
prove: pre-clean $(TEST_LINT)
|
|
|
|
@echo "*** prove ***"; GIT_CONFIG=.git/config $(PROVE) --exec '$(SHELL_PATH_SQ)' $(GIT_PROVE_OPTS) $(T) :: $(GIT_TEST_OPTS)
|
2015-11-13 03:32:30 +01:00
|
|
|
$(MAKE) clean-except-prove-cache
|
2012-02-05 23:29:06 +01:00
|
|
|
|
|
|
|
$(T):
|
|
|
|
@echo "*** $@ ***"; GIT_CONFIG=.git/config '$(SHELL_PATH_SQ)' $@ $(GIT_TEST_OPTS)
|
|
|
|
|
|
|
|
pre-clean:
|
2015-11-13 03:32:30 +01:00
|
|
|
$(RM) -r '$(TEST_RESULTS_DIRECTORY_SQ)'
|
2012-02-05 23:29:06 +01:00
|
|
|
|
2015-11-13 03:32:30 +01:00
|
|
|
clean-except-prove-cache:
|
t/Makefile: don't remove test-results in "clean-except-prove-cache"
When "make test" is run with the default of "DEFAULT_TEST_TARGET=test"
we'll leave the "test-results" directory in-place, but don't do so for
the "prove" target.
The reason for this is that when 28d836c8158 (test: allow running the
tests under "prove", 2010-10-14) allowed for running the tests under
"prove" there was no point in leaving the "test-results" in place.
The "prove" target provides its own summary, so we don't need to run
"aggregate-results", which is the reason we have "test-results" in the
first place. See 2d84e9fb6d2 (Modify test-lib.sh to output stats to
t/test-results/*, 2008-06-08).
But in a subsequent commit test-lib.sh will start emitting reports of
memory leaks in test-results/*, and it will be useful to analyze these
after the fact.
This wouldn't be a problem as failing tests will halt the removal of
the files (we'll never reach "clean-except-prove-cache" from the
"prove" target), but will be subsequently as we'll want to report a
successful run, but might still have e.g. logs of known memory leaks
in test-results/*.
So let's stop removing this, it's sufficient that "make clean" removes
it, and that "pre-clean" (which both "test" and "prove" depend on)
will remove it, i.e. we'll never have a stale "test-results" because
of this change.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-07-28 01:13:35 +02:00
|
|
|
$(RM) -r 'trash directory'.*
|
2012-02-05 23:29:06 +01:00
|
|
|
$(RM) -r valgrind/bin
|
2015-11-13 03:32:30 +01:00
|
|
|
|
|
|
|
clean: clean-except-prove-cache
|
2012-02-05 23:29:06 +01:00
|
|
|
$(RM) .prove
|
|
|
|
|
2015-11-13 03:32:30 +01:00
|
|
|
test-lint: test-lint-duplicates test-lint-executable test-lint-shell-syntax
|
2012-02-05 23:29:06 +01:00
|
|
|
|
|
|
|
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; }
|
|
|
|
|
2015-11-13 03:32:30 +01:00
|
|
|
test-lint-shell-syntax:
|
|
|
|
@'$(PERL_PATH_SQ)' ../../../t/check-non-portable-shell.pl $(T) $(THELPERS)
|
|
|
|
|
2012-02-05 23:29:06 +01:00
|
|
|
aggregate-results-and-cleanup: $(T)
|
|
|
|
$(MAKE) aggregate-results
|
|
|
|
$(MAKE) clean
|
|
|
|
|
|
|
|
aggregate-results:
|
2015-11-13 03:32:30 +01:00
|
|
|
for f in '$(TEST_RESULTS_DIRECTORY_SQ)'/t*-*.counts; do \
|
2012-02-05 23:29:06 +01:00
|
|
|
echo "$$f"; \
|
|
|
|
done | '$(SHELL_PATH_SQ)' ../../../t/aggregate-results.sh
|
|
|
|
|
|
|
|
valgrind:
|
|
|
|
$(MAKE) GIT_TEST_OPTS="$(GIT_TEST_OPTS) --valgrind"
|
|
|
|
|
|
|
|
test-results:
|
|
|
|
mkdir -p test-results
|
|
|
|
|
|
|
|
.PHONY: pre-clean $(T) aggregate-results clean valgrind
|