Francois Gouget : testbot/LibvirtTool: Check the X session for Wine VMs after booting.

Alexandre Julliard julliard at winehq.org
Wed Oct 2 16:49:22 CDT 2019


Module: tools
Branch: master
Commit: ae2ecce33aad2f1cefecf5e8fa7ca65cfa6be587
URL:    https://source.winehq.org/git/tools.git/?a=commit;h=ae2ecce33aad2f1cefecf5e8fa7ca65cfa6be587

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Wed Oct  2 07:00:28 2019 +0200

testbot/LibvirtTool: Check the X session for Wine VMs after booting.

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 at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 f6e2d4f..5438f29 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");




More information about the wine-cvs mailing list