Francois Gouget : testbot/VMs: Add a function for filtering out offline VMs .
Alexandre Julliard
julliard at winehq.org
Wed Oct 31 13:40:49 CDT 2012
Module: tools
Branch: master
Commit: a29506610abcef2d5c6eab0dac1cf3a993b10e4c
URL: http://source.winehq.org/git/tools.git/?a=commit;h=a29506610abcef2d5c6eab0dac1cf3a993b10e4c
Author: Francois Gouget <fgouget at codeweavers.com>
Date: Wed Oct 31 04:46:21 2012 +0100
testbot/VMs: Add a function for filtering out offline VMs.
---
testbot/bin/CheckForWinetestUpdate.pl | 3 +--
testbot/bin/Engine.pl | 11 ++++-------
testbot/lib/WineTestBot/Patches.pm | 3 +--
testbot/lib/WineTestBot/VMs.pm | 7 +++++++
testbot/web/Submit.pl | 4 ++--
5 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/testbot/bin/CheckForWinetestUpdate.pl b/testbot/bin/CheckForWinetestUpdate.pl
index 5ca5aa9..f8a9128 100755
--- a/testbot/bin/CheckForWinetestUpdate.pl
+++ b/testbot/bin/CheckForWinetestUpdate.pl
@@ -86,8 +86,7 @@ sub AddJob
$VMs->AddFilter("Type", ["win32", "win64"]);
$VMs->AddFilter("Role", ["winetest"]);
}
- # Don't schedule the 'offline' ones
- $VMs->AddFilter("Status", ["reverting", "sleeping", "idle", "running", "dirty"]);
+ $VMs->FilterNotOffline();
foreach my $VMKey (@{$VMs->SortKeysBySortOrder($VMs->GetKeys())})
{
my $VM = $VMs->GetItem($VMKey);
diff --git a/testbot/bin/Engine.pl b/testbot/bin/Engine.pl
index b3cfbee..f188212 100755
--- a/testbot/bin/Engine.pl
+++ b/testbot/bin/Engine.pl
@@ -490,14 +490,11 @@ sub InitVMs()
# On startup we don't know what state the VMs are in. So consider them all
# to be dirty.
my $VMs = CreateVMs();
- foreach my $VMKey (@{$VMs->GetKeys()})
+ $VMs->FilterNotOffline();
+ foreach my $VM (@{$VMs->GetItems()})
{
- my $VM = $VMs->GetItem($VMKey);
- if ($VM->Status ne "offline")
- {
- $VM->Status("dirty");
- $VM->Save();
- }
+ $VM->Status('dirty');
+ $VM->Save();
}
}
diff --git a/testbot/lib/WineTestBot/Patches.pm b/testbot/lib/WineTestBot/Patches.pm
index c9e0145..d7dca4e 100644
--- a/testbot/lib/WineTestBot/Patches.pm
+++ b/testbot/lib/WineTestBot/Patches.pm
@@ -238,8 +238,7 @@ sub Submit
$VMs = CreateVMs();
$VMs->AddFilter("Type", $Bits eq "32" ? ["win32", "win64"] : ["win64"]);
$VMs->AddFilter("Role", ["base"]);
- # Don't schedule the 'offline' ones
- $VMs->AddFilter("Status", ["reverting", "sleeping", "idle", "running", "dirty"]);
+ $VMs->FilterNotOffline();
if (@{$VMs->GetKeys()})
{
# Create the corresponding Step
diff --git a/testbot/lib/WineTestBot/VMs.pm b/testbot/lib/WineTestBot/VMs.pm
index c616b09..ad6d1b0 100644
--- a/testbot/lib/WineTestBot/VMs.pm
+++ b/testbot/lib/WineTestBot/VMs.pm
@@ -618,6 +618,13 @@ sub SortKeysBySortOrder
return \@SortedKeys;
}
+sub FilterNotOffline($)
+{
+ my ($self) = @_;
+ # All but the offline ones
+ $self->AddFilter("Status", ["dirty", "reverting", "sleeping", "idle", "running"]);
+}
+
sub FilterHypervisor
{
my $self = shift;
diff --git a/testbot/web/Submit.pl b/testbot/web/Submit.pl
index d8b222d..233583c 100644
--- a/testbot/web/Submit.pl
+++ b/testbot/web/Submit.pl
@@ -238,8 +238,8 @@ sub GenerateFields
{
$VMs->AddFilter("Type", ["win32", "win64"]);
}
- # Don't even show the 'offline' ones
- $VMs->AddFilter("Status", ["reverting", "sleeping", "idle", "running", "dirty"]);
+ # Scheduling jobs on offline VMs is not allowed
+ $VMs->FilterNotOffline();
if ($self->{ShowAll})
{
# All but the retired and deleted ones
More information about the wine-cvs
mailing list