Hi, On Tue, 3 Dec 2024 at 04:05, Michael Paquier <mich...@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 <pe...@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