aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Dunstan <andrew@dunslane.net>2018-03-20 08:25:36 +1030
committerAndrew Dunstan <andrew@dunslane.net>2018-03-20 08:25:36 +1030
commit9ad21a6957ff2d8743e9a59ba062d3c009b24ec4 (patch)
treef9f818697bc91105b5cd457fc28f5253a7420522 /src
parent6fbd5cce22ebd2203d99cd7dcd179d0e1138599e (diff)
downloadpostgresql-9ad21a6957ff2d8743e9a59ba062d3c009b24ec4.tar.gz
postgresql-9ad21a6957ff2d8743e9a59ba062d3c009b24ec4.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/test/perl/TestLib.pm18
-rw-r--r--src/test/recovery/t/014_unlogged_reinit.pl4
2 files changed, 21 insertions, 1 deletions
diff --git a/src/test/perl/TestLib.pm b/src/test/perl/TestLib.pm
index 7d017d49bd0..b6862688d4f 100644
--- a/src/test/perl/TestLib.pm
+++ b/src/test/perl/TestLib.pm
@@ -11,6 +11,7 @@ use strict;
use warnings;
use Config;
+use Cwd;
use Exporter 'import';
use File::Basename;
use File::Spec;
@@ -158,6 +159,23 @@ sub tempdir_short
return File::Temp::tempdir(CLEANUP => 1);
}
+# Return the real directory for a virtual path directory under msys.
+# The directory must exist. If it's not an existing directory or we're
+# not under msys, return the input argument unchanged.
+sub real_dir
+{
+ my $dir = "$_[0]";
+ return $dir unless -d $dir;
+ return $dir unless $Config{osname} eq 'msys';
+ my $here = cwd;
+ chdir $dir;
+ # this odd way of calling 'pwd -W' is the only way that seems to work.
+ $dir = qx{sh -c "pwd -W"};
+ chomp $dir;
+ chdir $here;
+ return $dir;
+}
+
sub system_log
{
print("# Running: " . join(" ", @_) . "\n");
diff --git a/src/test/recovery/t/014_unlogged_reinit.pl b/src/test/recovery/t/014_unlogged_reinit.pl
index 5d07a663a02..446144a7836 100644
--- a/src/test/recovery/t/014_unlogged_reinit.pl
+++ b/src/test/recovery/t/014_unlogged_reinit.pl
@@ -30,8 +30,10 @@ ok(-f "$pgdata/$baseUnloggedPath", 'main fork in base exists');
my $tablespaceDir = TestLib::tempdir;
+my $realTSDir = TestLib::real_dir($tablespaceDir);
+
$node->safe_psql('postgres',
- "CREATE TABLESPACE ts1 LOCATION '$tablespaceDir'");
+ "CREATE TABLESPACE ts1 LOCATION '$realTSDir'");
$node->safe_psql('postgres',
'CREATE UNLOGGED TABLE ts1_unlogged (id int) TABLESPACE ts1');