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

Commit660a2b1

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 parent25b93a2 commit660a2b1

File tree

5 files changed

+25
-32
lines changed

5 files changed

+25
-32
lines changed

‎src/bin/pg_checksums/t/002_actions.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ sub check_relation_corruption
183183
my$basedir =$node->basedir;
184184
my$tablespace_dir ="$basedir/ts_corrupt_dir";
185185
mkdir($tablespace_dir);
186-
$tablespace_dir = TestLib::real_dir($tablespace_dir);
186+
$tablespace_dir = TestLib::perl2host($tablespace_dir);
187187
$node->safe_psql('postgres',
188188
"CREATE TABLESPACE ts_corrupt LOCATION '$tablespace_dir';");
189189
check_relation_corruption($node,'corrupt2','ts_corrupt');

‎src/test/perl/PostgresNode.pm

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,6 @@ 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-
112-
our$vfs_path ='';
113-
if ($Config{osname}eq'msys')
114-
{
115-
$vfs_path =`cd / && pwd -W`;
116-
chomp$vfs_path;
117-
}
118-
119110
INIT
120111
{
121112

@@ -945,7 +936,7 @@ primary_conninfo='$root_connstr'
945936
subenable_restoring
946937
{
947938
my ($self,$root_node) =@_;
948-
my$path =$vfs_path .$root_node->archive_dir;
939+
my$path =TestLib::perl2host($root_node->archive_dir);
949940
my$name =$self->name;
950941

951942
print"### Enabling WAL restore for node\"$name\"\n";
@@ -990,7 +981,7 @@ sub set_standby_mode
990981
subenable_archiving
991982
{
992983
my ($self) =@_;
993-
my$path =$vfs_path .$self->archive_dir;
984+
my$path =TestLib::perl2host($self->archive_dir);
994985
my$name =$self->name;
995986

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

‎src/test/perl/TestLib.pm

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -166,22 +166,31 @@ sub tempdir_short
166166
return File::Temp::tempdir(CLEANUP=> 1);
167167
}
168168

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

180189
# this odd way of calling 'pwd -W' is the only way that seems to work.
181-
$dir =qx{sh -c "pwd -W"};
190+
my$dir =qx{sh -c "pwd -W"};
182191
chomp$dir;
183192
chdir$here;
184-
return$dir;
193+
return$dir .$leaf;
185194
}
186195

187196
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