Francois Gouget : testbot/LogUtils: Keep track of the first line of each error group.

Alexandre Julliard julliard at winehq.org
Tue Jan 28 15:29:54 CST 2020


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

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Tue Jan 28 12:12:16 2020 +0100

testbot/LogUtils: Keep track of the first line of each error group.

This will make it possible to jump to the first line of a test unit that
contains failures.

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

---

 testbot/lib/WineTestBot/LogUtils.pm | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/testbot/lib/WineTestBot/LogUtils.pm b/testbot/lib/WineTestBot/LogUtils.pm
index 75d2833..4d0d99b 100644
--- a/testbot/lib/WineTestBot/LogUtils.pm
+++ b/testbot/lib/WineTestBot/LogUtils.pm
@@ -709,16 +709,20 @@ sub _DumpErrors($$)
   }
 }
 
-sub _AddLogGroup($$)
+sub _AddLogGroup($$;$)
 {
-  my ($LogInfo, $GroupName) = @_;
+  my ($LogInfo, $GroupName, $LineNo) = @_;
 
   # In theory the error group names are all unique. But, just in case, make
   # sure we don't overwrite $LogInfo->{ErrGroups}->{$GroupName}.
   if (!$LogInfo->{ErrGroups}->{$GroupName})
   {
     push @{$LogInfo->{ErrGroupNames}}, $GroupName;
-    $LogInfo->{ErrGroups}->{$GroupName} = { LineNos => [], Errors => [] };
+    $LogInfo->{ErrGroups}->{$GroupName} = {
+      LineNo => $LineNo || 0,
+      LineNos => [],
+      Errors => []
+    };
   }
   return $LogInfo->{ErrGroups}->{$GroupName};
 }
@@ -758,6 +762,10 @@ A hashtable indexed by the error group name. Each entry contains:
 
 =over
 
+=item LineNo
+The line number of the start of this error group. Note that this is normally
+different from the line of the first error in that group.
+
 =item Errors
 An array containing the error messages.
 
@@ -798,7 +806,7 @@ sub GetLogErrors($)
   {
     $LogInfo->{ErrCount} ||= 0;
     my $CurrentModule = "";
-    my $CurrentGroup;
+    my ($CurrentGroup, $GroupLineNo);
     my $LineNo = 0;
     foreach my $Line (<$LogFile>)
     {
@@ -807,6 +815,7 @@ sub GetLogErrors($)
       if ($IsReport and $Line =~ /^([_.a-z0-9-]+):[_a-z0-9]* start /)
       {
         $CurrentModule = $1;
+        $GroupLineNo = $LineNo;
         $CurrentGroup = undef;
         next;
       }
@@ -820,7 +829,7 @@ sub GetLogErrors($)
       }
       if (!$CurrentGroup)
       {
-        $CurrentGroup = _AddLogGroup($LogInfo, $CurrentModule);
+        $CurrentGroup = _AddLogGroup($LogInfo, $CurrentModule, $GroupLineNo || $LineNo);
       }
       _AddLogError($LogInfo, $CurrentGroup, $Line, $LineNo);
     }
@@ -848,7 +857,7 @@ sub GetLogErrors($)
         # Note: $GroupName must not depend on the previous content as this
         #       would break diffs.
         my $GroupName = $IsReport ? "Report errors" : "Task errors";
-        $CurrentGroup = _AddLogGroup($LogInfo, $GroupName);
+        $CurrentGroup = _AddLogGroup($LogInfo, $GroupName, $LineNo);
       }
       _AddLogError($LogInfo, $CurrentGroup, $Line, $LineNo);
     }




More information about the wine-cvs mailing list