Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1owQCz-0006fB-KZ for pgsql-hackers@arkaria.postgresql.org; Sat, 19 Nov 2022 15:56:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1owQCy-0000UK-53 for pgsql-hackers@arkaria.postgresql.org; Sat, 19 Nov 2022 15:56:44 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1owQCx-0000Pl-RN for pgsql-hackers@lists.postgresql.org; Sat, 19 Nov 2022 15:56:43 +0000 Received: from relay8-d.mail.gandi.net ([217.70.183.201]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1owQCu-0007Fm-Ui for pgsql-hackers@postgresql.org; Sat, 19 Nov 2022 15:56:42 +0000 Received: (Authenticated sender: adsend@dunslane.net) by mail.gandi.net (Postfix) with ESMTPSA id 67AD01BF203; Sat, 19 Nov 2022 15:56:35 +0000 (UTC) Message-ID: <58de442f-a4fb-3980-85c8-a024ff26c54b@dunslane.net> Date: Sat, 19 Nov 2022 10:56:33 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: ssl tests aren't concurrency safe due to get_free_port() Content-Language: en-US To: Andres Freund Cc: pgsql-hackers@postgresql.org, Tom Lane References: <20221002164931.d57hlutrcz4d2zi7@awork3.anarazel.de> <7579f627-aad4-7a04-1a98-033cc6b3cca5@dunslane.net> <52266bf8-bf38-fdfa-9a77-1568f82b63b3@dunslane.net> <0891f64a-d30f-a1b7-9d0c-e447684cd8cd@dunslane.net> <20221105183643.v2nxsac3xlb3eazi@awork3.anarazel.de> <0867ca05-ed3f-09ca-cd41-d7087e542362@dunslane.net> <20221116015105.g6qxu2ugpj6agt26@awork3.anarazel.de> From: Andrew Dunstan In-Reply-To: <20221116015105.g6qxu2ugpj6agt26@awork3.anarazel.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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