aboutsummaryrefslogtreecommitdiff
path: root/src/test/perl/PostgresNode.pm
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2020-07-09 17:38:52 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2020-07-09 17:38:52 -0400
commit17b87b3049fa7e3ddc68bf9daaffa3b01d7b8be2 (patch)
treea9323693c7684884ccba570fe7846c813b618958 /src/test/perl/PostgresNode.pm
parent601d419b2b5def62a1867169e67c7ef876f0b886 (diff)
downloadpostgresql-17b87b3049fa7e3ddc68bf9daaffa3b01d7b8be2.tar.gz
postgresql-17b87b3049fa7e3ddc68bf9daaffa3b01d7b8be2.zip
Tighten up Windows CRLF conversion in our TAP test scripts.
Back-patch commits 91bdf499b and ffb4cee43, so that all branches agree on when and how to do Windows CRLF conversion. This should close the referenced thread. Thanks to Andrew Dunstan for discussion/review. Discussion: https://postgr.es/m/412ae8da-76bb-640f-039a-f3513499e53d@gmx.net
Diffstat (limited to 'src/test/perl/PostgresNode.pm')
-rw-r--r--src/test/perl/PostgresNode.pm17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/test/perl/PostgresNode.pm b/src/test/perl/PostgresNode.pm
index 1407359aef6..1dedba4785a 100644
--- a/src/test/perl/PostgresNode.pm
+++ b/src/test/perl/PostgresNode.pm
@@ -1324,7 +1324,6 @@ sub safe_psql
print "\n#### End standard error\n";
}
- $stdout =~ s/\r//g if $TestLib::windows_os;
return $stdout;
}
@@ -1513,16 +1512,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
@@ -1652,8 +1655,8 @@ sub poll_query_until
{
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 $expected)
{
@@ -1668,8 +1671,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:
@@ -2113,8 +2116,8 @@ sub pg_recvlogical_upto
}
};
- $stdout =~ s/\r//g if $TestLib::windows_os;
- $stderr =~ s/\r//g if $TestLib::windows_os;
+ $stdout =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
+ $stderr =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
if (wantarray)
{