Re: Fix some memory leaks in ecpg.addons - Mailing list pgsql-hackers

From Tristan Partin
Subject Re: Fix some memory leaks in ecpg.addons
Date
Msg-id CWZB1U4JGPRM.19VFDHZCRL50D@neon.tech
Whole thread Raw
In response to Re: Fix some memory leaks in ecpg.addons  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Wed Nov 8, 2023 at 11:52 AM CST, Tom Lane wrote:
> "Tristan Partin" <tristan@neon.tech> writes:
> > On Wed Nov 8, 2023 at 11:18 AM CST, Michael Meskes wrote:
> >> Agreed, it's not exactly uncommon for tools like ecpg to not worry
> >> about memory. After all it gets freed when the program ends.
>
> > In the default configuration of AddressSanitizer, I can't even complete
> > a full build of Postgres.
>
> Why is the meson stuff building ecpg test cases as part of the core build?
> That seems wrong for a number of reasons, not only that we don't hold
> that code to the same standards as the core server.

After looking into this a tiny bit more, we are building the
dependencies of the ecpg tests.

> foreach pgc_file : pgc_files
>   exe_input = custom_target('@0@.c'.format(pgc_file),
>     input: '@0@.pgc'.format(pgc_file),
>     output: '@BASENAME@.c',
>     command: ecpg_preproc_test_command_start +
>       ['-C', 'ORACLE',] +
>       ecpg_preproc_test_command_end,
>     install: false,
>     build_by_default: false,
>     kwargs: exe_preproc_kw,
>   )
>
>   ecpg_test_dependencies += executable(pgc_file,
>     exe_input,
>     kwargs: ecpg_test_exec_kw,
>   )
> endforeach

This is the pattern that we have in all the ecpg/test/*/meson.build
files. That ecpg_test_dependencies variable is then used in the actual
ecpg tests:

> tests += {
>   'name': 'ecpg',
>   'sd': meson.current_source_dir(),
>   'bd': meson.current_build_dir(),
>   'ecpg': {
>     'expecteddir': meson.current_source_dir(),
>     'inputdir': meson.current_build_dir(),
>     'schedule': ecpg_test_files,
>     'sql': [
>       'sql/twophase',
>     ],
>     'test_kwargs': {
>       'depends': ecpg_test_dependencies,
>     },
>     'dbname': 'ecpg1_regression,ecpg2_regression',
>     'regress_args': ecpg_regress_args,
>   },
> }

So in my opinion there is nothing wrong here. The build is working as
intended. Does this make sense to you, Tom?

--
Tristan Partin
Neon (https://neon.tech)



pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: ResourceOwner refactoring
Next
From: Peter Eisentraut
Date:
Subject: Re: Remove MSVC scripts from the tree