On Fri, Sep 17, 2021 at 03:18:38PM -0400, Andrew Dunstan wrote:
> The fixups for command_checks_all should go before the loops, not inside
> them.

Right.

> I would probably add a single line like this just after the call that
> checks the status:
> 
>    foreach ($stderr, $stdout) { s/\r\n/\n/g if $Config{osname} eq 'msys'; }

Yes, that works.  Fine by me to use this grammar.

> although maybe perltidy would reformat that.

And perltidy tells me nothing here.
--
Michael
diff --git a/src/bin/pg_checksums/t/002_actions.pl 
b/src/bin/pg_checksums/t/002_actions.pl
index 97492caab4..2cc8b68c75 100644
--- a/src/bin/pg_checksums/t/002_actions.pl
+++ b/src/bin/pg_checksums/t/002_actions.pl
@@ -6,7 +6,6 @@
 
 use strict;
 use warnings;
-use Config;
 use PostgresNode;
 use TestLib;
 
@@ -182,18 +181,13 @@ command_fails(
 # Test postgres -C for an offline cluster.
 # Run-time GUCs are safe to query here.  Note that a lock file is created,
 # then unlinked, leading to an extra LOG entry showing in stderr.
-SKIP:
-{
-       skip "unstable output generated with Msys", 3
-         if ($Config{osname} eq 'msys');
-       command_checks_all(
-               [ 'postgres', '-D', $pgdata, '-C', 'data_checksums' ],
-               0,
-               [qr/^on$/],
-               # LOG entry when unlinking lock file.
-               [qr/database system is shut down/],
-               'data_checksums=on is reported on an offline cluster');
-}
+command_checks_all(
+       [ 'postgres', '-D', $pgdata, '-C', 'data_checksums' ],
+       0,
+       [qr/^on$/],
+       # LOG entry when unlinking lock file.
+       [qr/database system is shut down/],
+       'data_checksums=on is reported on an offline cluster');
 
 # Checks cannot happen with an online cluster
 $node->start;
diff --git a/src/test/perl/TestLib.pm b/src/test/perl/TestLib.pm
index cbab1587cc..15f4e6f56e 100644
--- a/src/test/perl/TestLib.pm
+++ b/src/test/perl/TestLib.pm
@@ -434,6 +434,7 @@ sub run_command
        my ($cmd) = @_;
        my ($stdout, $stderr);
        my $result = IPC::Run::run $cmd, '>', \$stdout, '2>', \$stderr;
+       foreach ($stderr, $stdout) { s/\r\n/\n/g if $Config{osname} eq 'msys'; }
        chomp($stdout);
        chomp($stderr);
        return ($stdout, $stderr);
@@ -878,6 +879,7 @@ sub command_like
        my $result = IPC::Run::run $cmd, '>', \$stdout, '2>', \$stderr;
        ok($result, "$test_name: exit code 0");
        is($stderr, '', "$test_name: no stderr");
+       $stdout =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
        like($stdout, $expected_stdout, "$test_name: matches");
        return;
 }
@@ -930,6 +932,7 @@ sub command_fails_like
        print("# Running: " . join(" ", @{$cmd}) . "\n");
        my $result = IPC::Run::run $cmd, '>', \$stdout, '2>', \$stderr;
        ok(!$result, "$test_name: exit code not 0");
+       $stderr =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
        like($stderr, $expected_stderr, "$test_name: matches");
        return;
 }
@@ -974,6 +977,8 @@ sub command_checks_all
          if $ret & 127;
        $ret = $ret >> 8;
 
+       foreach ($stderr, $stdout) { s/\r\n/\n/g if $Config{osname} eq 'msys'; }
+
        # check status
        ok($ret == $expected_ret,
                "$test_name status (got $ret vs expected $expected_ret)");

Attachment: signature.asc
Description: PGP signature

Reply via email to