[tools 5/6] testbot/WineSendLog: Take into account the known failures.

Francois Gouget fgouget at codeweavers.com
Wed Jun 15 11:21:51 CDT 2022


Don't count known failures as new failures, in particular when updating
the patches site.
Add links to the WineHQ bugs for known failures found in the logs.
And identify the bug each known failure line corresponds to.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48912
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 testbot/bin/WineSendLog.pl | 78 ++++++++++++++++++++++++++------------
 1 file changed, 54 insertions(+), 24 deletions(-)

diff --git a/testbot/bin/WineSendLog.pl b/testbot/bin/WineSendLog.pl
index 3897ac034..a2f2369b6 100755
--- a/testbot/bin/WineSendLog.pl
+++ b/testbot/bin/WineSendLog.pl
@@ -44,6 +44,7 @@ $Name0 =~ s+^.*/++;
 use Algorithm::Diff;
 
 use WineTestBot::Config;
+use WineTestBot::Failures;
 use WineTestBot::Jobs;
 use WineTestBot::Log;
 use WineTestBot::LogUtils;
@@ -177,10 +178,11 @@ sub SendLog($)
   # Collect and count the new and old failures, etc.
   #
 
-  my (@New, $JobInfo);
-  my ($NewCount, $OldCount, $BotCount, $NotRun) = (0, 0, 0, 0);
+  my ($JobInfo, @New, %BugDescriptions);
+  my ($NewCount, $FailCount, $OldCount, $BotCount, $NotRun) = (0, 0, 0, 0, 0);
   my $FileType = "test executable";
 
+  my $Failures = CreateFailures($Job);
   my $StepsTasks = CreateStepsTasks(undef, $Job);
   my $SortedStepsTasks = $StepsTasks->GetSortedItems();
   foreach my $StepTask (@$SortedStepsTasks)
@@ -193,12 +195,13 @@ sub SendLog($)
 
     my $TaskDir = $StepTask->GetTaskDir();
     my $LogNames = GetLogFileNames($TaskDir);
-    $JobInfo->{$StepTask->Id}->{LogNames} = $LogNames;
-    $JobInfo->{$StepTask->Id}->{NewCount} = 0;
-    $JobInfo->{$StepTask->Id}->{OldCount} = 0;
+    my $TaskInfo = $JobInfo->{$StepTask->Id} = {};
+    $TaskInfo->{LogNames} = $LogNames;
+    $TaskInfo->{NewCount} = 0;
+    $TaskInfo->{OldCount} = 0;
     if ($StepTask->Status eq "boterror")
     {
-      $JobInfo->{$StepTask->Id}->{BotCount} = 1;
+      $TaskInfo->{BotCount} = 1;
       $BotCount++;
     }
     $FileType = "patch" if ($StepTask->FileType eq "patch");
@@ -207,7 +210,7 @@ sub SendLog($)
     {
       my $LogInfo = LoadLogErrors("$TaskDir/$LogName");
       next if (!defined $LogInfo->{BadLog} and !$LogInfo->{ErrCount});
-      $JobInfo->{$StepTask->Id}->{$LogName} = $LogInfo;
+      $TaskInfo->{$LogName} = $LogInfo;
 
       my $HasLogHeader;
       foreach my $GroupName (@{$LogInfo->{ErrGroupNames}})
@@ -216,7 +219,21 @@ sub SendLog($)
         my $Group = $LogInfo->{ErrGroups}->{$GroupName};
         foreach my $ErrIndex (0..$#{$Group->{Errors}})
         {
-          if ($Group->{IsNew}->[$ErrIndex])
+          my $LineNo = $Group->{LineNos}->[$ErrIndex];
+          my $LineFailureIds = $Group->{Failures}->{$ErrIndex};
+          if ($LineFailureIds)
+          {
+            foreach my $FailureId (@$LineFailureIds)
+            {
+              my $Failure = $Failures->GetItem($FailureId);
+              next if (!$Failure);
+              $BugDescriptions{$Failure->BugId} = $Failure->BugDescription;
+              # Add bug information to $LogInfo
+              push @{$LogInfo->{Bugs}->{$LineNo}}, $Failure->BugId;
+            }
+            $TaskInfo->{OldCount}++;
+          }
+          elsif ($Group->{IsNew}->[$ErrIndex])
           {
             if (!$HasLogHeader)
             {
@@ -229,16 +246,16 @@ sub SendLog($)
               $HasGroupHeader = 1;
             }
             push @New, "$Group->{Errors}->[$ErrIndex]\n";
-            $JobInfo->{$StepTask->Id}->{NewCount}++;
+            $TaskInfo->{NewCount}++;
           }
           else
           {
-            $JobInfo->{$StepTask->Id}->{OldCount}++;
+            $TaskInfo->{OldCount}++;
           }
         }
       }
-      $NewCount += $JobInfo->{$StepTask->Id}->{NewCount};
-      $OldCount += $JobInfo->{$StepTask->Id}->{OldCount};
+      $NewCount += $TaskInfo->{NewCount};
+      $OldCount += $TaskInfo->{OldCount};
     }
   }
 
