[Tools 2/6] testbot: Fix and simplify filtering the enabled VMs.

Francois Gouget fgouget at codeweavers.com
Tue Mar 26 05:47:20 CDT 2013


When a VM is marked as retired or deleted its status is not relevant anymore. So filtering on the status alone is incorrect.
Also rename the functions as there is more than one role for disabled VMs, and there could be more than one status too.
---

Hint: There will be more than one 'disabled' status soon.

 testbot/bin/CheckForWinetestUpdate.pl |    2 +-
 testbot/bin/Engine.pl                 |    3 ++-
 testbot/lib/WineTestBot/Patches.pm    |    2 +-
 testbot/lib/WineTestBot/VMs.pm        |   11 +++++++++--
 4 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/testbot/bin/CheckForWinetestUpdate.pl b/testbot/bin/CheckForWinetestUpdate.pl
index c776fe5..c8909e6 100755
--- a/testbot/bin/CheckForWinetestUpdate.pl
+++ b/testbot/bin/CheckForWinetestUpdate.pl
@@ -92,7 +92,7 @@ sub AddJob
       $VMs->AddFilter("Type", ["win32", "win64"]);
       $VMs->AddFilter("Role", ["winetest"]);
   }
-  $VMs->FilterNotOffline();
+  $VMs->FilterEnabledStatus();
   foreach my $VMKey (@{$VMs->SortKeysBySortOrder($VMs->GetKeys())})
   {
     my $Task = $Tasks->Add();
diff --git a/testbot/bin/Engine.pl b/testbot/bin/Engine.pl
index da3e54c..0a467fb 100755
--- a/testbot/bin/Engine.pl
+++ b/testbot/bin/Engine.pl
@@ -402,7 +402,8 @@ sub InitVMs()
   # On startup we don't know what state the VMs are in. So consider them all
   # to be dirty.
   my $VMs = CreateVMs();
-  $VMs->FilterNotOffline();
+  $VMs->FilterEnabledRole();
+  $VMs->FilterEnabledStatus();
   foreach my $VM (@{$VMs->GetItems()})
   {
     $VM->Status('dirty');
diff --git a/testbot/lib/WineTestBot/Patches.pm b/testbot/lib/WineTestBot/Patches.pm
index 22e00e1..e8143ca 100644
--- a/testbot/lib/WineTestBot/Patches.pm
+++ b/testbot/lib/WineTestBot/Patches.pm
@@ -236,7 +236,7 @@ sub Submit
         $VMs = CreateVMs();
         $VMs->AddFilter("Type", $Bits eq "32" ? ["win32", "win64"] : ["win64"]);
         $VMs->AddFilter("Role", ["base"]);
-        $VMs->FilterNotOffline();
+        $VMs->FilterEnabledStatus();
         if (@{$VMs->GetKeys()})
         {
           # Create the corresponding Step
diff --git a/testbot/lib/WineTestBot/VMs.pm b/testbot/lib/WineTestBot/VMs.pm
index b519f33..ff57d5a 100644
--- a/testbot/lib/WineTestBot/VMs.pm
+++ b/testbot/lib/WineTestBot/VMs.pm
@@ -639,10 +639,17 @@ sub SortKeysBySortOrder
   return \@SortedKeys;
 }
 
-sub FilterNotOffline($)
+sub FilterEnabledRole($)
 {
   my ($self) = @_;
-  # All but the offline ones
+  # Filter out the disabled VMs, that is the retired and deleted ones
+  $self->AddFilter("Role", ["extra", "base", "winetest"]);
+}
+
+sub FilterEnabledStatus($)
+{
+  my ($self) = @_;
+  # Filter out the disabled VMs, that is the offline ones
   $self->AddFilter("Status", ["dirty", "reverting", "sleeping", "idle", "running"]);
 }
 
-- 
1.7.10.4




More information about the wine-patches mailing list