mirror of
https://github.com/postgres/postgres.git
synced 2025-08-31 17:02:12 +03:00
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
This commit is contained in:
@@ -35,6 +35,7 @@ print $conf PostgreSQL::Test::Utils::slurp_file($ENV{TEMP_CONFIG})
|
|||||||
if ($use_unix_sockets)
|
if ($use_unix_sockets)
|
||||||
{
|
{
|
||||||
print $conf "listen_addresses = ''\n";
|
print $conf "listen_addresses = ''\n";
|
||||||
|
$tempdir_short =~ s!\\!/!g if $PostgreSQL::Test::Utils::windows_os;
|
||||||
print $conf "unix_socket_directories = '$tempdir_short'\n";
|
print $conf "unix_socket_directories = '$tempdir_short'\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@@ -119,7 +119,18 @@ INIT
|
|||||||
$use_tcp = !$PostgreSQL::Test::Utils::use_unix_sockets;
|
$use_tcp = !$PostgreSQL::Test::Utils::use_unix_sockets;
|
||||||
$test_localhost = "127.0.0.1";
|
$test_localhost = "127.0.0.1";
|
||||||
$last_host_assigned = 1;
|
$last_host_assigned = 1;
|
||||||
$test_pghost = $use_tcp ? $test_localhost : PostgreSQL::Test::Utils::tempdir_short;
|
if ($use_tcp)
|
||||||
|
{
|
||||||
|
$test_pghost = $test_localhost;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
# On windows, replace windows-style \ path separators with / when
|
||||||
|
# putting socket directories either in postgresql.conf or libpq
|
||||||
|
# connection strings, otherwise they are interpreted as escapes.
|
||||||
|
$test_pghost = PostgreSQL::Test::Utils::tempdir_short;
|
||||||
|
$test_pghost =~ s!\\!/!g if $PostgreSQL::Test::Utils::windows_os;
|
||||||
|
}
|
||||||
$ENV{PGHOST} = $test_pghost;
|
$ENV{PGHOST} = $test_pghost;
|
||||||
$ENV{PGDATABASE} = 'postgres';
|
$ENV{PGDATABASE} = 'postgres';
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user