Re: meson missing test dependencies

Peter Eisentraut <peter@eisentraut.org>

From: Peter Eisentraut <peter@eisentraut.org>
To: Andres Freund <andres@anarazel.de>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>, Nazir Bilal Yavuz <byavuz81@gmail.com>
Date: 2024-12-05T19:08:24Z
Lists: pgsql-hackers
On 03.12.24 17:01, Andres Freund wrote:
> Hi,
> 
> On 2024-12-02 11:10:56 +0100, Peter Eisentraut wrote:
>> I have noticed that under meson many tests don't have dependencies on the
>> build artifacts that they are testing.  As an example among many, if you
>> make a source code change in contrib/cube/cube.c (see patch 0001 for a demo)
>> and then run
>>
>>      make -C contrib/cube check
>>
>> the test run will reflect the changed code, because the "check" targets
>> typically depend on the "all" targets.  But if you do this under meson with
>>
>>      meson test -C build --suite setup --suite cube
>>
>> the code will not be rebuilt first, and the test run will not reflect the
>> changed code.
> 
> That's unfortunately a very partial fix - because we insist on tests being run
> against a temporary install, we don't just need to rebuild the code, we also
> need to re-install it.  Without that you don't, e.g., see server changes.

Right, I was willing to accept that as a compromise, but see below.

> However, it looks like the tmp_install test *does* miss dependencies too and I
> see no reason to not fix that.

> diff --git i/meson.build w/meson.build
> index ff3848b1d85..55b751a0c6b 100644
> --- i/meson.build
> +++ w/meson.build
> @@ -3263,6 +3263,7 @@ test('tmp_install',
>       priority: setup_tests_priority,
>       timeout: 300,
>       is_parallel: false,
> +    depends: all_built,
>       suite: ['setup'])
> 
>   test('install_test_files',

Yes, that addresses my cube example.

But it doesn't address the test_json_parser example, because in that 
case the test executables are not installed.  So in that case we still 
need to manually add the dependencies.  But those are only a few cases 
(maybe just test_json_parser and libpq_pipeline).




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