]> git.ipfire.org Git - thirdparty/git.git/blame - contrib/scalar/t/Makefile
clone: allow "--bare" with "-o"
[thirdparty/git.git] / contrib / scalar / t / Makefile
CommitLineData
8df786d2
ÆAB
1# Import tree-wide shared Makefile behavior and libraries
2include ../../../shared.mak
3
9187659f
JS
4# Run scalar tests
5#
6# Copyright (c) 2005,2021 Junio C Hamano, Johannes Schindelin
7#
8
9-include ../../../config.mak.autogen
10-include ../../../config.mak
11
12SHELL_PATH ?= $(SHELL)
13PERL_PATH ?= /usr/bin/perl
14RM ?= rm -f
15PROVE ?= prove
16DEFAULT_TEST_TARGET ?= test
17TEST_LINT ?= test-lint
18
19ifdef TEST_OUTPUT_DIRECTORY
20TEST_RESULTS_DIRECTORY = $(TEST_OUTPUT_DIRECTORY)/test-results
21else
22TEST_RESULTS_DIRECTORY = ../../../t/test-results
23endif
24
25# Shell quote;
26SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
27PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
28TEST_RESULTS_DIRECTORY_SQ = $(subst ','\'',$(TEST_RESULTS_DIRECTORY))
29
30T = $(sort $(wildcard t[0-9][0-9][0-9][0-9]-*.sh))
31
32all: $(DEFAULT_TEST_TARGET)
33
34test: $(TEST_LINT)
35 $(MAKE) aggregate-results-and-cleanup
36
37prove: $(TEST_LINT)
38 @echo "*** prove ***"; GIT_CONFIG=.git/config $(PROVE) --exec '$(SHELL_PATH_SQ)' $(GIT_PROVE_OPTS) $(T) :: $(GIT_TEST_OPTS)
39 $(MAKE) clean-except-prove-cache
40
41$(T):
42 @echo "*** $@ ***"; GIT_CONFIG=.git/config '$(SHELL_PATH_SQ)' $@ $(GIT_TEST_OPTS)
43
44clean-except-prove-cache:
45 $(RM) -r 'trash directory'.* '$(TEST_RESULTS_DIRECTORY_SQ)'
46 $(RM) -r valgrind/bin
47
48clean: clean-except-prove-cache
49 $(RM) .prove
50
51test-lint: test-lint-duplicates test-lint-executable test-lint-shell-syntax
52
53test-lint-duplicates:
54 @dups=`echo $(T) | tr ' ' '\n' | sed 's/-.*//' | sort | uniq -d` && \
55 test -z "$$dups" || { \
56 echo >&2 "duplicate test numbers:" $$dups; exit 1; }
57
58test-lint-executable:
59 @bad=`for i in $(T); do test -x "$$i" || echo $$i; done` && \
60 test -z "$$bad" || { \
61 echo >&2 "non-executable tests:" $$bad; exit 1; }
62
63test-lint-shell-syntax:
64 @'$(PERL_PATH_SQ)' ../../../t/check-non-portable-shell.pl $(T)
65
66aggregate-results-and-cleanup: $(T)
67 $(MAKE) aggregate-results
68 $(MAKE) clean
69
70aggregate-results:
71 for f in '$(TEST_RESULTS_DIRECTORY_SQ)'/t*-*.counts; do \
72 echo "$$f"; \
73 done | '$(SHELL_PATH_SQ)' ../../../t/aggregate-results.sh
74
75valgrind:
76 $(MAKE) GIT_TEST_OPTS="$(GIT_TEST_OPTS) --valgrind"
77
78test-results:
79 mkdir -p test-results
80
81.PHONY: $(T) aggregate-results clean valgrind