From 15c3a1b45b480f6478555e9ddbc6093bd031d12c Mon Sep 17 00:00:00 2001
From: Andrew Dunstan <andrew@dunslane.net>
Date: Tue, 11 Aug 2015 08:58:58 -0400
Subject: [PATCH] More fixes to allow pg_rewind tests to run on Msys.

---
 src/bin/pg_rewind/RewindTest.pm            | 3 +++
 src/bin/pg_rewind/t/004_pg_xlog_symlink.pl | 4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/bin/pg_rewind/RewindTest.pm b/src/bin/pg_rewind/RewindTest.pm
index fa6d24b0337..22e5cae45da 100644
--- a/src/bin/pg_rewind/RewindTest.pm
+++ b/src/bin/pg_rewind/RewindTest.pm
@@ -40,6 +40,7 @@ use warnings;
 use TestLib;
 use Test::More;
 
+use Config;
 use File::Copy;
 use File::Path qw(rmtree);
 use IPC::Run qw(run start);
@@ -119,6 +120,7 @@ sub check_query
 	}
 	else
 	{
+		$stdout =~ s/\r//g if $Config{osname} eq 'msys';
 		is($stdout, $expected_stdout, "$test_name: query result matches");
 	}
 }
@@ -138,6 +140,7 @@ sub poll_query_until
 		my $result = run $cmd, '>', \$stdout, '2>', \$stderr;
 
 		chomp($stdout);
+		$stdout =~ s/\r//g if $Config{osname} eq 'msys';
 		if ($stdout eq "t")
 		{
 			return 1;
diff --git a/src/bin/pg_rewind/t/004_pg_xlog_symlink.pl b/src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
index 0830b5a330a..c5f72e2e3cd 100644
--- a/src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
+++ b/src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
@@ -4,7 +4,7 @@
 use strict;
 use warnings;
 use File::Copy;
-use File::Path qw(remove_tree);
+use File::Path qw(rmtree);
 use TestLib;
 use Test::More;
 if ($windows_os)
@@ -25,7 +25,7 @@ sub run_test
 
 	my $master_xlogdir = "$tmp_check/xlog_master";
 
-	remove_tree($master_xlogdir);
+	rmtree($master_xlogdir);
 	RewindTest::setup_cluster();
 
 	# turn pg_xlog into a symlink
-- 
GitLab