[GTK] NRWT bails out if more than one X server runs on the machine
authorphiln@webkit.org <philn@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Apr 2012 23:29:33 +0000 (23:29 +0000)
committerphiln@webkit.org <philn@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Apr 2012 23:29:33 +0000 (23:29 +0000)
https://bugs.webkit.org/show_bug.cgi?id=84276

Reviewed by Dirk Pranke.

Set up GTK driver's Xvfb display number based on Xorg servers
currently running.

* Scripts/webkitpy/layout_tests/port/gtk.py:
(GtkDriver._start):
(GtkDriver._start.x_filter):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@114579 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/webkitpy/layout_tests/port/gtk.py

index f74b170..9ee9871 100644 (file)
@@ -1,3 +1,17 @@
+2012-04-18  Philippe Normand  <pnormand@igalia.com>
+
+        [GTK] NRWT bails out if more than one X server runs on the machine
+        https://bugs.webkit.org/show_bug.cgi?id=84276
+
+        Reviewed by Dirk Pranke.
+
+        Set up GTK driver's Xvfb display number based on Xorg servers
+        currently running.
+
+        * Scripts/webkitpy/layout_tests/port/gtk.py:
+        (GtkDriver._start):
+        (GtkDriver._start.x_filter):
+
 2012-04-18  Dirk Pranke  <dpranke@chromium.org>
 
         run-webkit-tests picked up an old crash log
index ab116bc..7d6206a 100644 (file)
@@ -34,17 +34,25 @@ import subprocess
 from webkitpy.layout_tests.models.test_configuration import TestConfiguration
 from webkitpy.layout_tests.port.server_process import ServerProcess
 from webkitpy.layout_tests.port.webkit import WebKitDriver, WebKitPort
-
+from webkitpy.common.system.executive import Executive
 
 _log = logging.getLogger(__name__)
 
 
 class GtkDriver(WebKitDriver):
     def _start(self, pixel_tests, per_test_args):
+
+        # Collect the number of X servers running already and make
+        # sure our Xvfb process doesn't clash with any of them.
+        def x_filter(process_name):
+            return process_name.find("Xorg") > -1
+
+        running_displays = len(Executive().running_pids(x_filter))
+
         # Use even displays for pixel tests and odd ones otherwise. When pixel tests are disabled,
         # DriverProxy creates two drivers, one for normal and the other for ref tests. Both have
         # the same worker number, so this prevents them from using the same Xvfb instance.
-        display_id = self._worker_number * 2 + 1
+        display_id = self._worker_number * 2 + running_displays
         if self._pixel_tests:
             display_id += 1
         run_xvfb = ["Xvfb", ":%d" % (display_id), "-screen",  "0", "800x600x24", "-nolisten", "tcp"]