Changeset 136314 in webkit


Ignore:
Timestamp:
Dec 1, 2012 11:06:01 PM (11 years ago)
Author:
zandobersek@gmail.com
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.

Location:
trunk/Tools
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r136308 r136314  
     12012-12-01  Zan Dobersek  <zandobersek@gmail.com>
     2
     3        [XvfbDriver] XvfbDriverTest.test_next_free_display is flaky on builders using XvfbDriver
     4        https://bugs.webkit.org/show_bug.cgi?id=103806
     5
     6        Reviewed by Dirk Pranke.
     7
     8        There are occasional mishaps on builders where XvfbDriver doesn't properly
     9        clean up the Xvfb instance it was managing so the related guard lock files
     10        are still existing when the webkitpy unit tests are run. This can cause failures
     11        in XvfbDriverTest.test_next_free_display as the test tries to acquire displays
     12        with a specific number but is unable to due to the stale locks.
     13
     14        The solution to this is to use MockFileLock when inside unit test. This is achievable
     15        by creating a file lock through the SystemHost instance connected to the Port object,
     16        the latter available to the Driver.
     17
     18        * Scripts/webkitpy/common/system/file_lock_mock.py:
     19        (MockFileLock.acquire_lock): Return True to signal lock acquiring succeeded.
     20        (MockFileLock.release_lock): Return True to signal lock releasing succeeded.
     21        * Scripts/webkitpy/layout_tests/port/xvfbdriver.py:
     22        (XvfbDriver._next_free_display): Create the file lock through a mockable way.
     23        * Scripts/webkitpy/layout_tests/port/xvfbdriver_unittest.py:
     24        (XvfbDriverTest.test_next_free_display): Enable back the unit test.
     25
    1262012-12-01  Zan Dobersek  <zandobersek@gmail.com>
    227
  • trunk/Tools/Scripts/webkitpy/common/system/file_lock_mock.py

    r133508 r136314  
    3131
    3232    def acquire_lock(self):
    33         pass
     33        return True
    3434
    3535    def release_lock(self):
    36         pass
     36        return True
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/xvfbdriver.py

    r133050 r136314  
    5555            if i not in reserved_screens:
    5656                _guard_lock_file = self._port.host.filesystem.join('/tmp', 'WebKitXvfb.lock.%i' % i)
    57                 self._guard_lock = FileLock(_guard_lock_file)
     57                self._guard_lock = self._port.host.make_file_lock(_guard_lock_file)
    5858                if self._guard_lock.acquire_lock():
    5959                    return i
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/xvfbdriver_unittest.py

    r135912 r136314  
    8383        self.cleanup_driver(driver)
    8484
    85     def disabled_test_next_free_display(self):
     85    def test_next_free_display(self):
    8686        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"
    8787        executive = MockExecutive2(output)
Note: See TracChangeset for help on using the changeset viewer.