Meson rebuilds and reinstalls autoinc and refint libraries during regression tests.

Started by Zharkov Romanalmost 2 years ago3 messageshackers
Beta feature

Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.

won't retrysuccessCI history

You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:

docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t50603
psql -h localhost -U postgres

Built from patchset v1 (message #1), July 27, 2026 at 10:35 PM.

Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:

git clone --branch t50603_1 https://github.com/hackorum-dev/postgres.git

In a checkout you already have, add the fork once:

git remote add hackorum https://github.com/hackorum-dev/postgres.git

then, for this patchset and every later one:

git fetch hackorum t50603_1 && git checkout t50603_1

Patchset v1 (message #1) is on t50603_1

Jump to latest
#1Zharkov Roman
r.zharkov@postgrespro.ru

Hello!

Accidentally I found that shared libraries autoinc.so and refint.so
rewrites in the "tmp_install" folder during the regression tests.
This happens because these libraries builds again for regression tests
purposes and rewrites by the "install_test_files" test [0]https://github.com/postgres/postgres/blob/f95da9f0e091ddbc5d50ec6c11be772da009b24e/src/test/regress/meson.build#L46.

I tried to change this bahavior, but there are few problems:
It seems, Meson doesn't have a function to just copy a file from one
build directory to another.
There is no way to install the product of the "shared_module()" function
into the two different locations.
"configure_file()" function in "copy mode" runs at setup time and cannot
be used.
"fs.copyfile()" function runs at build time, but I couldn't find the way
to start it after the building of necessary modules. So this function
fails with the "file not found" error. Also it needs the Meson version

= 0.64

And also there is no single cross platform copy program. I tried to use
"cp" on Linux and "cmd /c copy..." on Windows, but the code has
increased in size very much. Especially, after fixing the slash in the
return value of the "meson.current_build_dir()" function on Windows.
That slash arrives from the "subdir('src/test')" call [1]https://github.com/postgres/postgres/blob/f95da9f0e091ddbc5d50ec6c11be772da009b24e/meson.build#L3095.

To avoid double building of autoinc and refint libraries I suggest to
use the "custom_target()" Meson function and own copy program. The
"custom_target()" function can depends on contrib modules and use any
script to just a copy libraries to the regression tests build directory.
I included the patch which adds copy.py script into the regression tests
directory and uses it to "build" autoinc and refint modules.

What do you think?

Thanks!

Best regards, Roman Zharkov.

[0]: https://github.com/postgres/postgres/blob/f95da9f0e091ddbc5d50ec6c11be772da009b24e/src/test/regress/meson.build#L46
https://github.com/postgres/postgres/blob/f95da9f0e091ddbc5d50ec6c11be772da009b24e/src/test/regress/meson.build#L46
[1]: https://github.com/postgres/postgres/blob/f95da9f0e091ddbc5d50ec6c11be772da009b24e/meson.build#L3095
https://github.com/postgres/postgres/blob/f95da9f0e091ddbc5d50ec6c11be772da009b24e/meson.build#L3095

Attachments:

t50603_1
Avoid-rebuilding-of-spi-modules.patchtext/x-diff; name=Avoid-rebuilding-of-spi-modules.patchDownload+19-14
#2Andres Freund
andres@anarazel.de
In reply to: Zharkov Roman (#1)
Re: Meson rebuilds and reinstalls autoinc and refint libraries during regression tests.

Hi,

On 2024-11-21 13:40:18 +0700, Zharkov Roman wrote:

What do you think?

What's the problem with the current approach? It's hard to believe the build
time of these modules is meaningful in any sort of way.

Greetings,

Andres Freund

#3Zharkov Roman
r.zharkov@postgrespro.ru
In reply to: Andres Freund (#2)
Re: Meson rebuilds and reinstalls autoinc and refint libraries during regression tests.

Hello,

On 2024-11-21 22:59, Andres Freund wrote:

What's the problem with the current approach? It's hard to believe the
build
time of these modules is meaningful in any sort of way.

Thank you for your question! There are no real problems except my own
small trouble with checksums of installed binaries, which I have already
fixed.
I just tried to find a way to put these two libraries into the regress
build dir without rebuilding them. It seems to me, using the
"custom_target()" function is a litle bit pretty than calling the
"shared_module()" with hardcoded paths to the libraries sources. But I
don't like additional "copy.py" script and wonder if there is an
acceptable universal method to just copy a file?

Best regards, Roman Zharkov.