@@ -281,10 +298,9 @@ sub SendLog($)
     {
       print $Sendmail <<"EOF";
 It looks like your $FileType introduces some new failures. Please
-investigate and fix them if they are indeed new. Note that rare
-failures and failures with always changing text (e.g. because of memory
-addresses) can cause false positives. If this is what happened, then
-fixing those would really help.
+investigate and fix them if they are indeed new. If they are not new,
+fixing them anyway would help a lot. Otherwise please ask for the known
+failures list to be updated.
 
 EOF
     }
@@ -309,10 +325,21 @@ EOF
     if ($OldCount)
     {
       print $Sendmail <<"EOF";
-Some preexisting failures (not caused by your $FileType) happened.
+There are some preexisting failures (not caused by your $FileType).
 If you know how to fix them that would be helpful.
-
 EOF
+      if (%BugDescriptions)
+      {
+        print $Sendmail <<"EOF";
+In particular some failures are tracked in the bug(s) below:
+EOF
+        foreach my $BugId (sort { $a <=> $b } keys %BugDescriptions)
+        {
+          print $Sendmail "* $BugId - $BugDescriptions{$BugId}\n";
+          print $Sendmail "  $WineBugUrl$BugId\n";
+        }
+        print $Sendmail "\n";
+      }
     }
 
     print $Sendmail "                                Failures\n";
@@ -360,7 +387,7 @@ EOF
       my $TaskDir = $StepTask->GetTaskDir();
       foreach my $LogName (@{$TaskInfo->{LogNames}})
       {
-        my $LogInfo = LoadLogErrors("$TaskDir/$LogName");
+        my $LogInfo = $TaskInfo->{$LogName};
         next if (!defined $LogInfo->{BadLog} and !$LogInfo->{ErrCount});
 
         print $Sendmail "\n=== ", GetTitle($StepTask, $LogName), " ===\n";
@@ -372,7 +399,11 @@ EOF
           my $Group = $LogInfo->{ErrGroups}->{$GroupName};
           foreach my $ErrIndex (0..$#{$Group->{Errors}})
           {
-            my $Prefix = $Group->{IsNew}->[$ErrIndex] ? "new" : "old";
+            my $LineNo = $Group->{LineNos}->[$ErrIndex];
+            my $Bugs = $LogInfo->{Bugs}->{$LineNo};
+            my $Prefix = $Bugs ? join(" ", sort { $a <=> $b } @$Bugs) :
+                         $Group->{IsNew}->[$ErrIndex] ? "new" :
+                         "old";
             print $Sendmail "[$Prefix] $Group->{Errors}->[$ErrIndex]\n";
           }
         }
@@ -433,10 +464,9 @@ EOF
     {
       print $Sendmail <<"EOF";
 It looks like your $FileType introduced the new failures shown below.
-Please investigate and fix them if they are indeed new. Note that rare
-failures and failures with always changing text (e.g. because of memory
-addresses) can cause false positives. If this is what happened, then
-fixing those would really help.
+Please investigate and fix them before resubmitting your $FileType.
+If they are not new, fixing them anyway would help a lot. Otherwise
+please ask for the known failures list to be updated.
 
 EOF
     }
-- 
2.30.2




More information about the wine-devel mailing list