Makefile: stop requiring Perl when running tests

The Makefile for our tests has a couple of targets that depend on Perl. Adapt those targets to only run conditionally in case Perl is available on the system so that it becomes possible to run the test suite without Perl. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Patrick Steinhardt committed Apr 3, 2025 at 07:06 UTC 8d531a9d18d658f696de5a71458e832317b7ca5a
1 file changed +13 -3
t/Makefile
+13 -3
@@ -59,16 +59,21 @@ CHAINLINTSUPPRESS = GIT_TEST_EXT_CHAIN_LINT=0 && export GIT_TEST_EXT_CHAIN_LINT
59
60 all:: $(DEFAULT_TEST_TARGET)
61
62 -test: pre-clean check-chainlint check-meson $(TEST_LINT)
62 +test: pre-clean check-meson $(TEST_LINT)
63 $(CHAINLINTSUPPRESS) $(MAKE) aggregate-results-and-cleanup
64
65 +ifneq ($(PERL_PATH),)
66 +test: check-chainlint
67 +prove: check-chainlint
68 +endif
69 +
70 failed:
71 @failed=$$(cd '$(TEST_RESULTS_DIRECTORY_SQ)' && \
72 grep -l '^failed [1-9]' *.counts | \
73 sed -n 's/\.counts$$/.sh/p') && \
74 test -z "$$failed" || $(MAKE) $$failed
75
71 -prove: pre-clean check-chainlint $(TEST_LINT)
76 +prove: pre-clean $(TEST_LINT)
77 @echo "*** prove (shell & unit tests) ***"
78 @$(CHAINLINTSUPPRESS) TEST_OPTIONS='$(GIT_TEST_OPTS)' TEST_SHELL_PATH='$(TEST_SHELL_PATH_SQ)' $(PROVE) --exec ./run-test.sh $(GIT_PROVE_OPTS) $(T) $(UNIT_TESTS)
79 $(MAKE) clean-except-prove-cache
@@ -132,8 +137,13 @@ check-meson:
137 fi; \
138 done
139
135 -test-lint: test-lint-duplicates test-lint-executable test-lint-shell-syntax \
140 +test-lint: test-lint-duplicates test-lint-executable \
141 test-lint-filenames
142 +ifneq ($(PERL_PATH),)
143 +test-lint: test-lint-shell-syntax
144 +else
145 +GIT_TEST_CHAIN_LINT = 0
146 +endif
147 ifneq ($(GIT_TEST_CHAIN_LINT),0)
148 test-lint: test-chainlint
149 endif