Re: ssl tests aren't concurrency safe due to get_free_port()
Andrew Dunstan <andrew@dunslane.net>
From: Andrew Dunstan <andrew@dunslane.net>
To: Andres Freund <andres@anarazel.de>
Cc: pgsql-hackers@postgresql.org, Tom Lane <tgl@sss.pgh.pa.us>
Date: 2022-11-19T15:56:33Z
Lists: pgsql-hackers
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
Commits
-
Fix prove_installcheck when used with PGXS
- b189f71e549f 11.20 landed
- 14bb2e76c7df 12.15 landed
- 6704944779cf 13.11 landed
- e07022500404 14.8 landed
- 3d37476f503f 15.3 landed
- 5d42a9751958 16.0 landed
-
Prevent port collisions between concurrent TAP tests
- 46def5267cf9 11.19 landed
- baa78ff5404c 12.14 landed
- 4b9013d64f23 13.10 landed
- 870d6218e6d7 14.7 landed
- 153e21567750 15.2 landed
- 9b4eafcaf41d 16.0 landed