1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-02 04:21:28 +03:00

Remove PostgreSQL::Test::Utils::perl2host completely

Commit f1ac4a74de disabled this processing, and as nothing has broken (as
expected) here we proceed to remove the routine and adjust all the call
sites.

Backpatch to release 10

Discussion: https://postgr.es/m/0ba775a2-8aa0-0d56-d780-69427cf6f33d@dunslane.net
Discussion: https://postgr.es/m/20220125023609.5ohu3nslxgoygihl@alap3.anarazel.de
This commit is contained in:
Andrew Dunstan
2022-02-20 08:55:06 -05:00
parent 2e30d77a19
commit 652ff988fb
11 changed files with 18 additions and 86 deletions

View File

@@ -1016,7 +1016,7 @@ primary_conninfo='$root_connstr'
sub enable_restoring
{
my ($self, $root_node, $standby) = @_;
my $path = TestLib::perl2host($root_node->archive_dir);
my $path = $root_node->archive_dir;
my $name = $self->name;
print "### Enabling WAL restore for node \"$name\"\n";
@@ -1084,7 +1084,7 @@ sub set_standby_mode
sub enable_archiving
{
my ($self) = @_;
my $path = TestLib::perl2host($self->archive_dir);
my $path = $self->archive_dir;
my $name = $self->name;
print "### Enabling WAL archiving for node \"$name\"\n";

View File

@@ -24,7 +24,6 @@ TestLib - helper module for writing PostgreSQL's C<prove> tests.
# Miscellanea
print "on Windows" if $TestLib::windows_os;
my $path = TestLib::perl2host($backup_dir);
ok(check_mode_recursive($stream_dir, 0700, 0600),
"check stream dir permissions");
TestLib::system_log('pg_ctl', 'kill', 'QUIT', $slow_pid);
@@ -298,61 +297,6 @@ sub tempdir_short
=pod
=item perl2host()
Translate a virtual file name to a host file name. Currently, this is a no-op
except for the case of Perl=msys and host=mingw32. The subject need not
exist, but its parent or grandparent directory must exist unless cygpath is
available.
The returned path uses forward slashes but has no trailing slash.
=cut
sub perl2host
{
my ($subject) = @_;
return $subject unless $Config{osname} eq 'msys';
if ($is_msys2)
{
# get absolute, windows type path
my $path = qx{cygpath -a -m "$subject"};
if (!$?)
{
chomp $path;
$path =~ s!/$!!;
return $path if $path;
}
# fall through if this didn't work.
}
my $here = cwd;
my $leaf;
if (chdir $subject)
{
$leaf = '';
}
else
{
$leaf = '/' . basename $subject;
my $parent = dirname $subject;
if (!chdir $parent)
{
$leaf = '/' . basename($parent) . $leaf;
$parent = dirname $parent;
chdir $parent or die "could not chdir \"$parent\": $!";
}
}
# this odd way of calling 'pwd -W' is the only way that seems to work.
my $dir = qx{sh -c "pwd -W"};
chomp $dir;
$dir =~ s!/$!!;
chdir $here;
return $dir . $leaf;
}
=pod
=item has_wal_read_bug()
Returns true if $tmp_check is subject to a sparc64+ext4 bug that causes WAL
@@ -708,8 +652,6 @@ sub dir_symlink
my $newname = shift;
if ($windows_os)
{
$oldname = perl2host($oldname);
$newname = perl2host($newname);
$oldname =~ s,/,\\,g;
$newname =~ s,/,\\,g;
my $cmd = qq{mklink /j "$newname" "$oldname"};

View File

@@ -33,9 +33,7 @@ ok(-f "$pgdata/$baseUnloggedPath", 'main fork in base exists');
my $tablespaceDir = TestLib::tempdir;
my $realTSDir = TestLib::perl2host($tablespaceDir);
$node->safe_psql('postgres', "CREATE TABLESPACE ts1 LOCATION '$realTSDir'");
$node->safe_psql('postgres', "CREATE TABLESPACE ts1 LOCATION '$tablespaceDir'");
$node->safe_psql('postgres',
'CREATE UNLOGGED TABLE ts1_unlogged (id int) TABLESPACE ts1');

View File

@@ -116,7 +116,7 @@ log_ipcs();
$gnat->start;
log_ipcs();
my $regress_shlib = TestLib::perl2host($ENV{REGRESS_SHLIB});
my $regress_shlib = $ENV{REGRESS_SHLIB};
$gnat->safe_psql('postgres', <<EOSQL);
CREATE FUNCTION wait_pid(int)
RETURNS void

View File

@@ -60,7 +60,6 @@ wal_skip_threshold = 0
# Setup
my $tablespace_dir = $node->basedir . '/tablespace_other';
mkdir($tablespace_dir);
$tablespace_dir = TestLib::perl2host($tablespace_dir);
my $result;
# Test redo of CREATE TABLESPACE.
@@ -152,7 +151,6 @@ wal_skip_threshold = 0
$copy_file, qq(20000,30000
20001,30001
20002,30002));
$copy_file = TestLib::perl2host($copy_file);
# Test truncation with inserted tuples using both INSERT and COPY. Tuples
# inserted after the truncation should be seen.

View File

@@ -28,7 +28,7 @@ $node_primary->init(allows_streaming => 1, has_archiving => 1);
# Note: consistent use of forward slashes here avoids any escaping problems
# that arise from use of backslashes. That means we need to double-quote all
# the paths in the archive_command
my $perlbin = TestLib::perl2host($^X);
my $perlbin = $^X;
$perlbin =~ s!\\!/!g if $TestLib::windows_os;
my $archivedir_primary = $node_primary->archive_dir;
$archivedir_primary =~ s!\\!/!g if $TestLib::windows_os;