diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2020-07-09 11:37:21 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2020-07-09 11:37:21 -0400 |
commit | ffb4cee43bdccb54f0cf072a51dedc74e343b6f1 (patch) | |
tree | dc718aafb41e6990f9f3dfb330e2cc2fe88c01a7 /src/test/perl/PostgresNode.pm | |
parent | 991c444e7ad3a1ff7bcffff4121e6ff67c4783fc (diff) | |
download | postgresql-ffb4cee43bdccb54f0cf072a51dedc74e343b6f1.tar.gz postgresql-ffb4cee43bdccb54f0cf072a51dedc74e343b6f1.zip |
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
Diffstat (limited to 'src/test/perl/PostgresNode.pm')
-rw-r--r-- | src/test/perl/PostgresNode.pm | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/test/perl/PostgresNode.pm b/src/test/perl/PostgresNode.pm index 0914fdaa463..8c1b77376fb 100644 --- a/src/test/perl/PostgresNode.pm +++ b/src/test/perl/PostgresNode.pm @@ -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) { |