Re: ssl tests aren't concurrency safe due to get_free_port() - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: ssl tests aren't concurrency safe due to get_free_port()
Date
Msg-id 58de442f-a4fb-3980-85c8-a024ff26c54b@dunslane.net
Whole thread Raw
In response to Re: ssl tests aren't concurrency safe due to get_free_port()  (Andres Freund <andres@anarazel.de>)
Responses Re: ssl tests aren't concurrency safe due to get_free_port()
List 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




pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: test/modules/test_oat_hooks vs. debug_discard_caches=1
Next
From: Tom Lane
Date:
Subject: Re: [BUG] pg_dump blocked