[16/25] testbot/UpdateTaskLogs: Delete reference reports that are not supposed to exist.

Francois Gouget fgouget at codeweavers.com
Tue Jan 14 09:42:33 CST 2020


WineRunBuild used to take a snapshot of the reference logs for all the
other tasks even if the build failed. Thus there could be reference logs
even when the matching log does not exist.
This patch ensures that 'UpdateTaskLogs --delete' still finds and
deletes those.
---
 testbot/bin/UpdateTaskLogs | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/testbot/bin/UpdateTaskLogs b/testbot/bin/UpdateTaskLogs
index e0af09768..2ce192f0b 100755
--- a/testbot/bin/UpdateTaskLogs
+++ b/testbot/bin/UpdateTaskLogs
@@ -252,12 +252,17 @@ sub ProcessTaskLogs($$$)
 
   if (($OptDelete or $OptRebuild) and !$CollectOnly)
   {
-    # Save / delete the task's reference reports
-    foreach my $LogName (@{GetLogFileNames($TaskDir)})
+    # Save / delete the task's reference reports... all of them,
+    # even if they were not supposed to exist (e.g. failed builds).
+    my ($ErrMessage, $ReportNames, $_TaskMissions) = $Task->GetReportNames();
+    if ($ErrMessage)
     {
-      next if ($LogName !~ /\.report$/);
-
-      my $RefReportName = $Task->GetRefReportName($LogName);
+      Error "$ErrMessage\n";
+      $Rc = 1;
+    }
+    foreach my $ReportName (@$ReportNames)
+    {
+      my $RefReportName = $Task->GetRefReportName($ReportName);
       my $RefReportPath = "$StepDir/$RefReportName";
 
       if (-f $RefReportPath or -f "$RefReportPath.err")
@@ -276,7 +281,7 @@ sub ProcessTaskLogs($$$)
 
         # Save this report to latest/ in case it's not already present there
         # (this would be the case for the oldest tasks with --rebuild)
-        $Rc += DoUpdateLatestReport($Task, $LogName, $RefReportPath);
+        $Rc += DoUpdateLatestReport($Task, $ReportName, $RefReportPath);
 
         Debug(TaskKeyStr($Task) .": Deleting ../$RefReportName\n");
       }
@@ -289,11 +294,11 @@ sub ProcessTaskLogs($$$)
         }
       }
 
-      next if (!-f "$TaskDir/$LogName.err");
-      Debug(TaskKeyStr($Task) .": Deleting $LogName.err\n");
-      if (!unlink "$TaskDir/$LogName.err")
+      next if (!-f "$TaskDir/$ReportName.err");
+      Debug(TaskKeyStr($Task) .": Deleting $ReportName.err\n");
+      if (!unlink "$TaskDir/$ReportName.err")
       {
-        Error "Could not delete '$LogName.err': $!\n";
+        Error "Could not delete '$ReportName.err': $!\n";
         $Rc = 1;
       }
     }
-- 
2.20.1




More information about the wine-devel mailing list