Title: [136314] trunk/Tools
Revision
136314
Author
[email protected]
Date
2012-12-01 23:06:01 -0800 (Sat, 01 Dec 2012)

Log Message

[XvfbDriver] XvfbDriverTest.test_next_free_display is flaky on builders using XvfbDriver
https://bugs.webkit.org/show_bug.cgi?id=103806

Reviewed by Dirk Pranke.

There are occasional mishaps on builders where XvfbDriver doesn't properly
clean up the Xvfb instance it was managing so the related guard lock files
are still existing when the webkitpy unit tests are run. This can cause failures
in XvfbDriverTest.test_next_free_display as the test tries to acquire displays
with a specific number but is unable to due to the stale locks.

The solution to this is to use MockFileLock when inside unit test. This is achievable
by creating a file lock through the SystemHost instance connected to the Port object,
the latter available to the Driver.

* Scripts/webkitpy/common/system/file_lock_mock.py:
(MockFileLock.acquire_lock): Return True to signal lock acquiring succeeded.
(MockFileLock.release_lock): Return True to signal lock releasing succeeded.
* Scripts/webkitpy/layout_tests/port/xvfbdriver.py:
(XvfbDriver._next_free_display): Create the file lock through a mockable way.
* Scripts/webkitpy/layout_tests/port/xvfbdriver_unittest.py:
(XvfbDriverTest.test_next_free_display): Enable back the unit test.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (136313 => 136314)


--- trunk/Tools/ChangeLog	2012-12-02 00:31:21 UTC (rev 136313)
+++ trunk/Tools/ChangeLog	2012-12-02 07:06:01 UTC (rev 136314)
@@ -1,5 +1,30 @@
 2012-12-01  Zan Dobersek  <[email protected]>
 
+        [XvfbDriver] XvfbDriverTest.test_next_free_display is flaky on builders using XvfbDriver
+        https://bugs.webkit.org/show_bug.cgi?id=103806
+
+        Reviewed by Dirk Pranke.
+
+        There are occasional mishaps on builders where XvfbDriver doesn't properly
+        clean up the Xvfb instance it was managing so the related guard lock files
+        are still existing when the webkitpy unit tests are run. This can cause failures
+        in XvfbDriverTest.test_next_free_display as the test tries to acquire displays
+        with a specific number but is unable to due to the stale locks.
+
+        The solution to this is to use MockFileLock when inside unit test. This is achievable
+        by creating a file lock through the SystemHost instance connected to the Port object,
+        the latter available to the Driver.
+
+        * Scripts/webkitpy/common/system/file_lock_mock.py:
+        (MockFileLock.acquire_lock): Return True to signal lock acquiring succeeded.
+        (MockFileLock.release_lock): Return True to signal lock releasing succeeded.
+        * Scripts/webkitpy/layout_tests/port/xvfbdriver.py:
+        (XvfbDriver._next_free_display): Create the file lock through a mockable way.
+        * Scripts/webkitpy/layout_tests/port/xvfbdriver_unittest.py:
+        (XvfbDriverTest.test_next_free_display): Enable back the unit test.
+
+2012-12-01  Zan Dobersek  <[email protected]>
+
         [GTK] A11y tests in WK2 report badly-formatted AX roles
         https://bugs.webkit.org/show_bug.cgi?id=102947
 

Modified: trunk/Tools/Scripts/webkitpy/common/system/file_lock_mock.py (136313 => 136314)


--- trunk/Tools/Scripts/webkitpy/common/system/file_lock_mock.py	2012-12-02 00:31:21 UTC (rev 136313)
+++ trunk/Tools/Scripts/webkitpy/common/system/file_lock_mock.py	2012-12-02 07:06:01 UTC (rev 136314)
@@ -30,7 +30,7 @@
         pass
 
     def acquire_lock(self):
-        pass
+        return True
 
     def release_lock(self):
-        pass
+        return True

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/xvfbdriver.py (136313 => 136314)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/xvfbdriver.py	2012-12-02 00:31:21 UTC (rev 136313)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/xvfbdriver.py	2012-12-02 07:06:01 UTC (rev 136314)
@@ -54,7 +54,7 @@
         for i in range(99):
             if i not in reserved_screens:
                 _guard_lock_file = self._port.host.filesystem.join('/tmp', 'WebKitXvfb.lock.%i' % i)
-                self._guard_lock = FileLock(_guard_lock_file)
+                self._guard_lock = self._port.host.make_file_lock(_guard_lock_file)
                 if self._guard_lock.acquire_lock():
                     return i
 

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/xvfbdriver_unittest.py (136313 => 136314)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/xvfbdriver_unittest.py	2012-12-02 00:31:21 UTC (rev 136313)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/xvfbdriver_unittest.py	2012-12-02 07:06:01 UTC (rev 136314)
@@ -82,7 +82,7 @@
         self.assertDriverStartSuccessful(driver, expected_logs=expected_logs, expected_display=":0", pixel_tests=True)
         self.cleanup_driver(driver)
 
-    def disabled_test_next_free_display(self):
+    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"
         executive = MockExecutive2(output)
         driver = self.make_driver(executive=executive)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to