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.
use warnings;
use Config;
+use Cwd;
use Exporter 'import';
use File::Basename;
use File::Spec;
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");
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');