[tools] testbot/web: Show more information for running jobs on the main page.

Francois Gouget fgouget at codeweavers.com
Thu Feb 18 09:15:02 CST 2021


The Status column of the main page now distinguishes jobs that actually
have a task running from those that merely have some completed tasks.
It also shows the running failure count for these jobs, which makes it
easier to identify those that have failures before they are completed.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 testbot/web/index.pl | 41 +++++++++++++++++++++++++++++++++++++----
 1 file changed, 37 insertions(+), 4 deletions(-)

diff --git a/testbot/web/index.pl b/testbot/web/index.pl
index c88adfcb8..cc32bdbeb 100644
--- a/testbot/web/index.pl
+++ b/testbot/web/index.pl
@@ -122,19 +122,42 @@ sub GenerateDataCell($$$$)
         );
     my $Status = $Item->Status;
     my $HTMLStatus = $HTMLChunks{$Status} || $Status;
-    if ($Status eq "completed" || $Status eq "boterror" || $Status eq "canceled")
+    if ($Status eq "completed" || $Status eq "running" || $Status eq "boterror" || $Status eq "canceled")
     {
       my $JobInfo = $self->{JobsInfo}->{$Item->Id};
-      if (!exists $JobInfo->{TestFailures})
+
+      my $FailuresPrefix;
+      if ($Status eq "completed")
+      {
+        $FailuresPrefix = "";
+      }
+      elsif ($Status ne "running")
       {
         print $HTMLStatus;
+        $FailuresPrefix = " - ";
+      }
+      elsif ($JobInfo->{IsRunning})
+      {
+        $JobInfo->{DoneTasks} ||= 0;
+        print "<span class='running'>running <small>($JobInfo->{DoneTasks}/$JobInfo->{TaskCount})</small></a>";
+        $FailuresPrefix = " - ";
       }
       else
       {
-        $HTMLStatus = $Status eq "completed" ? "" : "$HTMLStatus - ";
+        $JobInfo->{DoneTasks} ||= 0;
+        print "<span class='running'>queued <small>($JobInfo->{DoneTasks}/$JobInfo->{TaskCount})</small>";
+        $FailuresPrefix = " - ";
+      }
+
+      if (exists $JobInfo->{TestFailures})
+      {
         my $class = $JobInfo->{TestFailures} ? "testfail" : "success";
         my $s = $JobInfo->{TestFailures} == 1 ? "" : "s";
-        print "$HTMLStatus<span class='$class'>$JobInfo->{TestFailures} test failure$s</span>";
+        print "$FailuresPrefix<span class='$class'>$JobInfo->{TestFailures} test failure$s</span>";
+      }
+      elsif ($Status eq "completed")
+      {
+        print $HTMLStatus;
       }
     }
     else
@@ -314,6 +337,16 @@ sub GenerateBody($)
   foreach my $Task (@{$Tasks->GetItems()})
   {
     my $JobInfo = ($JobsCollectionBlock->{JobsInfo}->{$Task->JobId} ||= {});
+    $JobInfo->{TaskCount}++;
+    if ($Task->Status eq "running")
+    {
+      $JobInfo->{IsRunning} = 1;
+    }
+    elsif ($Task->Status ne "queued")
+    {
+      $JobInfo->{DoneTasks}++;
+    }
+
     my $TestFailures = $Task->TestFailures;
     $JobInfo->{TestFailures} += $TestFailures if (defined $TestFailures);
   }
-- 
2.20.1



More information about the wine-devel mailing list