Module: tools
Branch: master
Commit: de68e426859f08ccc0906adc9ee1c5ba5fea7fd4
URL: https://source.winehq.org/git/tools.git/?a=commit;h=de68e426859f08ccc0906ad…
Author: Francois Gouget <fgouget(a)codeweavers.com>
Date: Thu Sep 19 15:02:14 2019 +0200
testbot/LibvirtTool: Check the VM state before putting it back online.
Normally GetSnapshotName() returns undef when the domain is busy
reverting. But that's an undocumented feature and the the VM may end up
in a state where GetSnapshotName() returns undef despite the VM being
usable (e.g. powered off after a failed revert).
So check the Libvirt domain state instead.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
testbot/bin/LibvirtTool.pl | 46 ++++++++++----------------------
testbot/lib/WineTestBot/LibvirtDomain.pm | 21 +++++++++++++++
2 files changed, 35 insertions(+), 32 deletions(-)
diff --git a/testbot/bin/LibvirtTool.pl b/testbot/bin/LibvirtTool.pl
index f15bab7..dca5a92 100755
--- a/testbot/bin/LibvirtTool.pl
+++ b/testbot/bin/LibvirtTool.pl
@@ -282,42 +282,24 @@ sub Monitor()
return 0;
}
- my ($ErrMessage, $SnapshotName) = $VM->GetDomain()->GetSnapshotName();
- if (defined $ErrMessage)
- {
- Error "$ErrMessage\n";
- }
- else
+ my $IsReady = $VM->GetDomain()->IsReady();
+ if ($IsReady and $VM->GetDomain()->IsPoweredOn())
{
- my $IsPoweredOn;
- if (!defined $SnapshotName)
- {
- Debug("$VMKey has no snapshot (reverting?)\n");
- $IsPoweredOn = undef;
- }
- elsif (!defined $SnapshotName or $SnapshotName ne $VM->IdleSnapshot)
- {
- $IsPoweredOn = 0;
- }
- else
- {
- $IsPoweredOn = $VM->GetDomain()->IsPoweredOn();
- if ($IsPoweredOn)
- {
- $ErrMessage = $VM->GetDomain()->PowerOff();
- Error "$ErrMessage\n" if (defined $ErrMessage);
- $IsPoweredOn = undef;
- }
- }
- if (defined $IsPoweredOn)
+ my $ErrMessage = $VM->GetDomain()->PowerOff();
+ if (defined $ErrMessage)
{
- return 1 if (ChangeStatus("offline", "off", "done"));
- NotifyAdministrator("The $VMKey VM is working again",
- "The $VMKey VM started working again after ".
- PrettyElapsed($Start) .".");
- return 0;
+ Error "$ErrMessage\n";
+ $IsReady = undef;
}
}
+ if ($IsReady)
+ {
+ return 1 if (ChangeStatus("offline", "off", "done"));
+ NotifyAdministrator("The $VMKey VM is working again",
+ "The $VMKey VM started working again after ".
+ PrettyElapsed($Start) .".");
+ return 0;
+ }
Debug(Elapsed($Start), " $VMKey is still unreachable\n");
sleep(60);
diff --git a/testbot/lib/WineTestBot/LibvirtDomain.pm b/testbot/lib/WineTestBot/LibvirtDomain.pm
index 8d9b9df..f0a8c69 100644
--- a/testbot/lib/WineTestBot/LibvirtDomain.pm
+++ b/testbot/lib/WineTestBot/LibvirtDomain.pm
@@ -363,6 +363,27 @@ sub IsPoweredOn($)
return ($State == Sys::Virt::Domain::STATE_RUNNING);
}
+sub IsReady($)
+{
+ my ($self) = @_;
+
+ my ($ErrMessage, $Domain) = $self->_GetDomain();
+ if (defined $ErrMessage)
+ {
+ $@ = $ErrMessage;
+ return undef;
+ }
+
+ my ($State, $_Reason);
+ eval { ($State, $_Reason) = $Domain->get_state() };
+ return $self->_Reset(undef) if ($@);
+ return ($State == Sys::Virt::Domain::STATE_RUNNING or
+ $State == Sys::Virt::Domain::STATE_SHUTOFF or
+ $State == Sys::Virt::Domain::STATE_CRASHED or
+ $State == Sys::Virt::Domain::STATE_PMSUSPENDED
+ );
+}
+
sub _GetStateName($)
{
my ($State) = @_;
Module: tools
Branch: master
Commit: 9937fccca36c3908b0d0fbd00201db7ba09c3cd0
URL: https://source.winehq.org/git/tools.git/?a=commit;h=9937fccca36c3908b0d0fbd…
Author: Francois Gouget <fgouget(a)codeweavers.com>
Date: Thu Sep 19 15:01:34 2019 +0200
testbot: Separate running reconfig and winetest Wine VM tasks.
The reconfig task updates and rebuilds Wine and is a high priority
task because patches should always be applied on top of the latest
Wine version.
In contrast re-running WineTest normally does not impact the test
results much and thus should not get in the way of providing the
results to the developpers in a timely manner.
But priorities are set at the job level. So create a first high priority
job for the reconfig tasks, and create a separate low priority job if
and when these tasks complete successfully.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
testbot/bin/CheckForWinetestUpdate.pl | 159 ++++++++++++++++++++--------------
testbot/bin/WineRunReconfig.pl | 6 ++
2 files changed, 102 insertions(+), 63 deletions(-)
diff --git a/testbot/bin/CheckForWinetestUpdate.pl b/testbot/bin/CheckForWinetestUpdate.pl
index c677af2..7e58afc 100755
--- a/testbot/bin/CheckForWinetestUpdate.pl
+++ b/testbot/bin/CheckForWinetestUpdate.pl
@@ -69,7 +69,8 @@ my %TaskTypes = (build => "Update and rebuild Wine on the build VMs.",
base32 => "Run WineTest on the 32 bit Windows VMs with the 'base' role.",
other32 => "Run WineTest on the 32 bit Windows VMs with the 'winetest' role.",
all64 => "Run WineTest on the all the 64 bit Windows VMs.",
- wine => "Update, rebuild and run WineTest on the Wine VMs.");
+ winebuild => "Update and rebuild Wine on the Wine VMs.",
+ winetest => "Run WineTest on the Wine VMs.");
my $Debug;
@@ -275,6 +276,86 @@ sub AddJob($$$$)
return 1;
}
+sub AddWineTestJob($)
+{
+ my ($VMKey) = @_;
+
+ my $Remarks = defined $VMKey ? "$VMKey VM" : "Wine VMs";
+ $Remarks = "WineTest: $Remarks";
+ Debug("Creating the '$Remarks' job\n");
+
+ my $VMs = CreateVMs();
+ $VMs->AddFilter("Name", [$VMKey]) if (defined $VMKey);
+ $VMs->AddFilter("Type", ["wine"]);
+ $VMs->FilterEnabledRole();
+ if ($VMs->GetItemsCount() == 0)
+ {
+ if (defined $VMKey)
+ {
+ Error "The $VMKey VM is not a wine VM\n";
+ return 0;
+ }
+ # There is nothing to do
+ Debug(" Found no VM\n");
+ return 1;
+ }
+
+ # First create a new job
+ my $Jobs = CreateJobs();
+ my $NewJob = $Jobs->Add();
+ $NewJob->User(GetBatchUser());
+ $NewJob->Priority(7);
+ $NewJob->Remarks($Remarks);
+ my $Steps = $NewJob->Steps;
+
+ # Add a step for each VM
+ my $SortedKeys = $VMs->SortKeysBySortOrder($VMs->GetKeys());
+ foreach my $VMKey (@$SortedKeys)
+ {
+ my $VM = $VMs->GetItem($VMKey);
+ # Move all the missions into separate tasks so we don't have one very
+ # long task hogging the VM forever. Note that this is also ok because
+ # the WineTest tasks don't have to recompile Wine.
+ my $MissionStatement = SplitMissionStatementTasks($VM->Missions);
+ my ($ErrMessage, $Missions) = ParseMissionStatement($MissionStatement);
+ if (defined $ErrMessage)
+ {
+ Debug("$VMKey has an invalid mission statement: $!\n");
+ next;
+ }
+
+ my $Tasks;
+ foreach my $TaskMissions (@$Missions)
+ {
+ if (!$Tasks)
+ {
+ # Add a step to the job
+ my $TestStep = $Steps->Add();
+ $TestStep->Type("suite");
+ $TestStep->FileType("none");
+ $Tasks = $TestStep->Tasks;
+ }
+
+ Debug(" $VMKey $TaskMissions->{Statement}\n");
+ my $Task = $Tasks->Add();
+ $Task->VM($VM);
+ $Task->Timeout(GetTestTimeout(undef, $TaskMissions));
+ $Task->Missions($TaskMissions->{Statement});
+ }
+ }
+
+ # Save it all
+ $NewJob->Status("staging");
+ my ($ErrKey, $ErrProperty, $ErrMessage) = $Jobs->Save();
+ if (defined $ErrMessage)
+ {
+ Error "Failed to save the WineTest job: $ErrMessage\n";
+ return 0;
+ }
+
+ return 1;
+}
+
sub AddReconfigJob($$)
{
my ($VMKey, $VMType) = @_;
@@ -312,7 +393,7 @@ sub AddReconfigJob($$)
$BuildStep->Type("reconfig");
$BuildStep->FileType("none");
- # And a task for each VM
+ # Add a task for each VM
my $SortedKeys = $VMs->SortKeysBySortOrder($VMs->GetKeys());
foreach my $VMKey (@$SortedKeys)
{
@@ -339,67 +420,12 @@ sub AddReconfigJob($$)
$Task->Missions($Missions->[0]->{Statement});
}
- # Save the build step so the others can reference it.
- my ($ErrKey, $ErrProperty, $ErrMessage) = $Jobs->Save();
- if (defined $ErrMessage)
- {
- Error "Failed to save the build step: $ErrMessage\n";
- return 0;
- }
-
- if ($VMType eq "wine")
- {
- # Add steps to run WineTest on Wine
- my $Tasks;
- foreach my $VMKey (@$SortedKeys)
- {
- my $VM = $VMs->GetItem($VMKey);
- # Move all the missions into separate tasks so we don't have one very
- # long task hogging the VM forever. Note that this also ok because the
- # WineTest tasks don't have to recompile Wine.
- my $MissionStatement = SplitMissionStatementTasks($VM->Missions);
- my ($ErrMessage, $Missions) = ParseMissionStatement($MissionStatement);
- if (defined $ErrMessage)
- {
- Debug("$VMKey has an invalid mission statement: $!\n");
- next;
- }
-
- foreach my $TaskMissions (@$Missions)
- {
- if (!$Tasks)
- {
- # Add a step to the job
- my $TestStep = $Steps->Add();
- $TestStep->PreviousNo($BuildStep->No);
- $TestStep->Type("suite");
- $TestStep->FileType("none");
- $Tasks = $TestStep->Tasks;
- }
-
- Debug(" $VMKey $TaskMissions->{Statement}\n");
- my $Task = $Tasks->Add();
- $Task->VM($VM);
- $Task->Timeout(GetTestTimeout(undef, $TaskMissions));
- $Task->Missions($TaskMissions->{Statement});
- }
- }
- }
-
# Save it all
- ($ErrKey, $ErrProperty, $ErrMessage) = $Jobs->Save();
- if (defined $ErrMessage)
- {
- Error "Failed to save the Reconfig job: $ErrMessage\n";
- return 0;
- }
-
- # Switch Status to staging to indicate we are done setting up the job
$NewJob->Status("staging");
- ($ErrKey, $ErrProperty, $ErrMessage) = $Jobs->Save();
+ my ($ErrKey, $ErrProperty, $ErrMessage) = $Jobs->Save();
if (defined $ErrMessage)
{
- Error "Failed to save the Reconfig job (staging): $ErrMessage\n";
+ Error "Failed to save the Reconfig job: $ErrMessage\n";
return 0;
}
@@ -478,7 +504,13 @@ if (!defined $Usage)
{
if (!defined $OptVMKey)
{
- %OptTypes = %TaskTypes if (!%OptTypes);
+ # By default create all types of jobs except the winetest ones which will
+ # be created for each Wine VM by the corresponding winebuild task.
+ if (!%OptTypes)
+ {
+ %OptTypes = %TaskTypes;
+ delete $OptTypes{winetest};
+ }
}
elsif ($OptVMKey =~ /^([a-zA-Z0-9_]+)$/)
{
@@ -492,7 +524,7 @@ if (!defined $Usage)
elsif (!%OptTypes)
{
%OptTypes = $VM->Type eq "build" ? ("build" => 1) :
- $VM->Type eq "wine" ? ("wine" => 1) :
+ $VM->Type eq "wine" ? ("winebuild" => 1) :
$VM->Type eq "win32" ? ("base32" => 1) :
("base32" => 1, "all64" => 1);
}
@@ -522,7 +554,7 @@ if (defined $Usage)
my $Rc = 0;
if ($OptTypes{build} or $OptTypes{base32} or $OptTypes{other32} or
- $OptTypes{wine})
+ $OptTypes{winebuild} or $OptTypes{winetest})
{
my ($Create, $LatestBaseName) = UpdateWineTest($OptCreate, "exe32");
if ($Create < 0)
@@ -538,7 +570,8 @@ if ($OptTypes{build} or $OptTypes{base32} or $OptTypes{other32} or
$Rc = 1 if ($OptTypes{base32} and !AddJob($OptVMKey, "base", $LatestBaseName, "exe32"));
$Rc = 1 if ($OptTypes{other32} and !AddJob($OptVMKey, "other", $LatestBaseName, "exe32"));
- $Rc = 1 if ($OptTypes{wine} and !AddReconfigJob($OptVMKey, "wine"));
+ $Rc = 1 if ($OptTypes{winebuild} and !AddReconfigJob($OptVMKey, "wine"));
+ $Rc = 1 if ($OptTypes{winetest} and !AddWineTestJob($OptVMKey));
}
}
diff --git a/testbot/bin/WineRunReconfig.pl b/testbot/bin/WineRunReconfig.pl
index d0baccc..b3c9508 100755
--- a/testbot/bin/WineRunReconfig.pl
+++ b/testbot/bin/WineRunReconfig.pl
@@ -479,6 +479,12 @@ if ($NewStatus eq 'completed')
# problem will be noticed and that it will be taken offline.
FatalError("Could not recreate the $IdleSnapshot snapshot: $ErrMessage\n");
}
+
+ if ($VM->Type eq "wine" and
+ system("$BinDir/CheckForWinetestUpdate.pl", "--vm", $VM->Name, "--create", "winetest"))
+ {
+ Error("Could not create a job to run WineTest on the ". $VM->Name ." VM\n");
+ }
}