[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-10851-g50815da
tony at chromium.org
tony at chromium.org
Wed Dec 22 18:13:41 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 1053edd0fd52539e9691545bccb2bf31568162aa
Author: tony at chromium.org <tony at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Dec 9 00:13:04 2010 +0000
2010-12-08 Tony Chang <tony at chromium.org>
Reviewed by Eric Seidel.
make starting the websocket server more reliable on windows
https://bugs.webkit.org/show_bug.cgi?id=50712
* Scripts/webkitpy/common/system/filesystem.py:
(remove): Substitute method for os.remove to retry on error on Windows
* Scripts/webkitpy/common/system/filesystem_unittest.py:
* Scripts/webkitpy/layout_tests/port/http_server_base.py: Use FileSystem.remove
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73563 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 6ed5ac7..a1ccbe4 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,15 @@
+2010-12-08 Tony Chang <tony at chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ make starting the websocket server more reliable on windows
+ https://bugs.webkit.org/show_bug.cgi?id=50712
+
+ * Scripts/webkitpy/common/system/filesystem.py:
+ (remove): Substitute method for os.remove to retry on error on Windows
+ * Scripts/webkitpy/common/system/filesystem_unittest.py:
+ * Scripts/webkitpy/layout_tests/port/http_server_base.py: Use FileSystem.remove
+
2010-12-08 Jessie Berlin <jberlin at apple.com>
Reviewed by Adam Roben.
diff --git a/WebKitTools/Scripts/webkitpy/common/system/filesystem.py b/WebKitTools/Scripts/webkitpy/common/system/filesystem.py
index 8f396c4..a6ad425 100644
--- a/WebKitTools/Scripts/webkitpy/common/system/filesystem.py
+++ b/WebKitTools/Scripts/webkitpy/common/system/filesystem.py
@@ -32,10 +32,11 @@ from __future__ import with_statement
import codecs
import errno
+import exceptions
import os
import shutil
import tempfile
-
+import time
class FileSystem(object):
"""FileSystem interface for webkitpy.
@@ -97,6 +98,34 @@ class FileSystem(object):
if e.errno != errno.EEXIST:
raise
+ class _WindowsError(exceptions.OSError):
+ """Fake exception for Linux and Mac."""
+ pass
+
+ def remove(self, path, osremove=os.remove):
+ """On Windows, os.remove can sometimes fail. We see this behavior in
+ Chromium tests as well and are unsure why. Others on the internet are
+ equally confused:
+ http://social.msdn.microsoft.com/Forums/en/windowssearch/thread/55582d9d-77ea-47d9-91ce-cff7ca7ef528
+ http://codesearch.google.com/codesearch/p?hl=en#OAMlx_jo-ck/src/base/test/test_file_util_win.cc&q=diefiledie&exact_package=chromium&l=22
+ """
+ try:
+ WindowsError
+ except NameError:
+ WindowsError = FileSystem._WindowsError
+
+ retry_timeout_sec = 3.0
+ sleep_interval = 0.1
+ while True:
+ try:
+ osremove(path)
+ return True
+ except WindowsError, e:
+ time.sleep(sleep_interval)
+ retry_timeout_sec -= sleep_interval
+ if retry_timeout_sec < 0:
+ raise e
+
def read_binary_file(self, path):
"""Return the contents of the file at the given path as a byte string."""
with file(path, 'rb') as f:
diff --git a/WebKitTools/Scripts/webkitpy/common/system/filesystem_unittest.py b/WebKitTools/Scripts/webkitpy/common/system/filesystem_unittest.py
index 95684b7..267ca13 100644
--- a/WebKitTools/Scripts/webkitpy/common/system/filesystem_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/common/system/filesystem_unittest.py
@@ -152,6 +152,21 @@ class FileSystemTest(unittest.TestCase):
fs = FileSystem()
self.assertRaises(IOError, fs.read_text_file, self._missing_file)
+ def test_remove_file_with_retry(self):
+ FileSystemTest._remove_failures = 2
+
+ def remove_with_exception(filename):
+ FileSystemTest._remove_failures -= 1
+ if FileSystemTest._remove_failures >= 0:
+ try:
+ raise WindowsError
+ except NameError:
+ raise FileSystem._WindowsError
+
+ fs = FileSystem()
+ self.assertTrue(fs.remove('filename', remove_with_exception))
+ self.assertEquals(-1, FileSystemTest._remove_failures)
+
if __name__ == '__main__':
unittest.main()
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/http_server_base.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/http_server_base.py
index 2745cce..52a0403 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/http_server_base.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/http_server_base.py
@@ -34,6 +34,8 @@ import os
import time
import urllib
+from webkitpy.common.system import filesystem
+
_log = logging.getLogger("webkitpy.layout_tests.port.http_server_base")
@@ -78,4 +80,4 @@ class HttpServerBase(object):
for file in files:
if file.startswith(starts_with):
full_path = os.path.join(folder, file)
- os.remove(full_path)
+ filesystem.FileSystem().remove(full_path)
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list