Francois Gouget : testbot: Fix and simplify filtering the enabled VMs.

Alexandre Julliard julliard at winehq.org
Tue Mar 26 11:52:22 CDT 2013


Module: tools
Branch: master
Commit: 08297b4d2088f6aa98a7223dbf623ba958092f7e
URL:    http://source.winehq.org/git/tools.git/?a=commit;h=08297b4d2088f6aa98a7223dbf623ba958092f7e

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Tue Mar 26 11:47:20 2013 +0100

testbot: Fix and simplify filtering the enabled VMs.

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.

---

 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"]);
 }
 




More information about the wine-cvs mailing list