Long logs can make it hard to find the lines for a given failure. So add an index pointing to the first line of a given failure (identified by its bug id). Also add links to the first and last failure.
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- testbot/web/JobDetails.pl | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-)
diff --git a/testbot/web/JobDetails.pl b/testbot/web/JobDetails.pl index efdd4d9b0..6d3f13cd0 100644 --- a/testbot/web/JobDetails.pl +++ b/testbot/web/JobDetails.pl @@ -404,9 +404,9 @@ sub GetFailureLinks($$) } @$FailureIds); }
-sub GenerateFullLog($$$$) +sub GenerateFullLog($$$$$) { - my ($self, $Dir, $LogName, $HideLog) = @_; + my ($self, $Dir, $LogId, $LogName, $HideLog) = @_;
my $LogInfo = LoadLogErrors("$Dir/$LogName"); if (defined $LogInfo->{BadLog}) @@ -426,7 +426,7 @@ sub GenerateFullLog($$$$) print "<pre class='log-note'>Some WineTest results could not be used to detect new errors: $LogInfo->{BadRef}</pre>\n"; }
- my (%ErrCategory, %ErrFailures); + my (%ErrCategory, %ErrFailures, %LogBugs); foreach my $GroupName (@{$LogInfo->{ErrGroupNames}}) { my $Group = $LogInfo->{ErrGroups}->{$GroupName}; @@ -437,8 +437,31 @@ sub GenerateFullLog($$$$) { $ErrCategory{$LineNo} = $Group->{IsNew}->[$ErrIndex] ? "fullnew" : "error"; $ErrFailures{$LineNo} = $Group->{Failures}->{$ErrIndex}; + + if ($ErrFailures{$LineNo}) + { + foreach my $FailureId (@{$ErrFailures{$LineNo}}) + { + my $Failure = $self->{Failures}->GetItem($FailureId); + $LogBugs{$Failure->BugId} ||= [$LineNo, $Failure->BugDescription]; + } + } } + $LogBugs{-1} ||= [$LineNo, ""]; + $LogBugs{9999999} = [$LineNo, ""]; + } + } + if (%LogBugs) + { + print "<p>Failures index:"; + foreach my $Label (sort { $a <=> $b } keys %LogBugs) + { + my ($LineNo, $Title) = @{$LogBugs{$Label}}; + $Label = $Label < 0 ? "First" : $Label == 9999999 ? "Last" : $Label; + $Title = " title='". $self->escapeHTML($Title) ."'" if ($Title); + print " <a href='#k${LogId}L$LineNo'$Title>$Label</a>" } + print "</p>\n"; }
my $GetCategory = $LogName =~ /.report$/ ? &GetReportLineCategory : @@ -463,7 +486,7 @@ sub GenerateFullLog($$$$) my $Category = $ErrCategory{$LineNo} || $GetCategory->($Line); if ($Category ne "none") { - $Html =~ s~^(.*\S)\s*\r?$~<span class='log-$Category'>$1</span>~; + $Html =~ s~^(.*\S)\s*\r?$~<span id='k${LogId}L$LineNo' class='log-$Category'>$1</span>~; } if ($ErrFailures{$LineNo}) { @@ -487,7 +510,10 @@ sub GenerateFullLog($$$$) # Extra groups don't have a line number next if ($Group->{LineNo});
- print "<div class='LogDllName'>$GroupName</div>\n"; + # Extra errors don't have line numbers but there should be few of them. + # So just create one id for them all so the shortcut to the first / last + # error has somewhere to go even if it's not 100% accurate. + print "<div id='k${LogId}L0' class='LogDllName'>$GroupName</div>\n"; for my $ErrIndex (0..$#{$Group->{Errors}}) { if ($IsEmpty) @@ -592,7 +618,7 @@ EOF $Url = $self->escapeHTML($Url); my $HideLog = $Action eq "Hide" ? " ondblclick='HideLog(event, "$Url")'" : "";
- my $LogIsEmpty = $self->GenerateFullLog($TaskDir, $MoreInfo->{Full}, $HideLog); + my $LogIsEmpty = $self->GenerateFullLog($TaskDir, $StepTask->GetKey(), $MoreInfo->{Full}, $HideLog); if ($LogIsEmpty) { if ($StepTask->Status eq "canceled")