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

[PATCH 3/8] t/unit-tests: rename clar-based unit tests to have a common prefix

From
Patrick Steinhardt <ps@pks.im>
Date
Dec 11, 2024, 10:52 UTC
Message-ID
<20241211-pks-meson-ci-v1-3-28d18b494374@pks.im>
In-Reply-To
<20241211-pks-meson-ci-v1-0-28d18b494374@pks.im>

All of the code files for unit tests using the self-grown unit testing framework have have a "t-" prefix to their name. This makes it easy to identify them and use globbing in our Makefile and in other places. On the other hand though, our clar-based unit tests have no prefix at all and thus cannot easily be discerned from other files in the unit test directory.

Introduce a new "u-" prefix for clar-based unit tests. This prefix will be used in a subsequent commit to easily identify such tests.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 Makefile                              | 4 ++--
 t/meson.build                         | 4 ++--
 t/unit-tests/generate-clar-decls.sh   | 5 ++++-
 t/unit-tests/{ctype.c => u-ctype.c}   | 0
 t/unit-tests/{strvec.c => u-strvec.c} | 0
 5 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/Makefile b/Makefile
index 2506f3b7e3377ab1a376338c86a727b2ae92a6e9..6eafaf174aaa380ad8e6a86f75d003eb6c058fb3 100644
--- a/Makefile
+++ b/Makefile
@@ -1344,8 +1344,8 @@ THIRD_PARTY_SOURCES += sha1dc/%
 THIRD_PARTY_SOURCES += $(UNIT_TEST_DIR)/clar/%
 THIRD_PARTY_SOURCES += $(UNIT_TEST_DIR)/clar/clar/%
 
-CLAR_TEST_SUITES += ctype
-CLAR_TEST_SUITES += strvec
+CLAR_TEST_SUITES += u-ctype
+CLAR_TEST_SUITES += u-strvec
 CLAR_TEST_PROG = $(UNIT_TEST_BIN)/unit-tests$(X)
 CLAR_TEST_OBJS = $(patsubst %,$(UNIT_TEST_DIR)/%.o,$(CLAR_TEST_SUITES))
 CLAR_TEST_OBJS += $(UNIT_TEST_DIR)/clar/clar.o
diff --git a/t/meson.build b/t/meson.build
index 13fe854ba0a18f9b83dbc48651f581198042ffd3..9e676e69363ed6311426500d98fe281e30d26bcb 100644
--- a/t/meson.build
+++ b/t/meson.build
@@ -1,6 +1,6 @@
 clar_test_suites = [
-  'unit-tests/ctype.c',
-  'unit-tests/strvec.c',
+  'unit-tests/u-ctype.c',
+  'unit-tests/u-strvec.c',
 ]
 
 clar_sources = [
diff --git a/t/unit-tests/generate-clar-decls.sh b/t/unit-tests/generate-clar-decls.sh
index 688e0885f4f28182c3afe19c067b6d59dcacccfc..3b315c64b3711bfccc5941852a0782e02cee82f0 100755
--- a/t/unit-tests/generate-clar-decls.sh
+++ b/t/unit-tests/generate-clar-decls.sh
@@ -11,6 +11,9 @@ shift
 
 for suite in "$@"
 do
-	sed -ne "s/^\(void test_$(basename "${suite%.c}")__[a-zA-Z_0-9][a-zA-Z_0-9]*(void)\)$/extern \1;/p" "$suite" ||
+	suite_name=$(basename "$suite")
+	suite_name=${suite_name%.c}
+	suite_name=${suite_name#u-}
+	sed -ne "s/^\(void test_${suite_name}__[a-zA-Z_0-9][a-zA-Z_0-9]*(void)\)$/extern \1;/p" "$suite" ||
 	exit 1
 done >"$OUTPUT"
diff --git a/t/unit-tests/ctype.c b/t/unit-tests/u-ctype.c
similarity index 100%
rename from t/unit-tests/ctype.c
rename to t/unit-tests/u-ctype.c
diff --git a/t/unit-tests/strvec.c b/t/unit-tests/u-strvec.c
similarity index 100%
rename from t/unit-tests/strvec.c
rename to t/unit-tests/u-strvec.c
-- 
2.47.1.447.ga7e8429e30.dirty
Previous: Patrick SteinhardtNext: karthik nayak
Message 9 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.