Francois Gouget : testbot: Switch Patches::Submit() to the new job staging standard.

Alexandre Julliard julliard at winehq.org
Mon Jun 11 09:49:49 CDT 2018


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

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Thu Jun  7 00:32:00 2018 +0200

testbot: Switch Patches::Submit() to the new job staging standard.

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

---

 testbot/lib/WineTestBot/Patches.pm | 30 ++++++++++++++++++++++--------
 1 file changed, 22 insertions(+), 8 deletions(-)

diff --git a/testbot/lib/WineTestBot/Patches.pm b/testbot/lib/WineTestBot/Patches.pm
index 4f42813..e349dfe 100644
--- a/testbot/lib/WineTestBot/Patches.pm
+++ b/testbot/lib/WineTestBot/Patches.pm
@@ -166,7 +166,6 @@ sub Submit($$$)
 
     # Create a new job for this patch
     my $NewJob = $Jobs->Add();
-    $NewJob->Status("queued");
     $NewJob->User($User);
     $NewJob->Priority(6);
     my $PropertyDescriptor = $Jobs->GetPropertyDescriptorByName("Remarks");
@@ -181,11 +180,9 @@ sub Submit($$$)
     # Add build step to the job
     my $Steps = $NewJob->Steps;
     my $NewStep = $Steps->Add();
-    # Create a link to the patch file in the staging dir
-    my $StagingFileName = CreateNewLink($PatchFileName, "$DataDir/staging", "_patch.diff");
-    $NewStep->FileName(basename($StagingFileName));
+    $NewStep->FileName("patch.diff");
     $NewStep->FileType($TestInfo->{Type});
-    $NewStep->InStaging(1);
+    $NewStep->InStaging(!1);
     $NewStep->Type("build");
     $NewStep->DebugLevel(0);
   
@@ -198,7 +195,7 @@ sub Submit($$$)
     $Task->VM($BuildVM);
     $Task->Timeout($BuildTimeout);
 
-    # Save this step (&job+task) so the others can reference it
+    # Save the build step so other steps can reference it
     my ($ErrKey, $ErrProperty, $ErrMessage) = $Jobs->Save();
     if (defined($ErrMessage))
     {
@@ -206,6 +203,13 @@ sub Submit($$$)
       return $ErrMessage;
     }
 
+    # Stage the patch so it can be picked up by the job
+    if (!link($PatchFileName, "$DataDir/staging/job". $NewJob->Id ."_patch.diff"))
+    {
+      $self->Disposition("Failed to prepare patch file");
+      return $!;
+    }
+
     foreach my $Unit (sort keys %{$TestInfo->{Units}})
     {
       # Add 32 and 64-bit tasks
@@ -217,7 +221,7 @@ sub Submit($$$)
         if (@{$VMs->GetKeys()})
         {
           # Create the corresponding Step
-          $NewStep = $Steps->Add();
+          my $NewStep = $Steps->Add();
           $NewStep->PreviousNo(1);
           my $FileName = $TestInfo->{ExeBase};
           $FileName .= "64" if ($Bits eq "64");
@@ -240,13 +244,23 @@ sub Submit($$$)
       }
     }
 
+    # Save it all
     ($ErrKey, $ErrProperty, $ErrMessage) = $Jobs->Save();
-    if (defined($ErrMessage))
+    if (defined $ErrMessage)
     {
       $self->Disposition("Failed to submit job");
       return $ErrMessage;
     }
 
+    # Switch Status to staging to indicate we are done setting up the job
+    $NewJob->Status("staging");
+    ($ErrKey, $ErrProperty, $ErrMessage) = $Jobs->Save();
+    if (defined $ErrMessage)
+    {
+      $self->Disposition("Failed to submit job (staging)");
+      return $ErrMessage;
+    }
+
     if ($First)
     {
       $First = !1;




More information about the wine-cvs mailing list