Francois Gouget : testbot: Improve error checking when combining patchset parts.

Alexandre Julliard julliard at winehq.org
Mon Sep 24 12:22:58 CDT 2018


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

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Mon Sep 24 12:37:14 2018 +0200

testbot: Improve error checking when combining patchset parts.

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

---

 testbot/lib/WineTestBot/PendingPatchSets.pm | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/testbot/lib/WineTestBot/PendingPatchSets.pm b/testbot/lib/WineTestBot/PendingPatchSets.pm
index 4ef7a66..3ac8c53 100644
--- a/testbot/lib/WineTestBot/PendingPatchSets.pm
+++ b/testbot/lib/WineTestBot/PendingPatchSets.pm
@@ -106,20 +106,33 @@ sub SubmitSubset($$$)
   my ($CombinedFile, $CombinedFileName) = OpenNewFile("$DataDir/staging", "_patch");
   return "Could not create a combined patch file: $!" if (!$CombinedFile);
 
-  my $Parts = $self->Parts;
+  my $ErrMessage;
   for (my $PartNo = 1; $PartNo <= $MaxPart; $PartNo++)
   {
-    my $Part = $Parts->GetItem($PartNo);
-    if (defined $Part and
-        open(my $PartFile, "<" , "$DataDir/patches/" . $Part->Patch->Id))
+    my $Part = $self->Parts->GetItem($PartNo);
+    if (!defined $Part)
+    {
+      $ErrMessage = "Could not find part $PartNo / $MaxPart";
+      last;
+    }
+
+    if (open(my $PartFile, "<" , "$DataDir/patches/" . $Part->Patch->Id))
     {
       print $CombinedFile $_ for (<$PartFile>);
       close($PartFile);
     }
+    else
+    {
+      $ErrMessage = "Could not open part $PartNo for reading: $!";
+      last;
+    }
   }
   close($CombinedFile);
 
-  my $ErrMessage = $FinalPatch->Submit($CombinedFileName, 1);
+  if (!defined $ErrMessage)
+  {
+    $ErrMessage = $FinalPatch->Submit($CombinedFileName, 1);
+  }
   unlink($CombinedFileName);
 
   return $ErrMessage;




More information about the wine-cvs mailing list