From: Patrick Steinhardt <ps@pks.im>
To: Toon Claes <toon@iotcl.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 4/8] meson: detect missing tests at configure time
Date: Fri, 13 Dec 2024 11:40:11 +0100 [thread overview]
Message-ID: <Z1wPC1vSlqgWeFis@pks.im> (raw)
In-Reply-To: <87bjxfj44o.fsf@iotcl.com>
On Fri, Dec 13, 2024 at 10:58:47AM +0100, Toon Claes wrote:
> Patrick Steinhardt <ps@pks.im> writes:
> > diff --git a/t/meson.build b/t/meson.build
> > index 9e676e69363ed6311426500d98fe281e30d26bcb..f1fbc6ae179079f4d5d86f9a60956fad84d0495c 100644
> > --- a/t/meson.build
> > +++ b/t/meson.build
> > @@ -1092,6 +1092,42 @@ integration_tests = [
> > 't9903-bash-prompt.sh',
> > ]
> >
> > +# Sanity check that we are not missing any tests present in 't/'. This check
> > +# only runs once at configure time and is thus best-effort, only. It is
> > +# sufficient to catch missing test suites in our CI though.
> > +foreach glob, tests : {
> > + 't[0-9][0-9][0-9][0-9]-*.sh': integration_tests,
> > + 'unit-tests/t-*.c': unit_test_programs,
> > + 'unit-tests/u-*.c': clar_test_suites,
> > +}
> > + actual_tests = run_command(shell, '-c', 'ls ' + glob,
> > + check: true,
> > + env: script_environment,
> > + ).stdout().strip().split('\n')
> > +
> > + if tests != actual_tests
> > + missing_tests = [ ]
> > + foreach actual_test : actual_tests
> > + if actual_test not in tests
> > + missing_tests += actual_test
> > + endif
> > + endforeach
> > + if missing_tests.length() > 0
> > + error('Missing tests:\n\n - ' + '\n - '.join(missing_tests))
>
> This gives nice output:
>
> $ touch t/unit-tests/u-bar.c t/unit-tests/u-foo.c
>
> $ meson setup builddir --reconfigure
>
> The Meson build system
> Version: 1.4.1
> [snip]
> Configuring update.sample using configuration
> Configuring exclude using configuration
>
> t/meson.build:1116:6: ERROR: Problem encountered: Missing tests:
>
> - unit-tests/u-bar.c
> - unit-tests/u-foo.c
>
> A full log can be found at git/builddir/meson-logs/meson-log.txt
>
> But I think the error message is a little bit confusing. It sounds like
> the test file is missing, but it's the configuration of the test that is
> missing.
>
> Now I've realized it hard to write a good error message here. But I
> would suggest something like "Tests files found, but not configured".
>
> > + endif
> > +
> > + superfluous_tests = [ ]
> > + foreach integration_test : tests
> > + if integration_test not in actual_tests
> > + superfluous_tests += integration_test
> > + endif
> > + endforeach
> > + if superfluous_tests.length() > 0
> > + error('Superfluous tests:\n\n - ' + '\n - '.join(superfluous_tests))
>
> Also here I would suggest different error message, maybe something like
> "Tests configured, but file not found"
Both good suggestions, thanks!
Patrick
next prev parent reply other threads:[~2024-12-13 10:40 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 [this message]
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
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=Z1wPC1vSlqgWeFis@pks.im \
--to=ps@pks.im \
--cc=git@vger.kernel.org \
--cc=toon@iotcl.com \
/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.