We need to wait for the X session whenever a Wine VM is booted, even when not creating a snapshot.
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- testbot/bin/LibvirtTool.pl | 42 +++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 23 deletions(-)
diff --git a/testbot/bin/LibvirtTool.pl b/testbot/bin/LibvirtTool.pl index cc22435c5..d5901910c 100755 --- a/testbot/bin/LibvirtTool.pl +++ b/testbot/bin/LibvirtTool.pl @@ -420,6 +420,25 @@ sub SetupTestAgentd($$$$) # A side effect is that it will force TestAgentd.exe.old to stay around. }
+ 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 X session on $VMKey\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 X session\n"); + } + FatalError("An error occurred while waiting for the X session: $ErrMessage\n"); + } + } + if ($ResetStartCount) { # If SetProperty() is not supported neither is --show-restarts. @@ -443,29 +462,6 @@ sub CreateSnapshot($$) { my ($Domain, $SnapshotName) = @_;
- if ($VM->Type eq "wine") - { - # Make sure an X session has started before taking the snapshot - Debug(Elapsed($Start), " Waiting for the X session\n"); - LogMsg "Waiting for the $VMKey X session\n"; - my $TA = $VM->GetAgent(); - my $Pid = $TA->Run(["sh", "-c", "while ! xset -display :0.0 q >/dev/null; do sleep 1; done"], 0); - if (!$Pid) - { - FatalError("Could not check for the X session on the $VMKey VM\n"); - } - 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 X session\n"); - } - FatalError("An error occurred while waiting for the X session: $ErrMessage\n"); - } - $TA->Disconnect(); - } - if ($SleepAfterBoot != 0) { Debug(Elapsed($Start), " Sleeping for the $SnapshotName snapshot\n");