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

Commita40dca8

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 parentf7aebd7 commita40dca8

File tree

4 files changed

+31
-24
lines changed

4 files changed

+31
-24
lines changed

‎src/test/perl/PostgresNode.pm

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,7 @@ our @EXPORT = qw(
107107
our ($use_tcp,$test_localhost,$test_pghost,$last_host_assigned,
108108
$last_port_assigned,@all_nodes,$died);
109109

110-
# Windows path to virtual file system root
111-
110+
# For backward compatibility only.
112111
our$vfs_path ='';
113112
if ($Config{osname}eq'msys')
114113
{
@@ -904,7 +903,7 @@ standby_mode=on
904903
subenable_restoring
905904
{
906905
my ($self,$root_node) =@_;
907-
my$path =$vfs_path .$root_node->archive_dir;
906+
my$path =TestLib::perl2host($root_node->archive_dir);
908907
my$name =$self->name;
909908

910909
print"### Enabling WAL restore for node\"$name\"\n";
@@ -933,7 +932,7 @@ standby_mode = on
933932
subenable_archiving
934933
{
935934
my ($self) =@_;
936-
my$path =$vfs_path .$self->archive_dir;
935+
my$path =TestLib::perl2host($self->archive_dir);
937936
my$name =$self->name;
938937

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

‎src/test/perl/TestLib.pm

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -164,22 +164,37 @@ sub tempdir_short
164164
return File::Temp::tempdir(CLEANUP=> 1);
165165
}
166166

167-
#Return the real directory for a virtual path directory under msys.
168-
#The directory must exist. If it's not an existing directory or we're
169-
#not under msys, return the input argument unchanged.
170-
subreal_dir
167+
#Translate a Perl file name to a host file name. Currently, this is a no-op
168+
#except for the case of Perl=msys and host=mingw32. The subject need not
169+
#exist, but its parent directory must exist.
170+
subperl2host
171171
{
172-
my$dir ="$_[0]";
173-
return$dirunless-d$dir;
174-
return$dirunless$Config{osname}eq'msys';
172+
my ($subject) =@_;
173+
return$subjectunless$Config{osname}eq'msys';
175174
my$here = cwd;
176-
chdir$dir;
175+
my$leaf;
176+
if (chdir$subject)
177+
{
178+
$leaf ='';
179+
}
180+
else
181+
{
182+
$leaf ='/' . basename$subject;
183+
my$parent = dirname$subject;
184+
chdir$parentordie"could not chdir\"$parent\":$!";
185+
}
177186

178187
# this odd way of calling 'pwd -W' is the only way that seems to work.
179-
$dir =qx{sh -c "pwd -W"};
188+
my$dir =qx{sh -c "pwd -W"};
180189
chomp$dir;
181190
chdir$here;
182-
return$dir;
191+
return$dir .$leaf;
192+
}
193+
194+
# For backward compatibility only.
195+
subreal_dir
196+
{
197+
return perl2host(@_);
183198
}
184199

185200
subsystem_log

‎src/test/recovery/t/014_unlogged_reinit.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
my$tablespaceDir = TestLib::tempdir;
3232

33-
my$realTSDir = TestLib::real_dir($tablespaceDir);
33+
my$realTSDir = TestLib::perl2host($tablespaceDir);
3434

3535
$node->safe_psql('postgres',"CREATE TABLESPACE ts1 LOCATION '$realTSDir'");
3636
$node->safe_psql('postgres',

‎src/test/recovery/t/017_shm.pl

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,6 @@
1212

1313
plantests=> 5;
1414

15-
# See PostgresNode
16-
my$vfs_path ='';
17-
if ($Config{osname}eq'msys')
18-
{
19-
$vfs_path =`cd / && pwd -W`;
20-
chomp$vfs_path;
21-
}
22-
2315
my$tempdir = TestLib::tempdir;
2416
my$port;
2517

@@ -103,10 +95,11 @@ sub init_start
10395
# Scenarios involving no postmaster.pid, dead postmaster, and a live backend.
10496
# Use a regress.c function to emulate the responsiveness of a backend working
10597
# through a CPU-intensive task.
98+
my$regress_shlib = TestLib::perl2host($ENV{REGRESS_SHLIB});
10699
$gnat->safe_psql('postgres',<<EOSQL);
107100
CREATE FUNCTION wait_pid(int)
108101
RETURNS void
109-
AS '$vfs_path$ENV{REGRESS_SHLIB}'
102+
AS '$regress_shlib'
110103
LANGUAGE C STRICT;
111104
EOSQL
112105
my$slow_query ='SELECT wait_pid(pg_backend_pid())';

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp