Module: tools
Branch: master
Commit: 5753c5abf6641914a3f7fe396196e22aa11f1918
URL: https://source.winehq.org/git/tools.git/?a=commit;h=5753c5abf6641914a3f7fe3…
Author: Francois Gouget <fgouget(a)codeweavers.com>
Date: Mon Jun 11 18:44:16 2018 +0200
testbot: Make it possible to get an unfiltered clone of a collection.
Once a filter has been applied to a collection it cannot be removed.
This is particularly a problem on Detailref collections (such as
$Job->Steps) as the code that has set the filter may be anywhere.
So Clone() makes it possible to get an unfiltered copy of the
collection without modifying the original collection's filter, and
thus without impacting the code using it.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
testbot/lib/ObjectModel/Collection.pm | 34 +++++++++++++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/testbot/lib/ObjectModel/Collection.pm b/testbot/lib/ObjectModel/Collection.pm
index 712172b..c110c98 100644
--- a/testbot/lib/ObjectModel/Collection.pm
+++ b/testbot/lib/ObjectModel/Collection.pm
@@ -40,7 +40,7 @@ criteria.
use Exporter 'import';
our @EXPORT_OK = qw(new ComputeMasterKey);
-use Scalar::Util qw(weaken);
+use Scalar::Util qw(blessed weaken);
use ObjectModel::BackEnd;
use ObjectModel::Item;
@@ -114,6 +114,38 @@ sub _initialize($;$)
$self->{AllScopeItems}->{ref($self)} ||= {};
}
+=pod
+=over 12
+
+=item C<Clone()>
+
+Clones the collection, omitting the filters that were applied to it.
+
+=back
+=cut
+
+sub Clone($)
+{
+ my ($self) = @_;
+
+ my $Copy = {TableName => $self->{TableName},
+ CollectionName => $self->{CollectionName},
+ ItemName => $self->{ItemName},
+ PropertyDescriptors => $self->{PropertyDescriptors},
+ MasterColNames => $self->{MasterColNames},
+ MasterColValues => $self->{MasterColValues},
+ MasterKey => $self->{MasterKey},
+ Filters => {},
+ AllScopeItems => $self->{AllScopeItems},
+ Items => undef};
+ # See Collection::new()
+ weaken($Copy->{AllScopeItems});
+
+ $Copy = bless $Copy, blessed($self);
+ $Copy->_initialize(@_);
+ return $Copy;
+}
+
sub GetPropertyDescriptors($)
{
my ($self) = @_;
Module: tools
Branch: master
Commit: 33e6bd11d7af3f7e961775b3cbbe6d4dd148b04b
URL: https://source.winehq.org/git/tools.git/?a=commit;h=33e6bd11d7af3f7e961775b…
Author: Francois Gouget <fgouget(a)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(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)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;