Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6121ba9

Browse files
committed
Consolidate methods for translating a Perl path to a Windows path.
This fixes some TAP suites when using msys Perl and a builddir locatedin an msys mount point other than "/". For example, builddir=/c/pgexhibited the problem, since /c/pg falls in mount point "/c".Back-patch to 9.6, where tests first started to perform suchtranslations. In back branches, offer both new and old APIs.Reviewed by Andrew Dunstan.Discussion:https://postgr.es/m/20190610045838.GA238501@rfd.leadboat.com
1 parentdf098c3 commit6121ba9

File tree

2 files changed

+31
-4
lines changed

2 files changed

+31
-4
lines changed

‎src/test/perl/PostgresNode.pm‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,7 @@ our @EXPORT = qw(
103103
our ($use_tcp,$test_localhost,$test_pghost,$last_host_assigned,
104104
$last_port_assigned,@all_nodes);
105105

106-
# Windows path to virtual file system root
107-
106+
# For backward compatibility only.
108107
our$vfs_path ='';
109108
if ($Config{osname}eq'msys')
110109
{
@@ -854,7 +853,7 @@ standby_mode=on
854853
subenable_restoring
855854
{
856855
my ($self,$root_node) =@_;
857-
my$path =$vfs_path .$root_node->archive_dir;
856+
my$path =TestLib::perl2host($root_node->archive_dir);
858857
my$name =$self->name;
859858

860859
print"### Enabling WAL restore for node\"$name\"\n";
@@ -882,7 +881,7 @@ standby_mode = on
882881
subenable_archiving
883882
{
884883
my ($self) =@_;
885-
my$path =$vfs_path .$self->archive_dir;
884+
my$path =TestLib::perl2host($self->archive_dir);
886885
my$name =$self->name;
887886

888887
print"### Enabling WAL archiving for node\"$name\"\n";

‎src/test/perl/TestLib.pm‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use strict;
1111
use warnings;
1212

1313
use Config;
14+
use Cwd;
1415
use Exporter'import';
1516
use File::Basename;
1617
use File::Spec;
@@ -156,6 +157,33 @@ sub tempdir_short
156157
return File::Temp::tempdir(CLEANUP=> 1);
157158
}
158159

160+
# Translate a Perl file name to a host file name. Currently, this is a no-op
161+
# except for the case of Perl=msys and host=mingw32. The subject need not
162+
# exist, but its parent directory must exist.
163+
subperl2host
164+
{
165+
my ($subject) =@_;
166+
return$subjectunless$Config{osname}eq'msys';
167+
my$here = cwd;
168+
my$leaf;
169+
if (chdir$subject)
170+
{
171+
$leaf ='';
172+
}
173+
else
174+
{
175+
$leaf ='/' . basename$subject;
176+
my$parent = dirname$subject;
177+
chdir$parentordie"could not chdir\"$parent\":$!";
178+
}
179+
180+
# this odd way of calling 'pwd -W' is the only way that seems to work.
181+
my$dir =qx{sh -c "pwd -W"};
182+
chomp$dir;
183+
chdir$here;
184+
return$dir .$leaf;
185+
}
186+
159187
subsystem_log
160188
{
161189
print("# Running:" .join("",@_) ."\n");

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp