Skip to content

Commit c3d884a

Browse files
committed
Add subtree test Makefile
Add a Makefile to run subtree tests. This is largely copied from the standard test suite with irrelevant targets removed and some paths altered to account for where subtree tests live. Signed-off-by: David A. Greene <[email protected]>
1 parent 7ff8463 commit c3d884a

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

contrib/subtree/t/Makefile

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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
10+
SHELL_PATH ?= $(SHELL)
11+
PERL_PATH ?= /usr/bin/perl
12+
TAR ?= $(TAR)
13+
RM ?= rm -f
14+
PROVE ?= prove
15+
DEFAULT_TEST_TARGET ?= test
16+
17+
# Shell quote;
18+
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
19+
20+
T = $(wildcard t[0-9][0-9][0-9][0-9]-*.sh)
21+
22+
all: $(DEFAULT_TEST_TARGET)
23+
24+
test: pre-clean $(TEST_LINT)
25+
$(MAKE) aggregate-results-and-cleanup
26+
27+
prove: pre-clean $(TEST_LINT)
28+
@echo "*** prove ***"; GIT_CONFIG=.git/config $(PROVE) --exec '$(SHELL_PATH_SQ)' $(GIT_PROVE_OPTS) $(T) :: $(GIT_TEST_OPTS)
29+
$(MAKE) clean
30+
31+
$(T):
32+
@echo "*** $@ ***"; GIT_CONFIG=.git/config '$(SHELL_PATH_SQ)' $@ $(GIT_TEST_OPTS)
33+
34+
pre-clean:
35+
$(RM) -r test-results
36+
37+
clean:
38+
$(RM) -r 'trash directory'.* test-results
39+
$(RM) -r valgrind/bin
40+
$(RM) .prove
41+
42+
test-lint: test-lint-duplicates test-lint-executable
43+
44+
test-lint-duplicates:
45+
@dups=`echo $(T) | tr ' ' '\n' | sed 's/-.*//' | sort | uniq -d` && \
46+
test -z "$$dups" || { \
47+
echo >&2 "duplicate test numbers:" $$dups; exit 1; }
48+
49+
test-lint-executable:
50+
@bad=`for i in $(T); do test -x "$$i" || echo $$i; done` && \
51+
test -z "$$bad" || { \
52+
echo >&2 "non-executable tests:" $$bad; exit 1; }
53+
54+
aggregate-results-and-cleanup: $(T)
55+
$(MAKE) aggregate-results
56+
$(MAKE) clean
57+
58+
aggregate-results:
59+
for f in ../../../t/test-results/t*-*.counts; do \
60+
echo "$$f"; \
61+
done | '$(SHELL_PATH_SQ)' ../../../t/aggregate-results.sh
62+
63+
valgrind:
64+
$(MAKE) GIT_TEST_OPTS="$(GIT_TEST_OPTS) --valgrind"
65+
66+
test-results:
67+
mkdir -p test-results
68+
69+
.PHONY: pre-clean $(T) aggregate-results clean valgrind

0 commit comments

Comments
 (0)