[tools] testbot: Update the failures 'last seen' fields.

Francois Gouget fgouget at codeweavers.com
Thu Jun 16 11:24:07 CDT 2022


Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48912
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
I lost that bit at some point :-(
---
 testbot/lib/WineTestBot/LogUtils.pm | 24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/testbot/lib/WineTestBot/LogUtils.pm b/testbot/lib/WineTestBot/LogUtils.pm
index b8aaaa43c..e25ea3ae2 100644
--- a/testbot/lib/WineTestBot/LogUtils.pm
+++ b/testbot/lib/WineTestBot/LogUtils.pm
@@ -1435,11 +1435,14 @@ sub MatchLogFailures($$)
 
 =item C<SaveLogFailures()>
 
-Updates the TaskFailures objects for the task and log specified by the
-$LogFailures structure.
+Updates the Failures and TaskFailures objects for the task and log specified
+by the $LogFailures structure.
 
-Note that this implies deleting any preexisting TaskFailure to avoid leaving
-obsolete data.
+Notes:
+* This implies deleting any preexisting TaskFailure to avoid leaving obsolete
+  data.
+* This also updates the failures LastNew and LastOld fields which can however
+  not be undone.
 
 =back
 =cut
@@ -1457,15 +1460,26 @@ sub SaveLogFailures($)
   return $ErrMessage if (defined $ErrMessage);
   return undef if (!$LogFailures->{Failures});
 
+  my $Started = $LogFailures->{Task}->Started;
   foreach my $LogFailure (values %{$LogFailures->{Failures}})
   {
-    my $TaskFailure = $LogFailure->{Failure}->TaskFailures->Add();
+    my $Failure = $LogFailure->{Failure};
+    my $TaskFailure = $Failure->TaskFailures->Add();
     my $OldKey = $TaskFailure->GetKey();
     $TaskFailure->Task($LogFailures->{Task});
     $TaskFailure->TaskLog($LogFailures->{LogName});
     $TaskFailure->KeyChanged($OldKey, $TaskFailure->GetKey());
     $TaskFailure->NewCount($LogFailure->{NewCount});
     $TaskFailure->OldCount($LogFailure->{OldCount});
+
+    if ($LogFailure->{NewCount} and ($Failure->LastNew || 0) < $Started)
+    {
+      $Failure->LastNew($Started);
+    }
+    if ($LogFailure->{OldCount} and ($Failure->LastOld || 0) < $Started)
+    {
+      $Failure->LastOld($Started);
+    }
   }
 
   (my $_ErrKey, my $_ErrProperty, $ErrMessage) = $LogFailures->{Collection}->Save();
-- 
2.30.2




More information about the wine-devel mailing list