Title: [108514] trunk/Tools
Revision
108514
Author
[email protected]
Date
2012-02-22 10:16:54 -0800 (Wed, 22 Feb 2012)

Log Message

webkitpy: speed up FileLockTest.test_lock_lifecycle
https://bugs.webkit.org/show_bug.cgi?id=79189

Reviewed by Adam Barth.

The unit test had a second lock trying to acquire a
lock already held, and a hard-coded timeout of one second.
I have changed the timeouts to a tenth of a second (which
is probably still fine) and changed the hard-spin on
the lock to a slow-spin every hundredth of a second.

* Scripts/webkitpy/common/system/file_lock.py:
(FileLock.acquire_lock):
* Scripts/webkitpy/common/system/file_lock_integrationtest.py:
(FileLockTest.setUp):
(FileLockTest.test_stuck_lock):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (108513 => 108514)


--- trunk/Tools/ChangeLog	2012-02-22 18:10:40 UTC (rev 108513)
+++ trunk/Tools/ChangeLog	2012-02-22 18:16:54 UTC (rev 108514)
@@ -1,3 +1,22 @@
+2012-02-22  Dirk Pranke  <[email protected]>
+
+        webkitpy: speed up FileLockTest.test_lock_lifecycle
+        https://bugs.webkit.org/show_bug.cgi?id=79189
+
+        Reviewed by Adam Barth.
+
+        The unit test had a second lock trying to acquire a
+        lock already held, and a hard-coded timeout of one second.
+        I have changed the timeouts to a tenth of a second (which
+        is probably still fine) and changed the hard-spin on
+        the lock to a slow-spin every hundredth of a second.
+
+        * Scripts/webkitpy/common/system/file_lock.py:
+        (FileLock.acquire_lock):
+        * Scripts/webkitpy/common/system/file_lock_integrationtest.py:
+        (FileLockTest.setUp):
+        (FileLockTest.test_stuck_lock):
+
 2012-02-22  Gabor Rapcsanyi  <[email protected]>
 
         build-webkit should use environment variable at number of CPU

Modified: trunk/Tools/Scripts/webkitpy/common/system/file_lock.py (108513 => 108514)


--- trunk/Tools/Scripts/webkitpy/common/system/file_lock.py	2012-02-22 18:10:40 UTC (rev 108513)
+++ trunk/Tools/Scripts/webkitpy/common/system/file_lock.py	2012-02-22 18:16:54 UTC (rev 108514)
@@ -71,6 +71,8 @@
                     os.close(self._lock_file_descriptor)
                     self._lock_file_descriptor = None
                     return False
+                # There's no compelling reason to spin hard here, so sleep for a bit.
+                time.sleep(0.01)
 
     def release_lock(self):
         try:

Modified: trunk/Tools/Scripts/webkitpy/common/system/file_lock_integrationtest.py (108513 => 108514)


--- trunk/Tools/Scripts/webkitpy/common/system/file_lock_integrationtest.py	2012-02-22 18:10:40 UTC (rev 108513)
+++ trunk/Tools/Scripts/webkitpy/common/system/file_lock_integrationtest.py	2012-02-22 18:16:54 UTC (rev 108514)
@@ -36,8 +36,8 @@
     def setUp(self):
         self._lock_name = "TestWebKit" + str(os.getpid()) + ".lock"
         self._lock_path = os.path.join(tempfile.gettempdir(), self._lock_name)
-        self._file_lock1 = FileLock(self._lock_path, 1)
-        self._file_lock2 = FileLock(self._lock_path, 1)
+        self._file_lock1 = FileLock(self._lock_path, 0.1)
+        self._file_lock2 = FileLock(self._lock_path, 0.1)
 
     def tearDown(self):
         self._file_lock1.release_lock()
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to