interplane.Get Omega
Read in your language

git

[Ported from github.com/git/git] Sync with Git 2.56.1

Brought by drakestapleton

branch master Branches Tags History

git / contrib / subtree / t / Makefile

88 lines · 2334 bytes Raw Blame History
1# Run tests
2#
3# Copyright (c) 2005 Junio C Hamano
4#
5
6# The default target of this Makefile is...
7all::
8
9-include ../../../config.mak.autogen
10-include ../../../config.mak
11
12#GIT_TEST_OPTS=--verbose --debug
13SHELL_PATH ?= $(SHELL)
14PERL_PATH ?= /usr/bin/perl
15TAR ?= $(TAR)
16RM ?= rm -f
17PROVE ?= prove
18DEFAULT_TEST_TARGET ?= test
19TEST_LINT ?= test-lint
20
21ifdef TEST_OUTPUT_DIRECTORY
22TEST_RESULTS_DIRECTORY = $(TEST_OUTPUT_DIRECTORY)/test-results
23else
24TEST_RESULTS_DIRECTORY = ../../../t/test-results
25endif
26
27# Shell quote;
28SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
29PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
30TEST_RESULTS_DIRECTORY_SQ = $(subst ','\'',$(TEST_RESULTS_DIRECTORY))
31
32T = $(sort $(wildcard t[0-9][0-9][0-9][0-9]-*.sh))
33TSVN = $(sort $(wildcard t91[0-9][0-9]-*.sh))
34TGITWEB = $(sort $(wildcard t95[0-9][0-9]-*.sh))
35THELPERS = $(sort $(filter-out $(T),$(wildcard *.sh)))
36
37all:: $(DEFAULT_TEST_TARGET)
38
39test: pre-clean $(TEST_LINT)
40 $(MAKE) aggregate-results-and-cleanup
41
42prove: pre-clean $(TEST_LINT)
43 @echo "*** prove ***"; GIT_CONFIG=.git/config $(PROVE) --exec '$(SHELL_PATH_SQ)' $(GIT_PROVE_OPTS) $(T) :: $(GIT_TEST_OPTS)
44 $(MAKE) clean-except-prove-cache
45
46$(T):
47 @echo "*** $@ ***"; GIT_CONFIG=.git/config '$(SHELL_PATH_SQ)' $@ $(GIT_TEST_OPTS)
48
49pre-clean:
50 $(RM) -r '$(TEST_RESULTS_DIRECTORY_SQ)'
51
52clean-except-prove-cache:
53 $(RM) -r 'trash directory'.*
54 $(RM) -r valgrind/bin
55
56clean: clean-except-prove-cache
57 $(RM) -r '$(TEST_RESULTS_DIRECTORY_SQ)'
58 $(RM) .prove
59
60test-lint: test-lint-duplicates test-lint-executable test-lint-shell-syntax
61
62test-lint-duplicates:
63 @dups=`echo $(T) | tr ' ' '\n' | sed 's/-.*//' | sort | uniq -d` && \
64 test -z "$$dups" || { \
65 echo >&2 "duplicate test numbers:" $$dups; exit 1; }
66
67test-lint-executable:
68 @bad=`for i in $(T); do test -x "$$i" || echo $$i; done` && \
69 test -z "$$bad" || { \
70 echo >&2 "non-executable tests:" $$bad; exit 1; }
71
72test-lint-shell-syntax:
73 @'$(PERL_PATH_SQ)' ../../../t/check-non-portable-shell.pl $(T) $(THELPERS)
74
75aggregate-results-and-cleanup: $(T)
76 $(MAKE) aggregate-results
77 $(MAKE) clean
78
79aggregate-results:
80 @'$(SHELL_PATH_SQ)' ../../../t/aggregate-results.sh '$(TEST_RESULTS_DIRECTORY_SQ)'
81
82valgrind:
83 $(MAKE) GIT_TEST_OPTS="$(GIT_TEST_OPTS) --valgrind"
84
85test-results:
86 mkdir -p test-results
87
88.PHONY: pre-clean $(T) aggregate-results clean valgrind