Francois Gouget : testbot/web: Highlight test failures and build errors on the job page.

Alexandre Julliard julliard at winehq.org
Wed Jun 20 17:12:29 CDT 2018


Module: tools
Branch: master
Commit: 822f323e7b3b66cbb07b3883a2a4ab1fc853f5c7
URL:    https://source.winehq.org/git/tools.git/?a=commit;h=822f323e7b3b66cbb07b3883a2a4ab1fc853f5c7

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Wed Jun 20 02:47:08 2018 +0200

testbot/web: Highlight test failures and build errors on the job page.

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>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 f829407..3add52b 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 ebc622e..28ac1b1 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; }




More information about the wine-cvs mailing list