Skip to content

Commit ffb4cee

Browse files
committed
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
1 parent 991c444 commit ffb4cee

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/test/perl/PostgresNode.pm

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1512,15 +1512,19 @@ sub psql
15121512
}
15131513
};
15141514

1515+
# Note: on Windows, IPC::Run seems to convert \r\n to \n in program output
1516+
# if we're using native Perl, but not if we're using MSys Perl. So do it
1517+
# by hand in the latter case, here and elsewhere.
1518+
15151519
if (defined $$stdout)
15161520
{
1517-
$$stdout =~ s/\r\n/\n/g if $TestLib::windows_os;
1521+
$$stdout =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
15181522
chomp $$stdout;
15191523
}
15201524

15211525
if (defined $$stderr)
15221526
{
1523-
$$stderr =~ s/\r\n/\n/g if $TestLib::windows_os;
1527+
$$stderr =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
15241528
chomp $$stderr;
15251529
}
15261530

@@ -1651,7 +1655,7 @@ sub poll_query_until
16511655
{
16521656
my $result = IPC::Run::run $cmd, '>', \$stdout, '2>', \$stderr;
16531657

1654-
$stdout =~ s/\r\n/\n/g if $TestLib::windows_os;
1658+
$stdout =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
16551659
chomp($stdout);
16561660

16571661
if ($stdout eq $expected)
@@ -1667,7 +1671,7 @@ sub poll_query_until
16671671

16681672
# The query result didn't change in 180 seconds. Give up. Print the
16691673
# output from the last attempt, hopefully that's useful for debugging.
1670-
$stderr =~ s/\r\n/\n/g if $TestLib::windows_os;
1674+
$stderr =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
16711675
chomp($stderr);
16721676
diag qq(poll_query_until timed out executing this query:
16731677
$query
@@ -2112,8 +2116,8 @@ sub pg_recvlogical_upto
21122116
}
21132117
};
21142118

2115-
$stdout =~ s/\r\n/\n/g if $TestLib::windows_os;
2116-
$stderr =~ s/\r\n/\n/g if $TestLib::windows_os;
2119+
$stdout =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
2120+
$stderr =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
21172121

21182122
if (wantarray)
21192123
{

0 commit comments

Comments
 (0)