Francois Gouget : testbot: Deduplicate matching errors in ParseWineTestReport().

Alexandre Julliard julliard at winehq.org
Mon Feb 22 15:29:55 CST 2021


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

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Mon Feb 22 06:26:28 2021 +0100

testbot: Deduplicate matching errors in ParseWineTestReport().

Let ParseWineTestReport() populate the list of errors, and only use
GetReportLineCategory() as a fallback.

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

---

 testbot/lib/WineTestBot/LogUtils.pm | 59 +++++++++++++++++++++++--------------
 1 file changed, 37 insertions(+), 22 deletions(-)

diff --git a/testbot/lib/WineTestBot/LogUtils.pm b/testbot/lib/WineTestBot/LogUtils.pm
index dae8292..267dcd9 100644
--- a/testbot/lib/WineTestBot/LogUtils.pm
+++ b/testbot/lib/WineTestBot/LogUtils.pm
@@ -368,6 +368,8 @@ sub _NewCurrentUnit($$)
     IsBroken => 0,
     Rc => undef,
     Pids => {},
+    Group => undef,
+    GroupLineNo => 0,
   };
 }
 
@@ -462,6 +464,25 @@ sub _CloseTestUnit($$$)
   $LogInfo->{Failures} += $Cur->{LineFailures};
 }
 
+sub _AddReportError($$$$)
+{
+  my ($LogInfo, $Cur, $LineNo, $Line) = @_;
+
+  # Make the timeout messages more user-friendly
+  my $ErrLine = $Line;
+  if ($ErrLine =~ /^[^:]+:([^:]*):[0-9a-f]+ done \(258\)/)
+  {
+    my $Unit = $1;
+    $ErrLine = $Unit ne "" ? "$Unit: Timeout" : "Timeout";
+  }
+
+  if (!$Cur->{Group})
+  {
+    $Cur->{Group} = _AddLogGroup($LogInfo, $Cur->{Dll}, $Cur->{GroupLineNo} || $LineNo);
+  }
+  _AddLogError($LogInfo, $Cur->{Group}, $ErrLine, $LineNo);
+}
+
 =pod
 =over 12
 
@@ -522,8 +543,6 @@ sub ParseWineTestReport($$$)
   }
 
   my $LineNo = 0;
-  my $CurGroupName = "";
-  my ($CurGroup, $CurGroupLineNo);
   my $Cur = _NewCurrentUnit("", "");
   foreach my $Line (<$LogFile>)
   {
@@ -533,23 +552,6 @@ sub ParseWineTestReport($$$)
     chomp $Line;
     $Line =~ s/\r+$//;
 
-    if (GetReportLineCategory($Line) eq "error")
-    {
-      # Make the timeout messages more user-friendly
-      my $ErrLine = $Line;
-      if ($ErrLine =~ /^[^:]+:([^:]*):[0-9a-f]+ done \(258\)/)
-      {
-        my $Unit = $1;
-        $ErrLine = $Unit ne "" ? "$Unit: Timeout" : "Timeout";
-      }
-
-      if (!$CurGroup)
-      {
-        $CurGroup = _AddLogGroup($LogInfo, $CurGroupName, $CurGroupLineNo || $LineNo);
-      }
-      _AddLogError($LogInfo, $CurGroup, $ErrLine, $LineNo);
-    }
-
     if ($Line =~ m%^([_.a-z0-9-]+):([_a-z0-9]*) (start|skipped) (?:-|[/_.a-z0-9-]+) (?:-|[.0-9a-f]+)$%)
     {
       my ($Dll, $Unit, $Type) = ($1, $2, $3);
@@ -563,9 +565,8 @@ sub ParseWineTestReport($$$)
       $Cur->{Rc} = 0 if ($Type eq "skipped");
 
       # The next error will be in a new error group
-      $CurGroupName = $Dll;
-      $CurGroupLineNo = $LineNo;
-      $CurGroup = undef;
+      $Cur->{GroupLineNo} = $LineNo;
+      $Cur->{Group} = undef;
     }
     elsif ($Line =~ /^([_.a-z0-9-]+)\.c:\d+: Subtest ([_.a-z0-9-]+)$/)
     {
@@ -586,6 +587,7 @@ sub ParseWineTestReport($$$)
            $Line =~ /^([_a-z0-9]+)\.c:\d+: Test (?:failed|succeeded inside todo block): /)
     {
       _CheckUnit($LogInfo, $Cur, $1, "failure");
+      _AddReportError($LogInfo, $Cur, $LineNo, $Line);
       $Cur->{LineFailures}++;
     }
     elsif (($Cur->{Unit} ne "" and
@@ -614,6 +616,7 @@ sub ParseWineTestReport($$$)
       $Cur->{SummaryFailures}++;
       $LogInfo->{IsWineTest} = 1;
 
+      _AddReportError($LogInfo, $Cur, $LineNo, $Line);
       $Cur->{LineFailures}++;
     }
     elsif (($Cur->{Unit} ne "" and
@@ -629,6 +632,7 @@ sub ParseWineTestReport($$$)
         $Cur->{SummaryFailures}++;
       }
       _CheckUnit($LogInfo, $Cur, $Unit, "unhandled exception");
+      _AddReportError($LogInfo, $Cur, $LineNo, $Line);
       $Cur->{LineFailures}++;
     }
     elsif ($Line =~ /Unhandled exception: .* in .* code /)
@@ -636,6 +640,7 @@ sub ParseWineTestReport($$$)
       # This also replaces a test summary line. The pid is unknown so use 0.
       $Cur->{Pids}->{0} = 1;
       $Cur->{SummaryFailures}++;
+      _AddReportError($LogInfo, $Cur, $LineNo, $Line);
       $Cur->{LineFailures}++;
     }
     elsif (($Cur->{Unit} ne "" and
@@ -650,6 +655,7 @@ sub ParseWineTestReport($$$)
         $Cur->{SummaryFailures}++;
       }
       _CheckUnit($LogInfo, $Cur, $Unit, "child exception");
+      _AddReportError($LogInfo, $Cur, $LineNo, $Line);
       $Cur->{LineFailures}++;
     }
     elsif (($Cur->{Unit} ne "" and
@@ -704,6 +710,7 @@ sub ParseWineTestReport($$$)
         $LogInfo->{Failures}++;
         $Cur->{IsBroken} = 1;
         $LogInfo->{TimeoutCount}++;
+        _AddReportError($LogInfo, $Cur, $LineNo, $&);
       }
       elsif ((!$Pid and !%{$Cur->{Pids}}) or
              ($Pid and !$Cur->{Pids}->{$Pid} and !$Cur->{Pids}->{0}))
@@ -729,6 +736,14 @@ sub ParseWineTestReport($$$)
       }
       $Cur->{Rc} = $Rc;
     }
+    elsif (GetReportLineCategory($Line) eq "error")
+    {
+      # This should only happen on very garbled lines, or if there is an
+      # inconsistency between GetReportLineCategory() and
+      # ParseWineTestReport().
+      _AddReportError($LogInfo, $Cur, $LineNo, $Line);
+    }
+
   }
   $Cur->{IsBroken} = 1 if ($LogInfo->{TaskTimedOut});
   _CloseTestUnit($LogInfo, $Cur, 1);




More information about the wine-cvs mailing list