Bug 555945 - ThunderbirdTest mozmill runners broken by failure of vncserver code to kill existing sessions dead. a=bustage-fix.
authorAndrew Sutherland <asutherland@asutherland.org>
Tue, 30 Mar 2010 05:45:41 -0700
changeset 5326 094df5229d2449d32717b7f82d91209a78ed2087
parent 5325 3f17f9b73878d1c0849994c67cf1b115f36a8f49
child 5327 76ed45533954d00e1e8d37c78c959a353e0c3880
push idunknown
push userunknown
push dateunknown
reviewersbustage-fix
bugs555945
Bug 555945 - ThunderbirdTest mozmill runners broken by failure of vncserver code to kill existing sessions dead. a=bustage-fix.
mail/test/mozmill/runtest.py
--- a/mail/test/mozmill/runtest.py
+++ b/mail/test/mozmill/runtest.py
@@ -219,17 +219,27 @@ class ThunderTestRunner(mozrunner.Thunde
 
         mozrunner.Runner.__init__(self, *args, **kwargs)
 
     def find_binary(self):
         return self.profile.app_path
 
     def start(self):
         if self.use_vnc_server:
-            subprocess.check_call([self.VNC_SERVER_PATH, ':99'])
+            try:
+                subprocess.check_call([self.VNC_SERVER_PATH, ':99'])
+            except subprocess.CalledProcessError, ex:
+                # Okay, so that display probably already exists.  We can either
+                # use it as-is or kill it.  I'm deciding we want to kill it
+                # since there might be other processes alive in there that
+                # want to make trouble for us.
+                subprocess.check_call([self.VNC_SERVER_PATH, '-kill', ':99'])
+                # Now let's try again.  if this didn't work, let's just let
+                # the exception kill us.
+                subprocess.check_call([self.VNC_SERVER_PATH, ':99'])
             self.vnc_alive = True
             self.env['DISPLAY'] = ':99'
 
         if wrapper is not None and hasattr(wrapper, "on_before_start"):
             wrapper.on_before_start(self.profile)
 
         return mozrunner.ThunderbirdRunner.start(self)