From: Toon Claes <toon@iotcl.com>
To: Patrick Steinhardt <ps@pks.im>, git@vger.kernel.org
Subject: Re: [PATCH 7/8] t: introduce compatibility options to clar-based tests
Date: Fri, 13 Dec 2024 11:00:57 +0100 [thread overview]
Message-ID: <878qsjj412.fsf@iotcl.com> (raw)
In-Reply-To: <20241211-pks-meson-ci-v1-7-28d18b494374@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
> 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
next prev parent reply other threads:[~2024-12-13 10:01 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-11 10:52 [PATCH 0/8] ci: wire up support for Meson Patrick Steinhardt
2024-12-11 10:52 ` [PATCH 1/8] ci/lib: support custom output directories when creating test artifacts Patrick Steinhardt
2024-12-12 10:16 ` karthik nayak
2024-12-13 5:24 ` Patrick Steinhardt
2024-12-11 10:52 ` [PATCH 2/8] Makefile: drop -DSUPPRESS_ANNOTATED_LEAKS Patrick Steinhardt
2024-12-11 10:52 ` [PATCH 3/8] t/unit-tests: rename clar-based unit tests to have a common prefix Patrick Steinhardt
2024-12-12 10:42 ` karthik nayak
2024-12-13 5:25 ` Patrick Steinhardt
2024-12-11 10:52 ` [PATCH 4/8] meson: detect missing tests at configure time Patrick Steinhardt
2024-12-13 9:58 ` Toon Claes
2024-12-13 10:40 ` Patrick Steinhardt
2024-12-11 10:52 ` [PATCH 5/8] Makefile: detect missing Meson tests Patrick Steinhardt
2024-12-11 10:52 ` [PATCH 6/8] t: fix out-of-tree tests for some git-p4 tests Patrick Steinhardt
2024-12-12 10:53 ` karthik nayak
2024-12-13 5:25 ` Patrick Steinhardt
2024-12-13 10:00 ` Toon Claes
2024-12-13 10:40 ` Patrick Steinhardt
2024-12-11 10:52 ` [PATCH 7/8] t: introduce compatibility options to clar-based tests Patrick Steinhardt
2024-12-13 10:00 ` Toon Claes [this message]
2024-12-11 10:52 ` [PATCH 8/8] ci: wire up Meson builds Patrick Steinhardt
2024-12-13 10:01 ` Toon Claes
2024-12-13 10:40 ` Patrick Steinhardt
2024-12-13 10:41 ` [PATCH v2 0/8] ci: wire up support for Meson Patrick Steinhardt
2024-12-13 10:41 ` [PATCH v2 1/8] ci/lib: support custom output directories when creating test artifacts Patrick Steinhardt
2024-12-13 10:41 ` [PATCH v2 2/8] Makefile: drop -DSUPPRESS_ANNOTATED_LEAKS Patrick Steinhardt
2024-12-13 10:41 ` [PATCH v2 3/8] t/unit-tests: rename clar-based unit tests to have a common prefix Patrick Steinhardt
2024-12-13 10:41 ` [PATCH v2 4/8] meson: detect missing tests at configure time Patrick Steinhardt
2024-12-13 10:41 ` [PATCH v2 5/8] Makefile: detect missing Meson tests Patrick Steinhardt
2024-12-13 10:41 ` [PATCH v2 6/8] t: fix out-of-tree tests for some git-p4 tests Patrick Steinhardt
2024-12-13 10:41 ` [PATCH v2 7/8] t: introduce compatibility options to clar-based tests Patrick Steinhardt
2024-12-13 15:56 ` Junio C Hamano
2024-12-13 10:41 ` [PATCH v2 8/8] ci: wire up Meson builds Patrick Steinhardt
2025-07-16 21:07 ` [PATCH] ci: allow github-actions print test failures again Junio C Hamano
2025-07-17 4:43 ` Patrick Steinhardt
2024-12-16 9:32 ` [PATCH v2 0/8] ci: wire up support for Meson Toon Claes
2024-12-16 16:27 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=878qsjj412.fsf@iotcl.com \
--to=toon@iotcl.com \
--cc=git@vger.kernel.org \
--cc=ps@pks.im \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.