Fix TAP infrastructure to support Mingw better
authorAndrew Dunstan
Sun, 23 Apr 2017 13:39:43 +0000 (09:39 -0400)
committerAndrew Dunstan
Sun, 23 Apr 2017 13:39:43 +0000 (09:39 -0400)
archive_command and restore_command need to refer to Windows paths, not
Msys virtual file system paths, as postgres is completely unaware of the
latter, so prefix them with the Windows path to the virtual file system
root. Clean psql output of carriage returns.

src/test/perl/PostgresNode.pm

index 20bc90b0075c974d360a4afc728627ff17a96042..65c4a8804520c784df32266b40d439436e4b1e43 100644 (file)
@@ -101,6 +101,15 @@ our @EXPORT = qw(
 
 our ($test_localhost, $test_pghost, $last_port_assigned, @all_nodes);
 
+# Windows path to virtual file system root
+
+our $vfs_path = '';
+if ($Config{osname} eq 'msys')
+{
+   $vfs_path = `cd / && pwd -W`;
+   chomp $vfs_path;
+}
+
 INIT
 {
 
@@ -755,7 +764,7 @@ standby_mode=on
 sub enable_restoring
 {
    my ($self, $root_node) = @_;
-   my $path = $root_node->archive_dir;
+   my $path = $vfs_path . $root_node->archive_dir;
    my $name = $self->name;
 
    print "### Enabling WAL restore for node \"$name\"\n";
@@ -783,7 +792,7 @@ standby_mode = on
 sub enable_archiving
 {
    my ($self) = @_;
-   my $path   = $self->archive_dir;
+   my $path   = $vfs_path. $self->archive_dir;
    my $name   = $self->name;
 
    print "### Enabling WAL archiving for node \"$name\"\n";
@@ -971,6 +980,7 @@ sub safe_psql
        print "\n#### End standard error\n";
    }
 
+   $stdout =~ s/\r//g if $TestLib::windows_os;
    return $stdout;
 }