git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 5/8] Makefile: detect missing Meson tests

From
Patrick Steinhardt <ps@pks.im>
Date
Dec 13, 2024, 10:41 UTC
Message-ID
<20241213-pks-meson-ci-v2-5-634affccc694@pks.im>
In-Reply-To
<20241213-pks-meson-ci-v2-0-634affccc694@pks.im>

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>
---
 t/Makefile | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/t/Makefile b/t/Makefile
index 131ffd778fe00864fae1f5750269615556c6cdea..290fb03ff011d39c31c5073c796aa6f4dc966283 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)
-- 
2.47.1.668.gf74b3f243a.dirty
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 28 of 36 in “ci: wire up support for Meson”
  1. 0/8 ci: wire up support for MesonPatrick Steinhardt, Dec 11, 2024
  2. 1/8 ci/lib: support custom output directories when creating test artifactsPatrick Steinhardt, Dec 11, 2024
  3. karthik nayakDec 12, 2024
  4. Patrick SteinhardtDec 13, 2024
  5. 2/8 Makefile: drop -DSUPPRESS_ANNOTATED_LEAKSPatrick Steinhardt, Dec 11, 2024
  6. 4/8 meson: detect missing tests at configure timePatrick Steinhardt, Dec 11, 2024
  7. Toon ClaesDec 13, 2024
  8. Patrick SteinhardtDec 13, 2024
  9. 3/8 t/unit-tests: rename clar-based unit tests to have a common prefixPatrick Steinhardt, Dec 11, 2024
  10. karthik nayakDec 12, 2024
  11. Patrick SteinhardtDec 13, 2024
  12. 5/8 Makefile: detect missing Meson testsPatrick Steinhardt, Dec 11, 2024
  13. 6/8 t: fix out-of-tree tests for some git-p4 testsPatrick Steinhardt, Dec 11, 2024
  14. karthik nayakDec 12, 2024
  15. Patrick SteinhardtDec 13, 2024
  16. Toon ClaesDec 13, 2024
  17. Patrick SteinhardtDec 13, 2024
  18. 7/8 t: introduce compatibility options to clar-based testsPatrick Steinhardt, Dec 11, 2024
  19. Toon ClaesDec 13, 2024
  20. 8/8 ci: wire up Meson buildsPatrick Steinhardt, Dec 11, 2024
  21. Toon ClaesDec 13, 2024
  22. Patrick SteinhardtDec 13, 2024
  23. 0/8 ci: wire up support for MesonPatrick Steinhardt, Dec 13, 2024
  24. 1/8 ci/lib: support custom output directories when creating test artifactsPatrick Steinhardt, Dec 13, 2024
  25. 2/8 Makefile: drop -DSUPPRESS_ANNOTATED_LEAKSPatrick Steinhardt, Dec 13, 2024
  26. 3/8 t/unit-tests: rename clar-based unit tests to have a common prefixPatrick Steinhardt, Dec 13, 2024
  27. 4/8 meson: detect missing tests at configure timePatrick Steinhardt, Dec 13, 2024
  28. 5/8 Makefile: detect missing Meson testsPatrick Steinhardt, Dec 13, 2024
  29. 6/8 t: fix out-of-tree tests for some git-p4 testsPatrick Steinhardt, Dec 13, 2024
  30. 7/8 t: introduce compatibility options to clar-based testsPatrick Steinhardt, Dec 13, 2024
  31. Junio C HamanoDec 13, 2024
  32. 8/8 ci: wire up Meson buildsPatrick Steinhardt, Dec 13, 2024
  33. ci: allow github-actions print test failures againJunio C Hamano, Jul 16, 2025
  34. Patrick SteinhardtJul 17, 2025
  35. Toon ClaesDec 16, 2024
  36. Junio C HamanoDec 16, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.