aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-12-13 11:41:20 +0100
committerJunio C Hamano <gitster@pobox.com>2024-12-13 06:48:46 -0800
commit154ce05cce0ae23581fa79fe988521a2d91df134 (patch)
tree48e0eeb0b1c6196b5c50232ff0823e258476e35a
parent0ed15121419e802476c17f904a499c6806acd710 (diff)
downloadgit-154ce05cce0ae23581fa79fe988521a2d91df134.tar.gz
Makefile: detect missing Meson tests
In the preceding commit, we have introduced consistency checks to Meson to detect any discrepancies with missing or extraneous tests in its build instructions. These checks only get executed in Meson though, so any users of our Makefiles wouldn't be alerted of the fact that they have to modify the Meson build instructions in case they add or remove any tests. Add a comparable test target to our Makefile to plug this gap. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--t/Makefile18
1 files changed, 17 insertions, 1 deletions
diff --git a/t/Makefile b/t/Makefile
index 131ffd778f..290fb03ff0 100644
--- a/t/Makefile
+++ b/t/Makefile
@@ -59,7 +59,7 @@ CHAINLINTSUPPRESS = GIT_TEST_EXT_CHAIN_LINT=0 && export GIT_TEST_EXT_CHAIN_LINT
all:: $(DEFAULT_TEST_TARGET)
-test: pre-clean check-chainlint $(TEST_LINT)
+test: pre-clean check-chainlint check-meson $(TEST_LINT)
$(CHAINLINTSUPPRESS) $(MAKE) aggregate-results-and-cleanup
failed:
@@ -114,6 +114,22 @@ check-chainlint:
{ $(CHAINLINT) --emit-all '$(CHAINLINTTMP_SQ)'/tests >'$(CHAINLINTTMP_SQ)'/actual || true; } && \
diff -u '$(CHAINLINTTMP_SQ)'/expect '$(CHAINLINTTMP_SQ)'/actual
+check-meson:
+ @# awk acts up when trying to match single quotes, so we use \047 instead.
+ @printf "%s\n" \
+ "integration_tests t[0-9][0-9][0-9][0-9]-*.sh" \
+ "unit_test_programs unit-tests/t-*.c" \
+ "clar_test_suites unit-tests/u-*.c" | \
+ while read -r variable pattern; do \
+ meson_tests=$$(awk "/^$$variable = \[\$$/ {flag=1 ; next } /^]$$/ { flag=0 } flag { gsub(/^ \047/, \"\"); gsub(/\047,\$$/, \"\"); print }" meson.build) && \
+ actual_tests=$$(ls $$pattern) && \
+ if test "$$meson_tests" != "$$actual_tests"; then \
+ echo "Meson tests differ from actual tests:"; \
+ diff -u <(echo "$$meson_tests") <(echo "$$actual_tests"); \
+ exit 1; \
+ fi; \
+ done
+
test-lint: test-lint-duplicates test-lint-executable test-lint-shell-syntax \
test-lint-filenames
ifneq ($(GIT_TEST_CHAIN_LINT),0)