[PATCH 2/2] testbot/web: Highlight test failures and build errors on the job page.

Francois Gouget fgouget at codeweavers.com
Tue Jun 19 19:47:08 CDT 2018


Show build errors in the log summary mode (like we already do for the
test failures).
Furthermore, when showing the full log, highlight the test failures and
build errors so they are easier to spot. This uses the same color
scheme as in the test.winehq.org website. Also make the boundaries
between the test units more visible by highlighting their start line.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 testbot/web/JobDetails.pl   | 61 +++++++++++++++++++++++++++++++++----
 testbot/web/WineTestBot.css |  5 +++
 2 files changed, 60 insertions(+), 6 deletions(-)

diff --git a/testbot/web/JobDetails.pl b/testbot/web/JobDetails.pl
index f829407eb..3add52b4c 100644
--- a/testbot/web/JobDetails.pl
+++ b/testbot/web/JobDetails.pl
@@ -228,6 +228,58 @@ sub GeneratePage($)
   $self->SUPER::GeneratePage();
 }
 
+sub GetHtmlLine($$$)
+{
+  my ($self, $FullLog, $Line) = @_;
+
+  $Line = $self->escapeHTML($Line);
+  if ($Line =~ /: Test marked todo: /)
+  {
+    return (undef, $Line) if (!$FullLog);
+    my $Html = $Line;
+    $Html =~ s~^(.*\S)\s*\r?$~<span class='log-todo'>$1</span>~;
+    return ($Html, $Line);
+  }
+  if ($Line =~ /: Tests skipped: / or
+      $Line =~ /^\w+:\w+ skipped /)
+  {
+    return (undef, $Line) if (!$FullLog);
+    my $Html = $Line;
+    $Html =~ s~^(.*\S)\s*\r?$~<span class='log-skip'>$1</span>~;
+    return ($Html, $Line);
+  }
+  if ($Line =~ /: Test (?:failed|succeeded inside todo block): / or
+      $Line =~ /Fatal: test .* does not exist/ or
+      $Line =~ / done \(258\)/ or
+      $Line =~ /: unhandled exception [0-9a-fA-F]{8} at / or
+      $Line =~ /^Unhandled exception: / or
+      # Build errors
+      $Line =~ /: error: / or
+      $Line =~ /^error: patch failed:/ or
+      $Line =~ /^Makefile:[0-9]+: recipe for target .* failed$/ or
+      $Line =~ /^(?:Build|Reconfig|Task): (?!ok)/ or
+      # Typical perl errors
+      $Line =~ /^Use of uninitialized value/)
+  {
+    return ($Line, $Line) if (!$FullLog);
+    my $Html = $Line;
+    $Html =~ s~^(.*\S)\s*\r?$~<span class='log-error'>$1</span>~;
+    return ($Html, $Line);
+  }
+  if ($FullLog &&
+      ($Line =~ /^\+ \S/ or
+       $Line =~ /^\w+:\w+ start / or
+       # Build messages
+       $Line =~ /^(?:Build|Reconfig|Task): ok/))
+  {
+    my $Html = $Line;
+    $Html =~ s~^(.*\S)\s*\r?$~<span class='log-info'>$1</span>~;
+    return ($Html, $Line);
+  }
+
+  return (undef, $Line);
+}
+
 my %MILogLabels = (
   "log" => "task log",
   "log.old" => "old logs",
@@ -371,11 +423,8 @@ sub GenerateBody($)
         {
           $CurrentDll = $1;
         }
-        if ($MoreInfo->{Full} ||
-            $Line =~ m/: Test (?:failed|succeeded inside todo block): / ||
-            $Line =~ m/Fatal: test '[^']+' does not exist/ ||
-            $Line =~ m/ done \(258\)/ ||
-            $Line =~ m/: unhandled exception [0-9a-fA-F]{8} at /)
+        my ($Highlight, $Plain) = $self->GetHtmlLine($MoreInfo->{Full}, $Line);
+        if ($MoreInfo->{Full} || defined $Highlight)
         {
           if ($PrintedDll ne $CurrentDll && !$MoreInfo->{Full})
           {
@@ -402,7 +451,7 @@ sub GenerateBody($)
           }
           else
           {
-            print $self->escapeHTML($Line), "\n";
+            print(($Highlight || $Plain), "\n");
           }
         }
       }
diff --git a/testbot/web/WineTestBot.css b/testbot/web/WineTestBot.css
index ebc622e34..28ac1b1c2 100644
--- a/testbot/web/WineTestBot.css
+++ b/testbot/web/WineTestBot.css
@@ -353,6 +353,11 @@ pre
 .boterror  { color: #e55600; }
 .canceled  { color: black; }
 
+.log-info  { background-color: #d9ffcc; }
+.log-skip  { color: blue; }
+.log-todo  { color: #d08000; }
+.log-error { color: red; }
+
 a.title { color:inherit; text-decoration: none; }
 
 th.Record { text-align: center; }
-- 
2.17.1



More information about the wine-devel mailing list