diff --git a/src/test/recovery/t/014_unlogged_reinit.pl b/src/test/recovery/t/014_unlogged_reinit.pl
index 5d07a66..e2dbdc0 100644
--- a/src/test/recovery/t/014_unlogged_reinit.pl
+++ b/src/test/recovery/t/014_unlogged_reinit.pl
@@ -30,8 +30,25 @@ ok(-f "$pgdata/$baseUnloggedPath",        'main fork in base exists');
 
 my $tablespaceDir = TestLib::tempdir;
 
+sub real_dir
+{
+    my $dir = "$_[0]";
+    return $dir unless -d $dir;
+    use Config;
+    return $dir unless $Config{osname} eq 'msys';
+    use Cwd;
+    my $here = cwd;
+    chdir $dir;
+    $dir = qx{sh -c "pwd -W"};
+    chomp $dir;
+    chdir $here;
+    return $dir;
+}
+
+my $realTSDir = 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');
 
