Re: meson missing test dependencies

From: Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Peter Eisentraut <peter(at)eisentraut(dot)org>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: meson missing test dependencies
Date: 2024-12-03 08:52:28
Message-ID: CAN55FZ0DXgaS3vVy5NT0c+bVrx-FH1ezUfaxZ4DrM9YJXFZJGg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Tue, 3 Dec 2024 at 04:05, Michael Paquier <michael(at)paquier(dot)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(at)eisentraut(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andreas Karlsson 2024-12-03 08:52:43 Re: INSERT ... ON CONFLICT DO SELECT [FOR ...] take 2
Previous Message Zhijie Hou (Fujitsu) 2024-12-03 08:36:42 RE: Memory leak in WAL sender with pgoutput (v10~)