summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bin/pg_rewind/t/RewindTest.pm2
-rw-r--r--src/test/perl/PostgresNode.pm13
-rw-r--r--src/test/perl/TestLib.pm2
3 files changed, 10 insertions, 7 deletions
diff --git a/src/bin/pg_rewind/t/RewindTest.pm b/src/bin/pg_rewind/t/RewindTest.pm
index 135d8f0449f..77306fe453b 100644
--- a/src/bin/pg_rewind/t/RewindTest.pm
+++ b/src/bin/pg_rewind/t/RewindTest.pm
@@ -107,7 +107,7 @@ sub check_query
}
else
{
- $stdout =~ s/\r//g if $Config{osname} eq 'msys';
+ $stdout =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
is($stdout, $expected_stdout, "$test_name: query result matches");
}
}
diff --git a/src/test/perl/PostgresNode.pm b/src/test/perl/PostgresNode.pm
index ec5985623bc..8a08a64f3d0 100644
--- a/src/test/perl/PostgresNode.pm
+++ b/src/test/perl/PostgresNode.pm
@@ -1122,7 +1122,6 @@ sub safe_psql
print "\n#### End standard error\n";
}
- $stdout =~ s/\r//g if $TestLib::windows_os;
return $stdout;
}
@@ -1297,16 +1296,20 @@ sub psql
}
};
+ # Note: on Windows, IPC::Run seems to convert \r\n to \n in program output
+ # if we're using native Perl, but not if we're using MSys Perl. So do it
+ # by hand in the latter case, here and elsewhere.
+
if (defined $$stdout)
{
+ $$stdout =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
chomp $$stdout;
- $$stdout =~ s/\r//g if $TestLib::windows_os;
}
if (defined $$stderr)
{
+ $$stderr =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
chomp $$stderr;
- $$stderr =~ s/\r//g if $TestLib::windows_os;
}
# See http://perldoc.perl.org/perlvar.html#%24CHILD_ERROR
@@ -1364,8 +1367,8 @@ sub poll_query_until
[ 'psql', '-XAt', '-c', $query, '-d', $self->connstr($dbname) ];
my $result = IPC::Run::run $cmd, '>', \$stdout, '2>', \$stderr;
+ $stdout =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
chomp($stdout);
- $stdout =~ s/\r//g if $TestLib::windows_os;
if ($stdout eq "t")
{
return 1;
@@ -1378,8 +1381,8 @@ sub poll_query_until
# The query result didn't change in 180 seconds. Give up. Print the
# output from the last attempt, hopefully that's useful for debugging.
+ $stderr =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
chomp($stderr);
- $stderr =~ s/\r//g if $TestLib::windows_os;
diag qq(poll_query_until timed out executing this query:
$query
expecting this output:
diff --git a/src/test/perl/TestLib.pm b/src/test/perl/TestLib.pm
index 76af7dd7345..1cbe73f1705 100644
--- a/src/test/perl/TestLib.pm
+++ b/src/test/perl/TestLib.pm
@@ -216,7 +216,7 @@ sub slurp_file
or die "could not read \"$filename\": $!";
my $contents = <$in>;
close $in;
- $contents =~ s/\r//g if $Config{osname} eq 'msys';
+ $contents =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
return $contents;
}