From: Joel Jacobson <joel@compiler.org>
To: daniel@yesql.se <daniel@yesql.se>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: Inconsistent output handling in 002_pg_upgrade.pl test logs
Date: Mon, 28 Oct 2024 16:44:48 +0100
Message-ID: <5fed8e00-e353-49e3-b962-220df7321bbc@app.fastmail.com> (raw)
In-Reply-To: <3D0A223A-2D28-42B8-877F-337589C2A627@yesql.se>
References: <49f7e64a-b9be-4a90-a9fe-210a7740405e@app.fastmail.com>
<3D0A223A-2D28-42B8-877F-337589C2A627@yesql.se>
On Mon, Oct 28, 2024, at 13:44, Daniel Gustafsson wrote:
>> On 28 Oct 2024, at 13:38, Joel Jacobson <joel@compiler.org> wrote:
>>
>> Hi hackers,
>>
>> I've noticed some inconsistency in 002_pg_upgrade.pl in how it handles output
>> during test failures. Currently, it uses note to print the header:
>>
>> note "=== contents of $log ===\n";
>>
>> but print for the log content and footer:
>>
>> print slurp_file($log);
>> print "=== EOF ===\n";
>
> Ugh, nice catch.
>
>> Option 1: Keep output together using note
>
>> Option 2: Adjust header message for separate logs
>
>> Thoughts on these options?
>
> I would prefer to output this to the log only and not the TAP output, to avoid
> the risk of not seeing the test output for all the log output on the screen.
I also think that's best, and in line with what we do in other parts of the same script.
Patch attached.
/Joel
Attachments:0001-Fix-inconsistent-output-handling-in-002_pg_upgrade.p.patch (application/octet-stream, 1.2K) download
From 45f44e32e7ba46923c4df167a448ba20fccece26 Mon Sep 17 00:00:00 2001
From: Joel Jacobson <joel@compiler.org>
Date: Mon, 28 Oct 2024 16:38:21 +0100
Subject: [PATCH] Fix inconsistent output handling in 002_pg_upgrade.pl test
logs.
Ensure that both log headers and contents are appended to the dedicated test
logfile instead of splitting between TAP output and the logfile.
When pg_upgrade logs are found, notify the user of the logfile location.
---
src/bin/pg_upgrade/t/002_pg_upgrade.pl | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.plindex 17af2ce61e..78bd776f5b 100644--- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl+++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl@@ -475,9 +475,14 @@ if (-d $log_path)
if $File::Find::name =~ m/.*\.log/;
},
$newnode->data_dir . "/pg_upgrade_output.d");
++ my $test_logfile = $PostgreSQL::Test::Utils::test_logfile;++ note "=== pg_upgrade logs found - appending to $test_logfile ===\n";
foreach my $log (@log_files)
{
- note "=== contents of $log ===\n";+ note "=== appending $log ===\n";+ print "=== contents of $log ===\n";
print slurp_file($log);
print "=== EOF ===\n";
}
--
2.45.1
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-hackers@postgresql.org
Cc: joel@compiler.org, daniel@yesql.se, pgsql-hackers@lists.postgresql.org
Subject: Re: Inconsistent output handling in 002_pg_upgrade.pl test logs
In-Reply-To: <5fed8e00-e353-49e3-b962-220df7321bbc@app.fastmail.com>
* 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