From: Michael Paquier <michael@paquier.xyz>
To: Andrew Dunstan <andrew@dunslane.net>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Support "postgres -C" with runtime-computed GUCs
Date: Sat, 18 Sep 2021 08:18:58 +0900
Message-ID: <YUUiYvhR+Kpuafj+@paquier.xyz> (raw)
In-Reply-To: <22a1c05f-a931-ba46-fb88-ac9680e7816a@dunslane.net>
References: <E1mQglq-0007xB-Jw@gemulon.postgresql.org>
<1252480.1631829409@sss.pgh.pa.us>
<YUPOfPqqbvuZeouS@paquier.xyz>
<YUPlCVfPi1urH/iN@paquier.xyz>
<22a1c05f-a931-ba46-fb88-ac9680e7816a@dunslane.net>
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
Attachments:fix-tap-msys-crlf-2.patch (text/plain, 2.5K) downloaddiff --git a/src/bin/pg_checksums/t/002_actions.pl b/src/bin/pg_checksums/t/002_actions.plindex 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.pmindex 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)");
signature.asc (application/pgp-signature, 832B) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: michael@paquier.xyz, andrew@dunslane.net, tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Support "postgres -C" with runtime-computed GUCs
In-Reply-To: <YUUiYvhR+Kpuafj+@paquier.xyz>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox