Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 45f5270

Browse files
committed
Make PG_TEST_USE_UNIX_SOCKETS work for tap tests on windows.
We need to replace windows-style \ path separators with / when putting socket directories either in postgresql.conf or libpq connection strings, otherwise they are interpreted as escapes. Author: Andres Freund <andres@anarazel.de> Reviewed-By: Peter Eisentraut <peter.eisentraut@enterprisedb.com> Discussion: https://postgr.es/m/4da250a5-4222-1522-f14d-8a72bcf7e38e@enterprisedb.com
1 parent fa0e03c commit 45f5270

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/bin/pg_ctl/t/001_start_stop.pl

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
if ($use_unix_sockets)
3636
{
3737
print $conf "listen_addresses = ''\n";
38+
$tempdir_short =~ s!\\!/!g if $PostgreSQL::Test::Utils::windows_os;
3839
print $conf "unix_socket_directories = '$tempdir_short'\n";
3940
}
4041
else

src/test/perl/PostgreSQL/Test/Cluster.pm

+12-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,18 @@ INIT
119119
$use_tcp = !$PostgreSQL::Test::Utils::use_unix_sockets;
120120
$test_localhost = "127.0.0.1";
121121
$last_host_assigned = 1;
122-
$test_pghost = $use_tcp ? $test_localhost : PostgreSQL::Test::Utils::tempdir_short;
122+
if ($use_tcp)
123+
{
124+
$test_pghost = $test_localhost;
125+
}
126+
else
127+
{
128+
# On windows, replace windows-style \ path separators with / when
129+
# putting socket directories either in postgresql.conf or libpq
130+
# connection strings, otherwise they are interpreted as escapes.
131+
$test_pghost = PostgreSQL::Test::Utils::tempdir_short;
132+
$test_pghost =~ s!\\!/!g if $PostgreSQL::Test::Utils::windows_os;
133+
}
123134
$ENV{PGHOST} = $test_pghost;
124135
$ENV{PGDATABASE} = 'postgres';
125136

0 commit comments

Comments
 (0)