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

Re: [PATCH 7/8] t: introduce compatibility options to clar-based tests

From
Toon Claes <toon@iotcl.com>
Date
Dec 13, 2024, 10:00 UTC
Message-ID
<878qsjj412.fsf@iotcl.com>
In-Reply-To
<20241211-pks-meson-ci-v1-7-28d18b494374@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
Show 50 quoted lines
> Our unit tests that don't yet use the clar unit testing framework ignore
> any option that they do not understand. It is thus fine to just pass
> test options we set up globally to those unit tests as they are simply
> ignored. This makes our life easier because we don't have to special
> case those options with Meson, where test options are set up globally
> via `meson test --test-args=`.
>
> But our clar-based unit testing framework is way stricter here and will
> fail in case it is passed an unknown option. Stub out these options with
> no-ops to make our life a bit easier.
>
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
>  parse-options.h          | 12 ++++++++++++
>  t/unit-tests/unit-test.c | 19 ++++++++++++++++++-
>  2 files changed, 30 insertions(+), 1 deletion(-)
>
> diff --git a/parse-options.h b/parse-options.h
> index f0801d4532a175b65783689f2a68fb56da2c8e87..d01361ca97fd7227a0005b5c447d954fea472ca0 100644
> --- a/parse-options.h
> +++ b/parse-options.h
> @@ -353,6 +353,18 @@ struct option {
>  	.callback = parse_opt_noop_cb, \
>  }
>  
> +static char *parse_options_noop_ignored_value MAYBE_UNUSED;
> +#define OPT_NOOP_ARG(s, l) { \
> +	.type = OPTION_CALLBACK, \
> +	.short_name = (s), \
> +	.long_name = (l), \
> +	.value = &parse_options_noop_ignored_value, \
> +	.argh = "ignored", \
> +	.help = N_("no-op (backward compatibility)"), \
> +	.flags = PARSE_OPT_HIDDEN, \
> +	.callback = parse_opt_noop_cb, \
> +}
> +
>  #define OPT_ALIAS(s, l, source_long_name) { \
>  	.type = OPTION_ALIAS, \
>  	.short_name = (s), \
> diff --git a/t/unit-tests/unit-test.c b/t/unit-tests/unit-test.c
> index a474cdcfd351d9d624178a769329252237f951b7..fa8818842a42478c7a8fa6f6ecbee0777bdf472f 100644
> --- a/t/unit-tests/unit-test.c
> +++ b/t/unit-tests/unit-test.c
> @@ -18,8 +18,25 @@ int cmd_main(int argc, const char **argv)
>  			 N_("immediately exit upon the first failed test")),
>  		OPT_STRING_LIST('r', "run", &run_args, N_("suite[::test]"),
>  				N_("run only test suite or individual test <suite[::test]>")),
> -		OPT_STRING_LIST('x', "exclude", &exclude_args, N_("suite"),
> +		OPT_STRING_LIST(0, "exclude", &exclude_args, N_("suite"),

Could you please explain in the commit message why it's safe to unassign `-x` from `--exclude`?

-- 
Toon
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 19 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.