Module: tools Branch: master Commit: 6771cd17521c810c04edd1f19908ab1330d6e608 URL: https://source.winehq.org/git/tools.git/?a=commit;h=6771cd17521c810c04edd1f1...
Author: Francois Gouget fgouget@codeweavers.com Date: Mon Feb 14 16:47:15 2022 +0100
testbot/LibvirtTool: Move waiting for the X session start to its own function.
Signed-off-by: Francois Gouget fgouget@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
testbot/bin/LibvirtTool.pl | 43 +++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-)
diff --git a/testbot/bin/LibvirtTool.pl b/testbot/bin/LibvirtTool.pl index 0cccd12..a4ae7df 100755 --- a/testbot/bin/LibvirtTool.pl +++ b/testbot/bin/LibvirtTool.pl @@ -440,6 +440,30 @@ sub CheckOff() return ChangeStatus("dirty", "off", "done"); }
+sub WaitForSession($) +{ + my ($TA) = @_; + + if ($VM->Type eq "wine") + { + # For Wine VMs we have to wait some more for the X session to start. + Debug(Elapsed($Start), " Waiting for the X session\n"); + LogMsg "Waiting for the $VMKey X session\n"; + my $Pid = $TA->Run(["sh", "-c", "while ! xset -display :0.0 q >/dev/null; do sleep 1; done"], 0); + FatalError("Could not check for the $VMKey X session\n") if (!$Pid); + + if (!defined $TA->Wait($Pid, $SleepAfterBoot)) + { + my $ErrMessage = $TA->GetLastError(); + if ($ErrMessage =~ /timed out waiting for the child process/) + { + FatalError("Timed out waiting for the $VMKey X session\n"); + } + FatalError("An error occurred while waiting for the $VMKey X session: $ErrMessage\n"); + } + } +} + sub SetupTestAgentd($$$) { my ($Booting, $UpgradeTestAgentd, $ResetStartCount) = @_; @@ -505,24 +529,7 @@ sub SetupTestAgentd($$$) FatalError("Setting the $VMKey VM system time failed: ". $PTA->GetLastError() ."\n"); }
- if ($Booting and $VM->Type eq "wine") - { - # Make sure the X session has had time to start - Debug(Elapsed($Start), " Waiting for the X session\n"); - LogMsg "Waiting for the $VMKey X session\n"; - my $Pid = $TA->Run(["sh", "-c", "while ! xset -display :0.0 q >/dev/null; do sleep 1; done"], 0); - FatalError("Could not check for the $VMKey X session\n") if (!$Pid); - - if (!defined $TA->Wait($Pid, $SleepAfterBoot)) - { - my $ErrMessage = $TA->GetLastError(); - if ($ErrMessage =~ /timed out waiting for the child process/) - { - FatalError("Timed out waiting for the $VMKey X session\n"); - } - FatalError("An error occurred while waiting for the $VMKey X session: $ErrMessage\n"); - } - } + WaitForSession($TA) if ($Booting);
if ($ResetStartCount) {