Re: port conflicts when running tests concurrently on windows.

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: port conflicts when running tests concurrently on windows.
Дата
Msg-id 20211209010307.yxzuvsxygy5edqm4@alap3.anarazel.de
обсуждение исходный текст
Ответ на Re: port conflicts when running tests concurrently on windows.  (Andres Freund <andres@anarazel.de>)
Ответы Re: port conflicts when running tests concurrently on windows.  (Andres Freund <andres@anarazel.de>)
Re: port conflicts when running tests concurrently on windows.  (Andrew Dunstan <andrew@dunslane.net>)
Список pgsql-hackers
Hi,

On 2021-12-08 16:36:14 -0800, Andres Freund wrote:
> On 2021-12-08 14:45:50 -0800, Andres Freund wrote:
> > Is it perhaps time to to use unix sockets on windows by default
> > (i.e. PG_TEST_USE_UNIX_SOCKETS), at least when on a new enough windows?
> 
> On its own PG_TEST_USE_UNIX_SOCKETS doesn't work at all on windows - it fails
> trying to use /tmp/ as a socket directory. Using PG_REGRESS_SOCK_DIR fixes
> that for PG_REGRESS. But the tap tests don't look at that :(.

The tap failures in turn are caused by the Cluster.pm choosing a socket
directory with backslashes. Those backslashes are then treated as an escape
character both by guc.c and libpq.

I think this can be addressed by something like

diff --git a/src/test/perl/PostgreSQL/Test/Cluster.pm b/src/test/perl/PostgreSQL/Test/Cluster.pm
index 9467a199c8f..c2a8487bbab 100644
--- a/src/test/perl/PostgreSQL/Test/Cluster.pm
+++ b/src/test/perl/PostgreSQL/Test/Cluster.pm
@@ -119,7 +119,15 @@ INIT
     $use_tcp            = !$PostgreSQL::Test::Utils::use_unix_sockets;
     $test_localhost     = "127.0.0.1";
     $last_host_assigned = 1;
-    $test_pghost        = $use_tcp ? $test_localhost : PostgreSQL::Test::Utils::tempdir_short;
+    if ($use_tcp)
+    {
+        $test_pghost = $test_localhost;
+    }
+    else
+    {
+        $test_pghost = PostgreSQL::Test::Utils::tempdir_short;
+        $test_pghost =~ s!\\!/!g if $PostgreSQL::Test::Utils::windows_os;
+    }
     $ENV{PGHOST}        = $test_pghost;
     $ENV{PGDATABASE}    = 'postgres';
 

I wonder if we need a host2unix() helper accompanying perl2host()? Seems nicer
than sprinkling s!\\!/!g if $PostgreSQL::Test::Utils::windows_os in a growing
number of places...

Greetings,

Andres Freund



В списке pgsql-hackers по дате отправления:

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: Fix typos - "an" instead of "a"
Следующее
От: Zhenghua Lyu
Дата:
Сообщение: Re: Question on not-in and array-eq