Skip to content

Commit 28d836c

Browse files
Michael J Grubergitster
authored andcommitted
test: allow running the tests under "prove"
You can run "make DEFAULT_TEST_TARGET=prove test" to run the test under "prove" (or $(PROVE) if set). The output is a bit easier to read when running many tests in parallel. Signed-off-by: Michael J Gruber <[email protected]> Liked-by: Ævar Arnfjörð Bjarmason <[email protected]> Liked-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d4c4369 commit 28d836c

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

t/Makefile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,24 @@ SHELL_PATH ?= $(SHELL)
1111
PERL_PATH ?= /usr/bin/perl
1212
TAR ?= $(TAR)
1313
RM ?= rm -f
14+
PROVE ?= prove
15+
DEFAULT_TEST_TARGET ?= test
1416

1517
# Shell quote;
1618
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
1719

1820
T = $(wildcard t[0-9][0-9][0-9][0-9]-*.sh)
1921
TSVN = $(wildcard t91[0-9][0-9]-*.sh)
2022

21-
all: pre-clean
23+
all: $(DEFAULT_TEST_TARGET)
24+
25+
test: pre-clean
2226
$(MAKE) aggregate-results-and-cleanup
2327

28+
prove: pre-clean
29+
@echo "*** prove ***"; GIT_CONFIG=.git/config $(PROVE) --exec '$(SHELL_PATH_SQ)' $(GIT_PROVE_OPTS) $(T) :: $(GIT_TEST_OPTS)
30+
$(MAKE) clean
31+
2432
$(T):
2533
@echo "*** $@ ***"; GIT_CONFIG=.git/config '$(SHELL_PATH_SQ)' $@ $(GIT_TEST_OPTS)
2634

t/README

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ prove and other harnesses come with a lot of useful options. The
5050
# Repeat until no more failures
5151
$ prove -j 15 --state=failed,save ./t[0-9]*.sh
5252

53+
You can give DEFAULT_TEST_TARGET=prove on the make command (or define it
54+
in config.mak) to cause "make test" to run tests under prove.
55+
GIT_PROVE_OPTS can be used to pass additional options, e.g.
56+
57+
$ make DEFAULT_TEST_TARGET=prove GIT_PROVE_OPTS='--timer --jobs 16' test
58+
5359
You can also run each test individually from command line, like this:
5460

5561
$ sh ./t3010-ls-files-killed-modified.sh

0 commit comments

Comments
 (0)