[XvfbDriver] Regular expression used to match running X servers fails on Fedora 22.
authorclopez@igalia.com <clopez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Apr 2015 21:12:44 +0000 (21:12 +0000)
committerclopez@igalia.com <clopez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Apr 2015 21:12:44 +0000 (21:12 +0000)
https://bugs.webkit.org/show_bug.cgi?id=143530

Reviewed by Žan Doberšek.

Assume that the default value for display (:0) is reserved and start checking on :1
Adjust webkitpy test and include two new test cases for this bug (display number not specified)
and for X server named Xorg.bin (previous bug 1376599)

* Scripts/webkitpy/port/xvfbdriver.py:
(XvfbDriver._next_free_display)
* Scripts/webkitpy/port/xvfbdriver_unittest.py:
(XvfbDriverTest.test_start_no_pixel_tests):
(XvfbDriverTest.test_start_pixel_tests):
(XvfbDriverTest.test_start_arbitrary_worker_number):
(XvfbDriverTest.test_next_free_display):
(XvfbDriverTest.test_start_next_worker):

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

Tools/ChangeLog
Tools/Scripts/webkitpy/port/xvfbdriver.py
Tools/Scripts/webkitpy/port/xvfbdriver_unittest.py

index 33328eb97b07a90683eaaca54d4fc4746d354750..d8bcab52a33af23caaae8b60600117985b5bfae4 100644 (file)
@@ -1,3 +1,22 @@
+2015-04-08  Carlos Alberto Lopez Perez  <clopez@igalia.com>
+
+        [XvfbDriver] Regular expression used to match running X servers fails on Fedora 22.
+        https://bugs.webkit.org/show_bug.cgi?id=143530
+
+        Reviewed by Žan Doberšek.
+
+        Assume that the default value for display (:0) is reserved and start checking on :1
+        Adjust webkitpy test and include two new test cases for this bug (display number not specified)
+        and for X server named Xorg.bin (previous bug 1376599)
+
+        * Scripts/webkitpy/port/xvfbdriver.py:
+        (XvfbDriver._next_free_display)
+        * Scripts/webkitpy/port/xvfbdriver_unittest.py:
+        (XvfbDriverTest.test_start_no_pixel_tests):
+        (XvfbDriverTest.test_start_pixel_tests):
+        (XvfbDriverTest.test_start_arbitrary_worker_number):
+        (XvfbDriverTest.test_next_free_display):
+        (XvfbDriverTest.test_start_next_worker):
 2015-04-08  Alex Christensen  <achristensen@webkit.org>
 
         Block popups from content extensions.
index 528108729f9dd10848d51ff437d47aeb5b60bc76..b66948a16f02872240f6d229138a49673f98a59a 100644 (file)
@@ -62,7 +62,7 @@ class XvfbDriver(Driver):
             match = re.match('(X|Xvfb|Xorg|Xorg\.bin)\s+.*\s:(?P<screen_number>\d+)', pid)
             if match:
                 reserved_screens.add(int(match.group('screen_number')))
-        for i in range(99):
+        for i in range(1, 99):
             if i not in reserved_screens:
                 _guard_lock_file = self._port.host.filesystem.join('/tmp', 'WebKitXvfb.lock.%i' % i)
                 self._guard_lock = self._port.host.make_file_lock(_guard_lock_file)
index a1c350ac23d3d9dc05c3938364563df3b56bd524..e0af1bbb00d513558cb41f90ffcb5ba973f81511 100644 (file)
@@ -68,49 +68,59 @@ class XvfbDriverTest(unittest.TestCase):
 
     def test_start_no_pixel_tests(self):
         driver = self.make_driver()
-        expected_logs = ("MOCK run_command: ['ps', '-eo', 'comm,command'], cwd=None\nMOCK popen: ['Xvfb', ':0', '-screen', '0', '1024x768x24', '-nolisten', 'tcp'], env=%s\n" % driver._environment)
-        self.assertDriverStartSuccessful(driver, expected_logs=expected_logs, expected_display=":0")
+        expected_logs = ("MOCK run_command: ['ps', '-eo', 'comm,command'], cwd=None\nMOCK popen: ['Xvfb', ':1', '-screen', '0', '1024x768x24', '-nolisten', 'tcp'], env=%s\n" % driver._environment)
+        self.assertDriverStartSuccessful(driver, expected_logs=expected_logs, expected_display=":1")
         self.cleanup_driver(driver)
 
     def test_start_pixel_tests(self):
         driver = self.make_driver()
-        expected_logs = ("MOCK run_command: ['ps', '-eo', 'comm,command'], cwd=None\nMOCK popen: ['Xvfb', ':0', '-screen', '0', '1024x768x24', '-nolisten', 'tcp'], env=%s\n" % driver._environment)
-        self.assertDriverStartSuccessful(driver, expected_logs=expected_logs, expected_display=":0", pixel_tests=True)
+        expected_logs = ("MOCK run_command: ['ps', '-eo', 'comm,command'], cwd=None\nMOCK popen: ['Xvfb', ':1', '-screen', '0', '1024x768x24', '-nolisten', 'tcp'], env=%s\n" % driver._environment)
+        self.assertDriverStartSuccessful(driver, expected_logs=expected_logs, expected_display=":1", pixel_tests=True)
         self.cleanup_driver(driver)
 
     def test_start_arbitrary_worker_number(self):
         driver = self.make_driver(worker_number=17)
