On 2022-11-15 Tu 20:51, Andres Freund wrote: >> @@ -140,6 +143,27 @@ INIT >> >> # Tracking of last port value assigned to accelerate free port lookup. >> $last_port_assigned = int(rand() * 16384) + 49152; >> + >> + # Set the port lock directory >> + >> + # If we're told to use a directory (e.g. from a buildfarm client) >> + # explicitly, use that >> + $portdir = $ENV{PG_TEST_PORT_DIR}; >> + # Otherwise, try to use a directory at the top of the build tree >> + if (! $portdir && $ENV{MESON_BUILD_ROOT}) >> + { >> + $portdir = $ENV{MESON_BUILD_ROOT} . '/portlock' >> + } >> + elsif (! $portdir && ($ENV{TESTDATADIR} || "") =~ /\W(src|contrib)\W/p) >> + { >> + my $dir = ${^PREMATCH}; >> + $portdir = "$dir/portlock" if $dir; >> + } >> + # As a last resort use a directory under tmp_check >> + $portdir ||= $PostgreSQL::Test::Utils::tmp_check . '/portlock'; >> + $portdir =~ s!\\!/!g; >> + # Make sure the directory exists >> + mkpath($portdir) unless -d $portdir; >> } > Perhaps we should just export a directory in configure instead of this > guessing game? > > >
I think the obvious candidate would be to export top_builddir from src/Makefile.global. That would remove the need to infer it from TESTDATADIR. Any objections? cheers andrew -- Andrew Dunstan EDB: https://www.enterprisedb.com