Francois Gouget : testbot/LibvirtTool: Move the TestAgentd check to a separate function.
Module: tools Branch: master Commit: 51f44f2c29d396162aa175f12394ba28e9236dc6 URL: https://source.winehq.org/git/tools.git/?a=commit;h=51f44f2c29d396162aa175f1... Author: Francois Gouget <fgouget(a)codeweavers.com> Date: Tue Sep 24 11:09:49 2019 +0200 testbot/LibvirtTool: Move the TestAgentd check to a separate function. GetVersion() is equivalent to Ping() but can be used to perform version checks. Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- testbot/bin/LibvirtTool.pl | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/testbot/bin/LibvirtTool.pl b/testbot/bin/LibvirtTool.pl index 4635443..dd330a5 100755 --- a/testbot/bin/LibvirtTool.pl +++ b/testbot/bin/LibvirtTool.pl @@ -365,6 +365,23 @@ sub CheckOff() return ChangeStatus("dirty", "off", "done"); } +sub SetupTestAgentd($$) +{ + my ($VM, $Booting) = @_; + + Debug(Elapsed($Start), " Setting up the $VMKey TestAgent server\n"); + LogMsg "Setting up the $VMKey TestAgent server\n"; + my $TA = $VM->GetAgent(); + $TA->SetConnectTimeout(undef, undef, $WaitForBoot) if ($Booting); + my $Version = $TA->GetVersion(); + if (!$Version) + { + my $ErrMessage = $TA->GetLastError(); + FatalError("Could not connect to the $VMKey TestAgent: $ErrMessage\n"); + } + $TA->Disconnect(); +} + sub Revert() { my $VM = CreateVMs()->GetItem($VMKey); @@ -402,18 +419,8 @@ sub Revert() # The VM is now sleeping which may allow some tasks to run return 1 if (ChangeStatus("reverting", "sleeping")); - # Verify that the TestAgent server accepts connections - Debug(Elapsed($Start), " Verifying the TestAgent server\n"); - LogMsg "Verifying the $VMKey TestAgent server\n"; - my $TA = $VM->GetAgent(); - $TA->SetConnectTimeout(undef, undef, $WaitForBoot) if ($Booting); - my $Success = $TA->Ping(); - $TA->Disconnect(); - if (!$Success) - { - $ErrMessage = $TA->GetLastError(); - FatalError("Cannot connect to the $VMKey TestAgent: $ErrMessage\n"); - } + # Set up the TestAgent server + SetupTestAgentd($VM, $Booting); if ($SleepAfterRevert != 0) {
participants (1)
-
Alexandre Julliard