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

Commitaf2e67b

Browse files
committed
Cleanup some code related to pgbench log checks in TAP tests
This fixes a couple of problems within the so-said code of this commitsubject:- Replace the use of open() with slurp_file(), fixing an issue reportedby buildfarm member fairywren whose perl installation keep around CRLFcharacters, causing the matching patterns for the logs to fail.- Remove the eval block, which is not really necessary.This set of issues has come into light after fixing a different issuewithc13585f, and this is wrong since this code has been introduced.Reported-by: Andrew Dunstan, and buildfarm member fairywrenAuthor: Michael PaquierReviewed-by: Andrew DunstanDiscussion:https://postgr.es/m/0f49303e-7784-b3ee-200b-cbf67be2eb9e@dunslane.netBackpatch-through: 11
1 parent372a280 commitaf2e67b

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

‎src/bin/pgbench/t/001_pgbench_with_server.pl

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,18 +1063,27 @@ sub check_pgbench_logs
10631063
my$log_number = 0;
10641064
formy$log (sort@logs)
10651065
{
1066-
eval {
1067-
openmy$fh,'<',$logordie"$@";
1068-
my@contents = <$fh>;
1069-
my$clen =@contents;
1070-
ok($min <=$clen &&$clen <=$max,
1071-
"transaction count for$log ($clen)");
1072-
ok(grep(/$re/,@contents) ==$clen,
1073-
"transaction format for$prefix");
1074-
close$fhordie"$@";
1075-
};
1066+
# Check the contents of each log file.
1067+
my$contents_raw = slurp_file($log);
1068+
1069+
my@contents =split(/\n/,$contents_raw);
1070+
my$clen =@contents;
1071+
ok($min <=$clen &&$clen <=$max,
1072+
"transaction count for$log ($clen)");
1073+
my$clen_match =grep(/$re/,@contents);
1074+
ok($clen_match ==$clen,"transaction format for$prefix");
1075+
1076+
# Show more information if some logs don't match
1077+
# to help with debugging.
1078+
if ($clen_match !=$clen)
1079+
{
1080+
foreachmy$log (@contents)
1081+
{
1082+
print"# Log entry not matching:$log\n"
1083+
unless$log =~/$re/;
1084+
}
1085+
}
10761086
}
1077-
ok(unlink(@logs),"remove log files");
10781087
return;
10791088
}
10801089

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp