Skip to content

Commit 0f7c0fb

Browse files
committed
Make test portlock logic work with meson
Previously the portlock logic, added in 9b4eafc, didn't actually work properly when the tests were run via meson. 9b4eafc used the MESON_BUILD_ROOT environment variable to determine the directory for the port lock directory, but that's never set for running the tests. That meant that each test used its own portlock dir, unless the PG_TEST_PORT_DIR environment variable was set. Fix the problem by setting top_builddir for the environment. That's also used for the autoconf/make build. Backpatch back to 16, where meson support was added. Reported-by: Zharkov Roman <r.zharkov@postgrespro.ru> Reviewed-by: Andrew Dunstan <andrew@dunslane.net> Backpatch-through: 16
1 parent 310907a commit 0f7c0fb

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

meson.build

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3375,6 +3375,8 @@ test_initdb_template = meson.build_root() / 'tmp_install' / 'initdb-template'
33753375
test_env.set('PG_REGRESS', pg_regress.full_path())
33763376
test_env.set('REGRESS_SHLIB', regress_module.full_path())
33773377
test_env.set('INITDB_TEMPLATE', test_initdb_template)
3378+
# for Cluster.pm's portlock logic
3379+
test_env.set('top_builddir', meson.build_root())
33783380

33793381
# Test suites that are not safe by default but can be run if selected
33803382
# by the user via the whitespace-separated list in variable PG_TEST_EXTRA.

src/test/perl/PostgreSQL/Test/Cluster.pm

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,7 @@ INIT
167167
$portdir = $ENV{PG_TEST_PORT_DIR};
168168
# Otherwise, try to use a directory at the top of the build tree
169169
# or as a last resort use the tmp_check directory
170-
my $build_dir =
171-
$ENV{MESON_BUILD_ROOT}
172-
|| $ENV{top_builddir}
170+
my $build_dir = $ENV{top_builddir}
173171
|| $PostgreSQL::Test::Utils::tmp_check;
174172
$portdir ||= "$build_dir/portlock";
175173
$portdir =~ s!\\!/!g;

0 commit comments

Comments
 (0)