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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 12 additions & 1 deletion
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy