Francois Gouget : testbot: Split the log and report line category detection.

Alexandre Julliard julliard at winehq.org
Thu Jul 19 12:08:51 CDT 2018


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

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Thu Jul 19 12:10:41 2018 +0200

testbot: Split the log and report line category detection.

This avoids false positives for cases such as lines containing
'error:' in test reports.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 testbot/bin/WineSendLog.pl          |   8 ++-
 testbot/lib/WineTestBot/LogUtils.pm | 105 +++++++++++++++++++++++-------------
 testbot/web/JobDetails.pl           |  12 +++--
 3 files changed, 82 insertions(+), 43 deletions(-)

diff --git a/testbot/bin/WineSendLog.pl b/testbot/bin/WineSendLog.pl
index f1cb74e..e2c823a 100755
--- a/testbot/bin/WineSendLog.pl
+++ b/testbot/bin/WineSendLog.pl
@@ -300,7 +300,9 @@ EOF
         {
           $CurrentDll = $1;
         }
-        my $Category = GetLogLineCategory($Line);
+        my $Category = $LogName =~ /\.report$/ ?
+                       GetReportLineCategory($Line) :
+                       GetLogLineCategory($Line);
         if ($Category eq "error")
         {
           if ($PrintedDll ne $CurrentDll)
@@ -488,7 +490,9 @@ EOF
     {
       foreach my $Line (<$LogFile>)
       {
-        my $Category = GetLogLineCategory($Line);
+        my $Category = $LogName =~ /\.report$/ ?
+                       GetReportLineCategory($Line) :
+                       GetLogLineCategory($Line);
         $MessagesFromLog .= $Line if ($Category eq "error");
       }
       close($LogFile);
diff --git a/testbot/lib/WineTestBot/LogUtils.pm b/testbot/lib/WineTestBot/LogUtils.pm
index cabd183..e6f9a27 100644
--- a/testbot/lib/WineTestBot/LogUtils.pm
+++ b/testbot/lib/WineTestBot/LogUtils.pm
@@ -27,7 +27,8 @@ WineTestBot::LogUtils - Provides functions to parse task logs
 
 
 use Exporter 'import';
-our @EXPORT = qw(GetLogFileNames GetLogLabel GetLogLineCategory
+our @EXPORT = qw(GetLogFileNames GetLogLabel
+                 GetLogLineCategory GetReportLineCategory
                  ParseTaskLog ParseWineTestReport);
 
 use File::Basename;
@@ -80,6 +81,59 @@ sub ParseTaskLog($$)
 }
 
 
+=pod
+=over 12
+
+=item C<GetLogLineCategory()>
+
+Identifies the category of the given log line: an error message, a Wine
+diagnostic line, a TestBot error, etc.
+
+The category can then be used to decide whether to hide the line or, on
+the contrary, highlight it.
+
+=back
+=cut
+
+sub GetLogLineCategory($)
+{
+  my ($Line) = @_;
+
+  if (# Git errors
+      $Line =~ /^CONFLICT / or
+      $Line =~ /^error: patch failed:/ or
+      $Line =~ /^error: corrupt patch / or
+      # Build errors
+      $Line =~ /: error: / or
+      $Line =~ /^make: [*]{3} No rule to make target / 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 "error";
+  }
+  if ($Line =~ /:winediag:/)
+  {
+    return "diag";
+  }
+  if ($Line =~ /^BotError:/ or
+      $Line =~ /^X Error of failed request: / or
+      $Line =~ / opcode of failed request: /)
+  {
+    return "boterror";
+  }
+  if (# Build messages
+      $Line =~ /^\+ \S/ or
+      $Line =~ /^(?:Build|Reconfig|Task): ok/)
+  {
+    return "info";
+  }
+
+  return "none";
+}
+
+
 #
 # WineTest report parser
 #
@@ -383,23 +437,21 @@ sub ParseWineTestReport($$$$)
 }
 
 
-#
-# Log querying and formatting
-#
-
 =pod
 =over 12
 
-=item C<GetLogLineCategory()>
+=item C<GetReportLineCategory()>
+
+Identifies the category of the given test report line: an error message,
+a todo, just an informational message or none of these.
 
-Identifies the category of the given log line: an error message, a todo, just
-an informational message or none of these. The category can then be used to
-decide whether to hide the line or, on the contrary, highlight it.
+The category can then be used to decide whether to hide the line or, on
+the contrary, highlight it.
 
 =back
 =cut
 
-sub GetLogLineCategory($)
+sub GetReportLineCategory($)
 {
   my ($Line) = @_;
 
@@ -416,35 +468,11 @@ sub GetLogLineCategory($)
       $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
-      # Git errors
-      $Line =~ /^CONFLICT / or
-      $Line =~ /^error: patch failed:/ or
-      $Line =~ /^error: corrupt patch / or
-      # Build errors
-      $Line =~ /: error: / or
-      $Line =~ /^make: [*]{3} No rule to make target / or
-      $Line =~ /^Makefile:[0-9]+: recipe for target .* failed$/ or
-      $Line =~ /^(?:Build|Reconfig|Task): (?!ok)/ or
-      # Typical perl errors
-      $Line =~ /^Use of uninitialized value/)
+      $Line =~ /^Unhandled exception: /)
   {
     return "error";
   }
-  if ($Line =~ /:winediag:/)
-  {
-    return "diag";
-  }
-  if ($Line =~ /^BotError:/ or
-      $Line =~ /^X Error of failed request: / or
-      $Line =~ / opcode of failed request: /)
-  {
-    return "boterror";
-  }
-  if ($Line =~ /^\+ \S/ or
-      $Line =~ /^[_.a-z0-9-]+:[_a-z0-9]* start / or
-      # Build messages
-      $Line =~ /^(?:Build|Reconfig|Task): ok/)
+  if ($Line =~ /^[_.a-z0-9-]+:[_a-z0-9]* start /)
   {
     return "info";
   }
@@ -452,6 +480,11 @@ sub GetLogLineCategory($)
   return "none";
 }
 
+
+#
+# Log querying and formatting
+#
+
 =pod
 =over 12
 
diff --git a/testbot/web/JobDetails.pl b/testbot/web/JobDetails.pl
index 3fcec5d..ee4e539 100644
--- a/testbot/web/JobDetails.pl
+++ b/testbot/web/JobDetails.pl
@@ -245,11 +245,13 @@ highlighted to make the log more readable.
 =back
 =cut
 
-sub GetHtmlLine($$$)
+sub GetHtmlLine($$$$)
 {
-  my ($self, $FullLog, $Line) = @_;
+  my ($self, $LogName, $FullLog, $Line) = @_;
 
-  my $Category = GetLogLineCategory($Line);
+  my $Category = $LogName =~ /\.report$/ ?
+                 GetReportLineCategory($Line) :
+                 GetLogLineCategory($Line);
   return undef if ($Category !~ /error/ and !$FullLog);
 
   my $Html = $self->escapeHTML($Line);
@@ -403,7 +405,7 @@ sub GenerateBody($)
         $HasLogEntries = 1;
         chomp $Line;
         $CurrentDll = $1 if ($Line =~ m/^([_.a-z0-9-]+):[_a-z0-9]* start /);
-        my $Html = $self->GetHtmlLine($MoreInfo->{Full}, $Line);
+        my $Html = $self->GetHtmlLine($LogName, $MoreInfo->{Full}, $Line);
         next if (!defined $Html);
 
         if ($PrintedDll ne $CurrentDll && !$MoreInfo->{Full})
@@ -476,7 +478,7 @@ sub GenerateBody($)
           print "<pre><code>";
           $ErrFirst = 0;
         }
-        print $self->GetHtmlLine(1, $Line), "\n";
+        print $self->GetHtmlLine($ErrName, 1, $Line), "\n";
       }
       close($ErrFile);
 




More information about the wine-cvs mailing list