[PATCH 2/4] testbot/WineRun*: Improve the VM and Step validation.

Francois Gouget fgouget at codeweavers.com
Thu Jun 21 08:00:30 CDT 2018


Check that the VM is of the expected type. Also the VM should always be
powered on (for powered off snapshots LibvirtTool.pl is responsible for
powering on the VM), even when debugging.
Move the Step validation next to the VM one.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 testbot/bin/WineRunBuild.pl    | 15 ++++++++++++---
 testbot/bin/WineRunReconfig.pl | 15 ++++++++++++---
 testbot/bin/WineRunTask.pl     | 24 ++++++++++++++----------
 3 files changed, 38 insertions(+), 16 deletions(-)

diff --git a/testbot/bin/WineRunBuild.pl b/testbot/bin/WineRunBuild.pl
index 60af32c73..ff04ded0c 100755
--- a/testbot/bin/WineRunBuild.pl
+++ b/testbot/bin/WineRunBuild.pl
@@ -309,18 +309,27 @@ sub FatalTAError($$)
 
 
 #
-# Check the VM
+# Check the VM and Step
 #
 
-if (!$Debug and $VM->Status ne "running")
+if ($VM->Type ne "build")
+{
+  FatalError("This is not a build VM! (" . $VM->Type . ")\n");
+}
+elsif (!$Debug and $VM->Status ne "running")
 {
   FatalError("The VM is not ready for use (" . $VM->Status . ")\n");
 }
-elsif ($Debug and !$VM->GetDomain()->IsPoweredOn())
+elsif (!$VM->GetDomain()->IsPoweredOn())
 {
   FatalError("The VM is not powered on\n");
 }
 
+if ($Step->FileType ne "patchdlls")
+{
+  FatalError("Unexpected file type '". $Step->FileType ."' found\n");
+}
+
 
 #
 # Figure out what to build
diff --git a/testbot/bin/WineRunReconfig.pl b/testbot/bin/WineRunReconfig.pl
index 2e338c975..23b038a1f 100755
--- a/testbot/bin/WineRunReconfig.pl
+++ b/testbot/bin/WineRunReconfig.pl
@@ -309,18 +309,27 @@ sub FatalTAError($$)
 
 
 #
-# Check the VM
+# Check the VM and Step
 #
 
-if (!$Debug and $VM->Status ne "running")
+if ($VM->Type ne "build")
+{
+  FatalError("This is not a build VM! (" . $VM->Type . ")\n");
+}
+elsif (!$Debug and $VM->Status ne "running")
 {
   FatalError("The VM is not ready for use (" . $VM->Status . ")\n");
 }
-elsif ($Debug and !$VM->GetDomain()->IsPoweredOn())
+elsif (!$VM->GetDomain()->IsPoweredOn())
 {
   FatalError("The VM is not powered on\n");
 }
 
+if ($Step->FileType ne "none")
+{
+  FatalError("Unexpected file type '". $Step->FileType ."' found\n");
+}
+
 
 #
 # Run the build
diff --git a/testbot/bin/WineRunTask.pl b/testbot/bin/WineRunTask.pl
index 3f5a3ee8d..7604e73ad 100755
--- a/testbot/bin/WineRunTask.pl
+++ b/testbot/bin/WineRunTask.pl
@@ -364,18 +364,27 @@ sub FatalTAError($$;$)
 
 
 #
-# Check the VM
+# Check the VM and Step
 #
 
-if (!$Debug and $VM->Status ne "running")
+if ($VM->Type ne "win32" and $VM->Type ne "win64")
+{
+  FatalError("This is not a Windows VM! (" . $VM->Type . ")\n");
+}
+elsif (!$Debug and $VM->Status ne "running")
 {
   FatalError("The VM is not ready for use (" . $VM->Status . ")\n");
 }
-elsif ($Debug and !$VM->GetDomain()->IsPoweredOn())
+elsif (!$VM->GetDomain()->IsPoweredOn())
 {
   FatalError("The VM is not powered on\n");
 }
 
+if ($Step->FileType ne "exe32" and $Step->FileType ne "exe64")
+{
+  FatalError("Unexpected file type '". $Step->FileType ."' found\n");
+}
+
 
 #
 # Setup the VM
@@ -395,11 +404,6 @@ if (!$TA->SetTime())
   }
 }
 
-my $FileType = $Step->FileType;
-if ($FileType ne "exe32" && $FileType ne "exe64")
-{
-  FatalError("Unexpected file type $FileType found\n");
-}
 my $FileName = $Step->FileName;
 Debug(Elapsed($Start), " Sending '". $Step->GetFullFileName() ."'\n");
 if (!$TA->SendFile($Step->GetFullFileName(), $FileName, 0))
@@ -418,7 +422,7 @@ if ($Step->ReportSuccessfulTests)
 my $IsWineTest = 1;
 if ($Step->Type eq "single")
 {
-  my $TestLauncher = "TestLauncher" . ($FileType eq "exe64" ? "64" : "32") . ".exe";
+  my $TestLauncher = "TestLauncher" . ($Step->FileType eq "exe64" ? "64" : "32") . ".exe";
   Debug(Elapsed($Start), " Sending 'latest/$TestLauncher'\n");
   if (!$TA->SendFile("$DataDir/latest/$TestLauncher", $TestLauncher, 0))
   {
@@ -450,7 +454,7 @@ elsif ($Step->Type eq "suite")
   $Tag =~ s/[^a-zA-Z0-9]/-/g;
   if ($VM->Type eq "win64")
   {
-    $Tag .= "-" . ($FileType eq "exe64" ? "64" : "32");
+    $Tag .= "-" . ($Step->FileType eq "exe64" ? "64" : "32");
   }
   if (defined($WebHostName))
   {
-- 
2.17.1




More information about the wine-devel mailing list