Francois Gouget : testbot/LibvirtTool: Wait for the X session for live Wine snapshots.

Alexandre Julliard julliard at winehq.org
Tue Sep 24 11:41:03 CDT 2019


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

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Tue Sep 24 11:10:08 2019 +0200

testbot/LibvirtTool: Wait for the X session for live Wine snapshots.

The TestAgentd server may start before the X session. But we need the
latter to run the Wine tests so make sure the X session has started
before creating the live snapshot.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 testbot/bin/LibvirtTool.pl | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/testbot/bin/LibvirtTool.pl b/testbot/bin/LibvirtTool.pl
index 72075ae..d1402bc 100755
--- a/testbot/bin/LibvirtTool.pl
+++ b/testbot/bin/LibvirtTool.pl
@@ -386,6 +386,29 @@ 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