]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Improve reporting of pg_upgrade log files on test failure
authorMichael Paquier <michael@paquier.xyz>
Tue, 10 Dec 2024 23:48:53 +0000 (08:48 +0900)
committerMichael Paquier <michael@paquier.xyz>
Tue, 10 Dec 2024 23:48:53 +0000 (08:48 +0900)
On failure, the pg_upgrade log files are automatically appended to the
test log file, but the information reported was inconsistent.

A header, with the log file name, was reported with note(), while the
log contents and a footer used print(), making it harder to diagnose
failures when these are split into console output and test log file
because the pg_upgrade log file path in the header may not be included
in the test log file.

The output is now consolidated so as the header uses print() rather than
note().  An extra note() is added to inform that the contents of a
pg_upgrade log file are appended to the test log file.

The diffs from the regression test suite and dump files all use print()
to show their contents on failure.

Author: Joel Jacobson
Reviewed-by: Daniel Gustafsson
Discussion: https://postgr.es/m/49f7e64a-b9be-4a90-a9fe-210a7740405e@app.fastmail.com
Backpatch-through: 15

src/bin/pg_upgrade/t/002_pg_upgrade.pl

index d1b44adb8a22e98c7a76aaf9acb3168ed2da198b..3bf4e87b178b2fc8dc5b6c4c3f7ef46d79fdb030 100644 (file)
@@ -424,9 +424,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";
        }