Skip to content

Commit 9ad21a6

Browse files
committed
Don't use an Msys virtual path to create a tablespace
The new unlogged_reinit recovery tests create a new tablespace using TestLib.pm's tempdir. However, on msys that function returns a virtual path that isn't understood by Postgres. Here we add a new function to TestLib.pm to turn such a path into a real path on the underlying file system, and use it in the new test to create the tablespace. The new function is essentially a NOOP everywhere but msys.
1 parent 6fbd5cc commit 9ad21a6

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

src/test/perl/TestLib.pm

Lines changed: 18 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;
@@ -158,6 +159,23 @@ sub tempdir_short
158159
return File::Temp::tempdir(CLEANUP => 1);
159160
}
160161

162+
# Return the real directory for a virtual path directory under msys.
163+
# The directory must exist. If it's not an existing directory or we're
164+
# not under msys, return the input argument unchanged.
165+
sub real_dir
166+
{
167+
my $dir = "$_[0]";
168+
return $dir unless -d $dir;
169+
return $dir unless $Config{osname} eq 'msys';
170+
my $here = cwd;
171+
chdir $dir;
172+
# this odd way of calling 'pwd -W' is the only way that seems to work.
173+
$dir = qx{sh -c "pwd -W"};
174+
chomp $dir;
175+
chdir $here;
176+
return $dir;
177+
}
178+
161179
sub system_log
162180
{
163181
print("# Running: " . join(" ", @_) . "\n");

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@
3030

3131
my $tablespaceDir = TestLib::tempdir;
3232

33+
my $realTSDir = TestLib::real_dir($tablespaceDir);
34+
3335
$node->safe_psql('postgres',
34-
"CREATE TABLESPACE ts1 LOCATION '$tablespaceDir'");
36+
"CREATE TABLESPACE ts1 LOCATION '$realTSDir'");
3537
$node->safe_psql('postgres',
3638
'CREATE UNLOGGED TABLE ts1_unlogged (id int) TABLESPACE ts1');
3739

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy