Re: meson missing test dependencies

Nazir Bilal Yavuz <byavuz81@gmail.com>

From: Nazir Bilal Yavuz <byavuz81@gmail.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Peter Eisentraut <peter@eisentraut.org>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2024-12-03T08:52:28Z
Lists: pgsql-hackers
Hi,

On Tue, 3 Dec 2024 at 04:05, Michael Paquier <michael@paquier.xyz> wrote:
>
> On Mon, Dec 02, 2024 at 01:50:57PM +0300, Nazir Bilal Yavuz wrote:
> > On Mon, 2 Dec 2024 at 13:11, Peter Eisentraut <peter@eisentraut.org> wrote:
> >> Is there any reason this was not done yet?
> >
> > This looks useful. I am not sure why this was not done before.
>
> Do you think that it would be possible to automate the addition of the
> dependency link between the module and the tests in some way?  The
> most common case where the only dependency needed by the test is the
> module itself would cover a lot of ground if this could be enforced in
> some fashion.

I tried something like:

diff --git a/meson.build b/meson.build
index 451c3f6d851..ddf6045d472 100644
--- a/meson.build
+++ b/meson.build
@@ -3366,6 +3366,13 @@ foreach test_dir : tests

     t = test_dir[kind]

+    t_dep = [get_variable(test_dir['name'], '')]
+    message('Adding test = @0@ and dep = @1@'.format(test_dir['name'], t_dep))
+    if t_dep != ['']
+      t += {'deps': t_dep}
+    endif
+

The code above creates a dependency between the module (*whose name is
same with the test*) and the test. This errors out for the 'libpq,
ssl, ldap and icu' because the type of these variables is dependency;
but test.depends can be one of the '[BuildTarget | CustomTarget |
CustomTargetIndex]' types, it can not be a dependency type.

And this can not create a link for the 'scripts, regress, isolation,
authentication, postmaster, recovery, subscription, brin, commit_ts,
gin, test_extensions, test_json_parser, test_misc, test_pg_dump,
typcache, unsafe_tests, worker_spi, kerberos and ecpg' tests. I think
only 'regress, isolation, test_json_parser, worker_spi and ecpg' are
wrong in this list as their modules names are not the same with their
tests.

-- 
Regards,
Nazir Bilal Yavuz
Microsoft



Commits

  1. oauth: Correct test dependency on oauth_hook_client

  2. meson: Add missing dependencies for libpq tests

  3. meson: Add missing dependencies to libpq_pipeline test

  4. meson: Add pg_regress_ecpg to ecpg test dependencies

  5. meson: Add test dependencies for test_json_parser

  6. meson: Improve dependencies for tmp_install test target

  7. meson: Narrow dependencies for 'install-quiet' target