testbot/bin: Fix the fatal error handling in WineRun{Build,Reconfig}.

Francois Gouget fgouget at codeweavers.com
Tue Oct 30 22:46:36 CDT 2012


Don't call TaskComplete() if we don't have a valid task to start with.
A failed task should have an error report file so create it first.
---
 testbot/bin/WineRunBuild.pl    |   21 ++++++++++-----------
 testbot/bin/WineRunReconfig.pl |   21 ++++++++++-----------
 2 files changed, 20 insertions(+), 22 deletions(-)

diff --git a/testbot/bin/WineRunBuild.pl b/testbot/bin/WineRunBuild.pl
index cc0746f..e886801 100755
--- a/testbot/bin/WineRunBuild.pl
+++ b/testbot/bin/WineRunBuild.pl
@@ -45,6 +45,15 @@ sub FatalError
   my $TaskKey = defined($Task) ? $Task->GetKey() : "0";
 
   LogMsg "$JobKey/$StepKey/$TaskKey $ErrMessage";
+  if ($RptFileName)
+  {
+    my $RPTFILE;
+    if (open RPTFILE, ">>$RptFileName")
+    {
+      print RPTFILE $ErrMessage;
+      close RPTFILE;
+    }
+  }
 
   if ($Task)
   {
@@ -55,20 +64,10 @@ sub FatalError
 
     $Task->VM->Status('dirty');
     $Task->VM->Save();
-  }
 
-  if ($RptFileName)
-  {
-    my $RPTFILE;
-    if (open RPTFILE, ">>$RptFileName")
-    {
-      print RPTFILE $ErrMessage;
-      close RPTFILE;
-    }
+    TaskComplete($JobKey, $StepKey, $TaskKey);
   }
 
-  TaskComplete($JobKey, $StepKey, $TaskKey);
-
   exit 1;
 }
 
diff --git a/testbot/bin/WineRunReconfig.pl b/testbot/bin/WineRunReconfig.pl
index 9cc1e5e..c4d5c49 100755
--- a/testbot/bin/WineRunReconfig.pl
+++ b/testbot/bin/WineRunReconfig.pl
@@ -45,6 +45,15 @@ sub FatalError
   my $TaskKey = defined($Task) ? $Task->GetKey() : "0";
 
   LogMsg "$JobKey/$StepKey/$TaskKey $ErrMessage";
+  if ($RptFileName)
+  {
+    my $RPTFILE;
+    if (open RPTFILE, ">>$RptFileName")
+    {
+      print RPTFILE $ErrMessage;
+      close RPTFILE;
+    }
+  }
 
   if ($Task)
   {
@@ -55,20 +64,10 @@ sub FatalError
 
     $Task->VM->Status('dirty');
     $Task->VM->Save();
-  }
 
-  if ($RptFileName)
-  {
-    my $RPTFILE;
-    if (open RPTFILE, ">>$RptFileName")
-    {
-      print RPTFILE $ErrMessage;
-      close RPTFILE;
-    }
+    TaskComplete($JobKey, $StepKey, $TaskKey);
   }
 
-  TaskComplete($JobKey, $StepKey, $TaskKey);
-
   exit 1;
 }
 
-- 
1.7.10.4




More information about the wine-patches mailing list