Francois Gouget : testbot/JobDetails: Highlight new errors in the full log too.
Alexandre Julliard
julliard at winehq.org
Tue Jan 28 15:29:54 CST 2020
Module: tools
Branch: master
Commit: 399fa0f31f62d257e9d2da3acac3686093c1b39a
URL: https://source.winehq.org/git/tools.git/?a=commit;h=399fa0f31f62d257e9d2da3acac3686093c1b39a
Author: Francois Gouget <fgouget at codeweavers.com>
Date: Tue Jan 28 12:12:07 2020 +0100
testbot/JobDetails: Highlight new errors in the full log too.
Extend $LogInfo to store the 1-based source line number of each error.
For extra errors (i.e. errors not present in the source log), set the
line number to 0.
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
testbot/lib/WineTestBot/LogUtils.pm | 20 ++++++++++++----
testbot/web/JobDetails.pl | 46 +++++++++++++++++++++++++++++++++----
testbot/web/WineTestBot.css | 1 +
3 files changed, 57 insertions(+), 10 deletions(-)
diff --git a/testbot/lib/WineTestBot/LogUtils.pm b/testbot/lib/WineTestBot/LogUtils.pm
index 8187826..75d2833 100644
--- a/testbot/lib/WineTestBot/LogUtils.pm
+++ b/testbot/lib/WineTestBot/LogUtils.pm
@@ -718,16 +718,17 @@ sub _AddLogGroup($$)
if (!$LogInfo->{ErrGroups}->{$GroupName})
{
push @{$LogInfo->{ErrGroupNames}}, $GroupName;
- $LogInfo->{ErrGroups}->{$GroupName} = { Errors => [] };
+ $LogInfo->{ErrGroups}->{$GroupName} = { LineNos => [], Errors => [] };
}
return $LogInfo->{ErrGroups}->{$GroupName};
}
-sub _AddLogError($$$)
+sub _AddLogError($$$;$)
{
- my ($LogInfo, $ErrGroup, $Line) = @_;
+ my ($LogInfo, $ErrGroup, $Line, $LineNo) = @_;
push @{$ErrGroup->{Errors}}, $Line;
+ push @{$ErrGroup->{LineNos}}, $LineNo || 0;
$LogInfo->{ErrCount}++;
}
@@ -756,8 +757,13 @@ An array containing the names of all the error groups.
A hashtable indexed by the error group name. Each entry contains:
=over
+
=item Errors
An array containing the error messages.
+
+=item LineNos
+An array containing the line number of the error in the log file.
+
=back
=back
@@ -793,8 +799,10 @@ sub GetLogErrors($)
$LogInfo->{ErrCount} ||= 0;
my $CurrentModule = "";
my $CurrentGroup;
+ my $LineNo = 0;
foreach my $Line (<$LogFile>)
{
+ $LineNo++;
$Line =~ s/\s*$//;
if ($IsReport and $Line =~ /^([_.a-z0-9-]+):[_a-z0-9]* start /)
{
@@ -814,7 +822,7 @@ sub GetLogErrors($)
{
$CurrentGroup = _AddLogGroup($LogInfo, $CurrentModule);
}
- _AddLogError($LogInfo, $CurrentGroup, $Line);
+ _AddLogError($LogInfo, $CurrentGroup, $Line, $LineNo);
}
close($LogFile);
}
@@ -830,8 +838,10 @@ sub GetLogErrors($)
$LogInfo->{ErrCount} ||= 0;
# Add the related extra errors
my $CurrentGroup;
+ my $LineNo = 0;
foreach my $Line (<$LogFile>)
{
+ $LineNo++;
$Line =~ s/\s*$//;
if (!$CurrentGroup)
{
@@ -840,7 +850,7 @@ sub GetLogErrors($)
my $GroupName = $IsReport ? "Report errors" : "Task errors";
$CurrentGroup = _AddLogGroup($LogInfo, $GroupName);
}
- _AddLogError($LogInfo, $CurrentGroup, $Line);
+ _AddLogError($LogInfo, $CurrentGroup, $Line, $LineNo);
}
close($LogFile);
}
diff --git a/testbot/web/JobDetails.pl b/testbot/web/JobDetails.pl
index 2909eb7..f1ffd49 100644
--- a/testbot/web/JobDetails.pl
+++ b/testbot/web/JobDetails.pl
@@ -351,19 +351,42 @@ sub GetErrorCategory($)
return "error";
}
-sub GenerateFullLog($$$;$)
+sub GenerateFullLog($$$$;$)
{
- my ($self, $FileName, $HideLog, $Header) = @_;
+ my ($self, $FileName, $HideLog, $LogInfo, $Header) = @_;
+
+ my %NewLineNos;
+ if ($LogInfo and $LogInfo->{NewCount})
+ {
+ foreach my $GroupName (@{$LogInfo->{ErrGroupNames}})
+ {
+ my $Group = $LogInfo->{ErrGroups}->{$GroupName};
+ next if (!$Group->{NewCount});
+ if (($FileName =~ /\.err$/) ==
+ ($GroupName =~ /^(?:Report errors|Task errors|TestBot errors)$/))
+ {
+ for my $ErrIndex (0..@{$Group->{Errors}} - 1)
+ {
+ if ($Group->{IsNew}->[$ErrIndex])
+ {
+ $NewLineNos{$Group->{LineNos}->[$ErrIndex]} = 1;
+ }
+ }
+ }
+ }
+ }
my $GetCategory = $FileName =~ /\.err$/ ? \&GetErrorCategory :
$FileName =~ /\.report$/ ? \&GetReportLineCategory :
\&GetLogLineCategory;
+ my $LineNo = 0;
my $IsEmpty = 1;
if (open(my $LogFile, "<", $FileName))
{
foreach my $Line (<$LogFile>)
{
+ $LineNo++;
$Line =~ s/\s*$//;
if ($IsEmpty)
{
@@ -372,8 +395,8 @@ sub GenerateFullLog($$$;$)
$IsEmpty = 0;
}
- my $Category = $GetCategory->($Line);
my $Html = $self->escapeHTML($Line);
+ my $Category = $NewLineNos{$LineNo} ? "fullnew" : $GetCategory->($Line);
if ($Category ne "none")
{
$Html =~ s~^(.*\S)\s*\r?$~<span class='log-$Category'>$1</span>~;
@@ -463,11 +486,24 @@ EOF
# Show this log in full, highlighting the important lines
#
+ my $LogInfo;
+ my $LogFileName = "$TaskDir/$MoreInfo->{Full}";
+ if ($MoreInfo->{Full} =~ /\.report$/)
+ {
+ $LogInfo = GetLogErrors($LogFileName);
+ if ($LogInfo->{ErrCount})
+ {
+ # Identify new errors in test reports
+ my $RefReportPath = $StepTask->GetFullFileName($StepTask->GetRefReportName($MoreInfo->{Full}));
+ TagNewErrors($RefReportPath, $LogInfo);
+ }
+ }
+
my ($Action, $Url) = $self->GetMoreInfoLink($Key, GetLogLabel($MoreInfo->{Full}), "Full", $MoreInfo->{Full});
$Url = $self->CGI->escapeHTML($Url);
my $HideLog = $Action eq "Hide" ? " ondblclick='HideLog(event, \"$Url\")'" : "";
- my $LogIsEmpty = $self->GenerateFullLog("$TaskDir/$MoreInfo->{Full}", $HideLog);
+ my $LogIsEmpty = $self->GenerateFullLog($LogFileName, $HideLog, $LogInfo);
my $EmptyDiag;
if ($LogIsEmpty)
{
@@ -490,7 +526,7 @@ EOF
my $ErrHeader = $MoreInfo->{Full} =~ /\.report/ ? "report" : "task";
$ErrHeader = "old $ErrHeader" if ($MoreInfo->{Full} =~ /^old_/);
$ErrHeader = "<div class='HrTitle'>". ucfirst($ErrHeader) ." errors<div class='HrLine'></div></div>";
- my $ErrIsEmpty = $self->GenerateFullLog("$TaskDir/$MoreInfo->{Full}.err", $HideLog, $ErrHeader);
+ my $ErrIsEmpty = $self->GenerateFullLog("$LogFileName.err", $HideLog, $LogInfo, $ErrHeader);
print $EmptyDiag if ($ErrIsEmpty and defined $EmptyDiag);
}
else
diff --git a/testbot/web/WineTestBot.css b/testbot/web/WineTestBot.css
index f588355..9a23f5f 100644
--- a/testbot/web/WineTestBot.css
+++ b/testbot/web/WineTestBot.css
@@ -402,6 +402,7 @@ pre
.log-boterror { color: #cc0052; }
.log-diag { color: #e56300; }
.log-new { color: #e56e00; font-weight: bold; }
+.log-fullnew { color: red; font-weight: bold; }
a.title { color:inherit; text-decoration: none; }
More information about the wine-cvs
mailing list