From: Michael Paquier Date: Tue, 21 Sep 2021 23:43:57 +0000 (+0900) Subject: Fix places in TestLib.pm in need of adaptation to the output of Msys perl X-Git-Tag: REL9_6_24~41 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=404061515cd54a4bbb0447355ca4420411c7bff2;p=thirdparty%2Fpostgresql.git Fix places in TestLib.pm in need of adaptation to the output of Msys perl Contrary to the output of native perl, Msys perl generates outputs with CRLFs characters. There are already places in the TAP code where CRLFs (\r\n) are automatically converted to LF (\n) on Msys, but we missed a couple of places when running commands and using their output for comparison, that would lead to failures. This problem has been found thanks to the test added in 5adb067 using TestLib::command_checks_all(), but after a closer look more code paths were missing a filter. This is backpatched all the way down to prevent any surprises if a new test is introduced in stable branches. Reviewed-by: Andrew Dunstan, Álvaro Herrera Discussion: https://postgr.es/m/1252480.1631829409@sss.pgh.pa.us Backpatch-through: 9.6 --- diff --git a/src/test/perl/TestLib.pm b/src/test/perl/TestLib.pm index 35c4732b9e4..151c7a4cce5 100644 --- a/src/test/perl/TestLib.pm +++ b/src/test/perl/TestLib.pm @@ -356,6 +356,7 @@ sub command_like my $result = IPC::Run::run $cmd, '>', \$stdout, '2>', \$stderr; ok($result, "@$cmd exit code 0"); is($stderr, '', "@$cmd no stderr"); + $stdout =~ s/\r\n/\n/g if $Config{osname} eq 'msys'; like($stdout, $expected_stdout, "$test_name: matches"); }