Module: tools Branch: master Commit: 4977ed2e9d702fc57e0f94fd9e25dc18a9f9c3b5 URL: https://gitlab.winehq.org/winehq/tools/-/commit/4977ed2e9d702fc57e0f94fd9e25...
Author: Francois Gouget fgouget@codeweavers.com Date: Fri Oct 28 03:01:16 2022 +0200
testbot/web: Show the number of new failures and warnings.
This makes it easier to see which jobs and tasks have new failures. This also makes it obvious when a patch adds new compilation warnings.
---
testbot/web/JobDetails.pl | 31 +++++++++++++++++++-- testbot/web/index.pl | 70 ++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 91 insertions(+), 10 deletions(-)
diff --git a/testbot/web/JobDetails.pl b/testbot/web/JobDetails.pl index 035cba8c..506c7602 100644 --- a/testbot/web/JobDetails.pl +++ b/testbot/web/JobDetails.pl @@ -50,7 +50,7 @@ sub DisplayProperty($$) my ($self, $PropertyDescriptor) = @_;
my $PropertyName = $PropertyDescriptor->GetName(); - return $PropertyName =~ /^(?:Id|PreviousNo|Type|VM|FileType|Missions|NewWarnings|Warnings|NewTestFailures|FailedTestUnits)$/ ? "" : + return $PropertyName =~ /^(?:Id|PreviousNo|Type|VM|FileType|Missions|NewWarnings|NewTestFailures|FailedTestUnits)$/ ? "" : $PropertyName eq "Started" ? ("ro", "timetipdate") : $self->SUPER::DisplayProperty($PropertyDescriptor); } @@ -77,6 +77,14 @@ sub GenerateHeaderView($$$) { print "<a class='title' title='End Time'>Time</a>"; } + elsif ($PropertyName eq "Warnings") + { + print "<a class='title' title='New / All'>Warnings</a>"; + } + elsif ($PropertyName eq "TestFailures") + { + print "<a class='title' title='New / All'>Failures</a>"; + } else { $self->SUPER::GenerateHeaderView($Row, $Col); @@ -132,11 +140,28 @@ sub GenerateDataView($$$) GenerateTipDateTime($StepTask->Ended, DurationToString($Duration)); return; } + if ($PropertyName eq "Warnings" and defined $StepTask->Warnings) + { + print "<a href='#k", $StepTask->GetKey(), "'>"; + if (defined $StepTask->NewWarnings) + { + my $class = $StepTask->NewWarnings ? "testfail" : "success"; + print "<span class='$class'>", $StepTask->NewWarnings, "</span> / "; + } + my $class = $StepTask->Warnings ? "testfail" : "success"; + print "<span class='$class'>", $StepTask->Warnings, "</span></a>"; + return; + } if ($PropertyName eq "TestFailures" and defined $StepTask->TestFailures) { + print "<a href='#k", $StepTask->GetKey(), "'>"; + if (defined $StepTask->NewTestFailures) + { + my $class = $StepTask->NewTestFailures ? "testfail" : "success"; + print "<span class='$class'>", $StepTask->NewTestFailures, "</span> / "; + } my $class = $StepTask->TestFailures ? "testfail" : "success"; - print "<a href='#k", $StepTask->GetKey(), "'><span class='$class'>", - $StepTask->TestFailures, "</span></a>"; + print "<span class='$class'>", $StepTask->TestFailures, "</span></a>"; return; } $self->SUPER::GenerateDataView($Row, $Col); diff --git a/testbot/web/index.pl b/testbot/web/index.pl index a3b26ea9..087b80fa 100644 --- a/testbot/web/index.pl +++ b/testbot/web/index.pl @@ -25,6 +25,7 @@ package JobStatusBlock; use ObjectModel::CGI::CollectionBlock; our @ISA = qw(ObjectModel::CGI::CollectionBlock);
+use ObjectModel::BasicPropertyDescriptor; use ObjectModel::CGI::ValueFormatter;
use WineTestBot::Branches; @@ -34,14 +35,33 @@ use WineTestBot::Utils; my $DAYS_DEFAULT = 4;
+sub GetPropertyDescriptors($) +{ + my ($self) = @_; + + # Add some extra columns + my @PropertyDescriptors; + foreach my $PropertyDescriptor (@{$self->{Collection}->GetPropertyDescriptors()}) + { + my $PropertyName = $PropertyDescriptor->GetName(); + next if ($PropertyName =~ /^(?:Branch|User|PatchId|Patch)$/); + next if ($PropertyName eq "BranchName" and !CreateBranches()->MultipleBranchesPresent); + if ($PropertyName eq "Status") + { + push @PropertyDescriptors, CreateBasicPropertyDescriptor("Warnings", "Warnings", !1, !1, "N", 6); + } + push @PropertyDescriptors, $PropertyDescriptor; + } + + return @PropertyDescriptors; +} + sub DisplayProperty($$) { my ($self, $PropertyDescriptor) = @_;
my $PropertyName = $PropertyDescriptor->GetName(); - return $PropertyName =~ /^(?:Branch|User|PatchId|Patch)$/ ? "" : - $PropertyName eq "Submitted" ? ("ro", "timetipdate") : - ($PropertyName eq "BranchName" and !CreateBranches()->MultipleBranchesPresent) ? "" : + return $PropertyName eq "Submitted" ? ("ro", "timetipdate") : $self->SUPER::DisplayProperty($PropertyDescriptor); }
@@ -54,6 +74,14 @@ sub GenerateHeaderView($$$) { print "<a class='title' title='Higher values indicate a lower priority'>Nice</a>"; } + elsif ($PropertyName eq "Status") + { + print "<a class='title' title='Status - New / All failures'>Status</a>"; + } + elsif ($PropertyName eq "Warnings") + { + print "<a class='title' title='New / All warnings'>Warnings</a>"; + } elsif ($PropertyName eq "Submitted") { print "<a class='title' title='Date'>Submitted</a>"; @@ -86,6 +114,26 @@ sub GenerateDataView($$$) print $self->escapeHTML($Job->UserName); } } + elsif ($PropertyName eq "Warnings") + { + my $JobInfo = $self->{JobsInfo}->{$Job->Id}; + if (!exists $JobInfo->{Warnings}) + { + print " "; + } + else + { + my $DetailsLink = $self->GetDetailsLink($Row); + print "<a id='job", $Job->Id, "' href='", $self->escapeHTML($DetailsLink), "'>"; + if (exists $JobInfo->{NewWarnings}) + { + my $class = $JobInfo->{NewWarnings} ? "testfail" : "success"; + print "<span class='$class'>$JobInfo->{NewWarnings}</span> / "; + } + my $class = $JobInfo->{Warnings} ? "testfail" : "success"; + print "<span class='$class'>$JobInfo->{Warnings}</span></a>"; + } + } elsif ($PropertyName eq "Status") { my $DetailsLink = $self->GetDetailsLink($Row); @@ -131,9 +179,14 @@ sub GenerateDataView($$$)
if (exists $JobInfo->{TestFailures}) { + print $FailuresPrefix; + if (defined $JobInfo->{NewTestFailures}) + { + my $class = $JobInfo->{NewTestFailures} ? "testfail" : "success"; + print "<span class='$class'>$JobInfo->{NewTestFailures}</span> / "; + } my $class = $JobInfo->{TestFailures} ? "testfail" : "success"; - my $s = $JobInfo->{TestFailures} == 1 ? "" : "s"; - print "$FailuresPrefix<span class='$class'>$JobInfo->{TestFailures} test failure$s</span>"; + print "<span class='$class'>$JobInfo->{TestFailures}</span>"; } elsif ($Status eq "completed") { @@ -320,8 +373,11 @@ sub GenerateBody($) $JobInfo->{DoneTasks}++; }
- my $TestFailures = $Task->TestFailures; - $JobInfo->{TestFailures} += $TestFailures if (defined $TestFailures); + foreach my $Counter ("TestFailures", "NewTestFailures", "Warnings", "NewWarnings") + { + my $Value = $Task->$Counter; + $JobInfo->{$Counter} += $Value if (defined $Value); + } }
$JobsCollectionBlock->GenerateList();