-        expected_logs = ("MOCK run_command: ['ps', '-eo', 'comm,command'], cwd=None\nMOCK popen: ['Xvfb', ':0', '-screen', '0', '1024x768x24', '-nolisten', 'tcp'], env=%s\n" % driver._environment)
-        self.assertDriverStartSuccessful(driver, expected_logs=expected_logs, expected_display=":0", pixel_tests=True)
+        expected_logs = ("MOCK run_command: ['ps', '-eo', 'comm,command'], cwd=None\nMOCK popen: ['Xvfb', ':1', '-screen', '0', '1024x768x24', '-nolisten', 'tcp'], env=%s\n" % driver._environment)
+        self.assertDriverStartSuccessful(driver, expected_logs=expected_logs, expected_display=":1", pixel_tests=True)
         self.cleanup_driver(driver)
 
     def test_next_free_display(self):
-        output = "Xorg            /usr/bin/X :0 -auth /var/run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch -background none\nXvfb            Xvfb :1 -screen 0 800x600x24 -nolisten tcp"
+        output = "Xorg            /usr/bin/X :1 -auth /var/run/lightdm/root/:1 -nolisten tcp vt7 -novtswitch -background none\nXvfb            Xvfb :2 -screen 0 800x600x24 -nolisten tcp"
+        executive = MockExecutive2(output)
+        driver = self.make_driver(executive=executive)
+        self.assertEqual(driver._next_free_display(), 3)
+        self.cleanup_driver(driver)
+        output = "X               /usr/bin/X :1 vt7 -nolisten tcp -auth /var/run/xauth/A:0-8p7Ybb"
         executive = MockExecutive2(output)
         driver = self.make_driver(executive=executive)
         self.assertEqual(driver._next_free_display(), 2)
         self.cleanup_driver(driver)
-        output = "X               /usr/bin/X :0 vt7 -nolisten tcp -auth /var/run/xauth/A:0-8p7Ybb"
+        output = "Xvfb            Xvfb :1 -screen 0 800x600x24 -nolisten tcp"
         executive = MockExecutive2(output)
         driver = self.make_driver(executive=executive)
-        self.assertEqual(driver._next_free_display(), 1)
+        self.assertEqual(driver._next_free_display(), 2)
         self.cleanup_driver(driver)
-        output = "Xvfb            Xvfb :0 -screen 0 800x600x24 -nolisten tcp"
+        output = "Xvfb            Xvfb :2 -screen 0 800x600x24 -nolisten tcp\nXvfb            Xvfb :1 -screen 0 800x600x24 -nolisten tcp\nXvfb            Xvfb :3 -screen 0 800x600x24 -nolisten tcp"
         executive = MockExecutive2(output)
         driver = self.make_driver(executive=executive)
-        self.assertEqual(driver._next_free_display(), 1)
+        self.assertEqual(driver._next_free_display(), 4)
         self.cleanup_driver(driver)
-        output = "Xvfb            Xvfb :1 -screen 0 800x600x24 -nolisten tcp\nXvfb            Xvfb :0 -screen 0 800x600x24 -nolisten tcp\nXvfb            Xvfb :3 -screen 0 800x600x24 -nolisten tcp"
+        output = "Xorg.bin        /usr/libexec/Xorg.bin :1 -background none -noreset -verbose 3 -logfile /dev/null -auth /run/gdm/auth-for-gdm-Zt8Eq2/database -seat seat0 -nolisten tcp vt1"
         executive = MockExecutive2(output)
         driver = self.make_driver(executive=executive)
         self.assertEqual(driver._next_free_display(), 2)
         self.cleanup_driver(driver)
+        output = "/usr/libexec/Xorg            vt2 -displayfd 3 -auth /run/user/1000/gdm/Xauthority -nolisten tcp -background none -noreset -keeptty -verbose 3"
+        executive = MockExecutive2(output)
+        driver = self.make_driver(executive=executive)
+        self.assertEqual(driver._next_free_display(), 1)
+        self.cleanup_driver(driver)
 
     def test_start_next_worker(self):
         driver = self.make_driver()
-        driver._next_free_display = lambda: 0
-        expected_logs = ("MOCK popen: ['Xvfb', ':0', '-screen', '0', '1024x768x24', '-nolisten', 'tcp'], env=%s\n" % driver._environment)
-        self.assertDriverStartSuccessful(driver, expected_logs=expected_logs, expected_display=":0", pixel_tests=True)
+        driver._next_free_display = lambda: 1
+        expected_logs = ("MOCK popen: ['Xvfb', ':1', '-screen', '0', '1024x768x24', '-nolisten', 'tcp'], env=%s\n" % driver._environment)
+        self.assertDriverStartSuccessful(driver, expected_logs=expected_logs, expected_display=":1", pixel_tests=True)
         self.cleanup_driver(driver)
         driver = self.make_driver()
         driver._next_free_display = lambda: 3