Re: ssl tests aren't concurrency safe due to get_free_port()

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers(at)postgresql(dot)org, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: ssl tests aren't concurrency safe due to get_free_port()
Date: 2022-11-19 15:56:33
Message-ID: 58de442f-a4fb-3980-85c8-a024ff26c54b@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2022-11-19 17:02:32 Re: [BUG] pg_dump blocked
Previous Message Andrew Dunstan 2022-11-19 15:30:40 Re: test/modules/test_oat_hooks vs. debug_discard_caches=1