Module: tools Branch: master Commit: aae43a05737a693f784c8a719b6084b44c5411fc URL: http://source.winehq.org/git/tools.git/?a=commit;h=aae43a05737a693f784c8a719...
Author: Francois Gouget fgouget@codeweavers.com Date: Wed Mar 13 16:52:30 2013 +0100
testbot: Tighten handling of the VM status in the task scripts.
---
testbot/bin/WineRunBuild.pl | 15 +++++++++++++-- testbot/bin/WineRunReconfig.pl | 17 ++++++++++++++--- testbot/bin/WineRunTask.pl | 15 ++++++++++----- 3 files changed, 37 insertions(+), 10 deletions(-)
diff --git a/testbot/bin/WineRunBuild.pl b/testbot/bin/WineRunBuild.pl index 236d3d0..3f5b592 100755 --- a/testbot/bin/WineRunBuild.pl +++ b/testbot/bin/WineRunBuild.pl @@ -61,8 +61,11 @@ sub FatalError($$$$) $Job->UpdateStatus();
my $VM = $Task->VM; - $VM->Status('dirty'); - $VM->Save(); + if ($VM->Status eq 'running') + { + $VM->Status('dirty'); + $VM->Save(); + }
TaskComplete($JobKey, $StepKey, $TaskKey); exit 1; @@ -217,6 +220,13 @@ if (! defined($BaseName)) FatalError "Can't determine base name\n", $FullErrFileName, $Job, $Task; }
+# Normally the Engine has already set the VM status to 'running'. +# Do it anyway in case we're called manually from the command line. +if ($VM->Status ne "idle" and $VM->Status ne "running") +{ + FatalError "The VM is not ready for use (" . $VM->Status . ")\n", + $FullErrFileName, $Job, $Task; +} $VM->Status('running'); my ($ErrProperty, $ErrMessage) = $VM->Save(); if (defined($ErrMessage)) @@ -224,6 +234,7 @@ if (defined($ErrMessage)) FatalError "Can't set VM status to running: $ErrMessage\n", $FullErrFileName, $Job, $Task; } + my $FileName = $Step->FileName; if (!$TA->SendFile("$StepDir/$FileName", "staging/$FileName", 0)) { diff --git a/testbot/bin/WineRunReconfig.pl b/testbot/bin/WineRunReconfig.pl index 7588045..0333705 100755 --- a/testbot/bin/WineRunReconfig.pl +++ b/testbot/bin/WineRunReconfig.pl @@ -61,8 +61,11 @@ sub FatalError($$$$) $Job->UpdateStatus();
my $VM = $Task->VM; - $VM->Status('dirty'); - $VM->Save(); + if ($VM->Status eq 'running') + { + $VM->Status('dirty'); + $VM->Save(); + }
TaskComplete($JobKey, $StepKey, $TaskKey); exit 1; @@ -190,13 +193,21 @@ my $FullRawlogFileName = "$TaskDir/rawlog"; my $FullLogFileName = "$TaskDir/log"; my $FullErrFileName = "$TaskDir/err";
+# Normally the Engine has already set the VM status to 'running'. +# Do it anyway in case we're called manually from the command line. +if ($VM->Status ne "idle" and $VM->Status ne "running") +{ + FatalError "The VM is not ready for use (" . $VM->Status . ")\n", + $FullErrFileName, $Job, $Task; +} $VM->Status('running'); my ($ErrProperty, $ErrMessage) = $VM->Save(); -if (defined($ErrMessage)) +if (defined $ErrMessage) { FatalError "Can't set VM status to running: $ErrMessage\n", $FullErrFileName, $Job, $Task; } + my $Script = "#!/bin/sh\n" . "rm -f Reconfig.log\n" . "../bin/build/Reconfig.pl >>Reconfig.log 2>&1\n"; diff --git a/testbot/bin/WineRunTask.pl b/testbot/bin/WineRunTask.pl index ffbb421..abb92e0 100755 --- a/testbot/bin/WineRunTask.pl +++ b/testbot/bin/WineRunTask.pl @@ -204,9 +204,16 @@ my $FullLogFileName = "$TaskDir/log"; my $FullErrFileName = "$TaskDir/err"; my $FullScreenshotFileName = "$TaskDir/screenshot.png";
+# Normally the Engine has already set the VM status to 'running'. +# Do it anyway in case we're called manually from the command line. +if ($VM->Status ne "idle" and $VM->Status ne "running") +{ + FatalError "The VM is not ready for use (" . $VM->Status . ")\n", + $FullErrFileName, $Job, $Step, $Task; +} $VM->Status('running'); my ($ErrProperty, $ErrMessage) = $VM->Save(); -if (defined($ErrMessage)) +if (defined $ErrMessage) { FatalError "Can't set VM status to running: $ErrMessage\n", $FullErrFileName, $Job, $Step, $Task; @@ -349,10 +356,8 @@ if (!defined $TestFailures) $Task->TestFailures($TestFailures); $Task->Save(); $Job->UpdateStatus(); -if ($Task->VM->Role ne "base") -{ - $Task->VM->PowerOff(); -} + +$VM->PowerOff() if ($VM->Role ne "base"); $VM->Status('dirty'); $VM->Save();