Further tighten Windows CRLF conversion in our TAP test scripts.

Buildfarm results now imply that Perl's IPC::Run does CRLF conversion
for us if we're using native Perl, but not when using MSys Perl.
Restrict the conversions done by PostgresNode.pm to act only in the
latter case.  (Similar conversions done in TestLib.pm and RewindTest.pm
were already handled this way.)

Discussion: https://postgr.es/m/412ae8da-76bb-640f-039a-f3513499e53d@gmx.net
This commit is contained in:
Tom Lane 2020-07-09 11:37:21 -04:00
parent 991c444e7a
commit ffb4cee43b
1 changed files with 10 additions and 6 deletions

View File

@ -1512,15 +1512,19 @@ 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 $TestLib::windows_os;
$$stdout =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
chomp $$stdout;
}
if (defined $$stderr)
{
$$stderr =~ s/\r\n/\n/g if $TestLib::windows_os;
$$stderr =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
chomp $$stderr;
}
@ -1651,7 +1655,7 @@ sub poll_query_until
{
my $result = IPC::Run::run $cmd, '>', \$stdout, '2>', \$stderr;
$stdout =~ s/\r\n/\n/g if $TestLib::windows_os;
$stdout =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
chomp($stdout);
if ($stdout eq $expected)
@ -1667,7 +1671,7 @@ 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 $TestLib::windows_os;
$stderr =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
chomp($stderr);
diag qq(poll_query_until timed out executing this query:
$query
@ -2112,8 +2116,8 @@ sub pg_recvlogical_upto
}
};
$stdout =~ s/\r\n/\n/g if $TestLib::windows_os;
$stderr =~ s/\r\n/\n/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)
{