Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit73db8f4

Browse files
committed
Improve handling and logging of TAP tests for pg_upgrade
This commit includes a set of improvements to help with the debugging offailures in these new TAP tests:- Instead of a plain diff command to compare the dumps generated, useFile::Compare::compare for the same effect. diff is still used toprovide more context in the event of an error.- Log the contents of regression.diffs if the pg_regress command fails.- Unify the format of the logs generated, getting inspiration from thestyle used in 027_stream_regress.pl.wrasse is the only buildfarm member that has reported a failure untilnow after the introduction of322becb, complaining that the dumpsgenerated do not match, and I am lacking information to understand whatis going in this environment.
1 parent322becb commit73db8f4

File tree

1 file changed

+31
-9
lines changed

1 file changed

+31
-9
lines changed

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

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Cwdqw(abs_path getcwd);
66
use File::Basenameqw(dirname);
7+
use File::Compare;
78

89
use PostgreSQL::Test::Cluster;
910
use PostgreSQL::Test::Utils;
@@ -111,8 +112,18 @@ sub generate_db
111112
$inputdir
112113
];
113114

114-
$oldnode->command_ok(@regress_command,
115-
'regression test run on old instance');
115+
my$rc = run_log(@regress_command);
116+
if ($rc != 0)
117+
{
118+
# Dump out the regression diffs file, if there is one
119+
my$diffs ="$outputdir/regression.diffs";
120+
if (-e$diffs)
121+
{
122+
print"=== dumping$diffs ===\n";
123+
print slurp_file($diffs);
124+
print"=== EOF ===\n";
125+
}
126+
}
116127
}
117128

118129
# Before dumping, get rid of objects not existing or not supported in later
@@ -214,11 +225,9 @@ sub generate_db
214225
{
215226
foreachmy$log (glob("$log_path/*"))
216227
{
217-
note"###########################";
218-
note"Contents of log file$log";
219-
note"###########################";
220-
my$log_contents = slurp_file($log);
221-
print"$log_contents\n";
228+
note"=== contents of$log ===\n";
229+
print slurp_file($log);
230+
print"=== EOF ===\n";
222231
}
223232
}
224233

@@ -231,7 +240,20 @@ sub generate_db
231240
]);
232241

233242
# Compare the two dumps, there should be no differences.
234-
command_ok(['diff','-q',"$tempdir/dump1.sql","$tempdir/dump2.sql" ],
235-
'old and new dump match after pg_upgrade');
243+
my$compare_res = compare("$tempdir/dump1.sql","$tempdir/dump2.sql");
244+
is($compare_res, 0,'old and new dumps match after pg_upgrade');
245+
246+
# Provide more context if the dumps do not match.
247+
if ($compare_res != 0)
248+
{
249+
my ($stdout,$stderr) =
250+
run_command(['diff',"$tempdir/dump1.sql","$tempdir/dump2.sql" ]);
251+
print"=== diff of$tempdir/dump1.sql and$tempdir/dump2.sql\n";
252+
print"=== stdout ===\n";
253+
print$stdout;
254+
print"=== stderr ===\n";
255+
print$stderr;
256+
print"=== EOF ===\n";
257+
}
236258

237259
done_testing();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp