[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198
dpranke at chromium.org
dpranke at chromium.org
Sun Feb 20 23:31:15 UTC 2011
The following commit has been merged in the webkit-1.3 branch:
commit 88aebec99fac979a08da5b9fe5c44e40cf1cc743
Author: dpranke at chromium.org <dpranke at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Jan 21 02:30:17 2011 +0000
2011-01-20 Dirk Pranke <dpranke at chromium.org>
Reviewed by Eric Siedel.
nrwt: clean up almost all remaining port references, remove
unnecessary import clauses. The only remaining references are
in places where a mock filesystem makes no sense or can't be
used, and in one routine in port/google_chrome_unittest that
I'll rewrite in a separate patch.
https://bugs.webkit.org/show_bug.cgi?id=52771
* Scripts/webkitpy/layout_tests/layout_package/test_runner.py:
* Scripts/webkitpy/layout_tests/port/chromium_gpu.py:
* Scripts/webkitpy/layout_tests/port/chromium_gpu_unittest.py:
* Scripts/webkitpy/layout_tests/port/chromium_linux.py:
* Scripts/webkitpy/layout_tests/port/chromium_mac.py:
* Scripts/webkitpy/layout_tests/port/chromium_unittest.py:
* Scripts/webkitpy/layout_tests/port/chromium_win.py:
* Scripts/webkitpy/layout_tests/port/chromium_win_unittest.py:
* Scripts/webkitpy/layout_tests/port/google_chrome.py:
* Scripts/webkitpy/layout_tests/port/google_chrome_unittest.py:
* Scripts/webkitpy/layout_tests/port/gtk.py:
* Scripts/webkitpy/layout_tests/port/mac.py:
* Scripts/webkitpy/layout_tests/port/port_testcase.py:
* Scripts/webkitpy/layout_tests/port/qt.py:
* Scripts/webkitpy/layout_tests/port/webkit.py:
* Scripts/webkitpy/layout_tests/port/win.py:
* Scripts/webkitpy/layout_tests/test_types/image_diff.py:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76322 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Tools/ChangeLog b/Tools/ChangeLog
index a0ff8fe..3e05266 100644
--- a/Tools/ChangeLog
+++ b/Tools/ChangeLog
@@ -1,5 +1,35 @@
2011-01-20 Dirk Pranke <dpranke at chromium.org>
+ Reviewed by Eric Siedel.
+
+ nrwt: clean up almost all remaining port references, remove
+ unnecessary import clauses. The only remaining references are
+ in places where a mock filesystem makes no sense or can't be
+ used, and in one routine in port/google_chrome_unittest that
+ I'll rewrite in a separate patch.
+
+ https://bugs.webkit.org/show_bug.cgi?id=52771
+
+ * Scripts/webkitpy/layout_tests/layout_package/test_runner.py:
+ * Scripts/webkitpy/layout_tests/port/chromium_gpu.py:
+ * Scripts/webkitpy/layout_tests/port/chromium_gpu_unittest.py:
+ * Scripts/webkitpy/layout_tests/port/chromium_linux.py:
+ * Scripts/webkitpy/layout_tests/port/chromium_mac.py:
+ * Scripts/webkitpy/layout_tests/port/chromium_unittest.py:
+ * Scripts/webkitpy/layout_tests/port/chromium_win.py:
+ * Scripts/webkitpy/layout_tests/port/chromium_win_unittest.py:
+ * Scripts/webkitpy/layout_tests/port/google_chrome.py:
+ * Scripts/webkitpy/layout_tests/port/google_chrome_unittest.py:
+ * Scripts/webkitpy/layout_tests/port/gtk.py:
+ * Scripts/webkitpy/layout_tests/port/mac.py:
+ * Scripts/webkitpy/layout_tests/port/port_testcase.py:
+ * Scripts/webkitpy/layout_tests/port/qt.py:
+ * Scripts/webkitpy/layout_tests/port/webkit.py:
+ * Scripts/webkitpy/layout_tests/port/win.py:
+ * Scripts/webkitpy/layout_tests/test_types/image_diff.py:
+
+2011-01-20 Dirk Pranke <dpranke at chromium.org>
+
Reviewed by Mihai Parparita.
remove fs refs from run_webkit_tests, rebaseline_chromium_webkit_tests
diff --git a/Tools/Scripts/webkitpy/layout_tests/layout_package/test_runner.py b/Tools/Scripts/webkitpy/layout_tests/layout_package/test_runner.py
index 6bdbda9..6c07850 100644
--- a/Tools/Scripts/webkitpy/layout_tests/layout_package/test_runner.py
+++ b/Tools/Scripts/webkitpy/layout_tests/layout_package/test_runner.py
@@ -42,7 +42,6 @@ import logging
import math
import Queue
import random
-import shutil
import sys
import time
diff --git a/Tools/Scripts/webkitpy/layout_tests/port/chromium_gpu.py b/Tools/Scripts/webkitpy/layout_tests/port/chromium_gpu.py
index c1f5c8d..b88d8aa 100644
--- a/Tools/Scripts/webkitpy/layout_tests/port/chromium_gpu.py
+++ b/Tools/Scripts/webkitpy/layout_tests/port/chromium_gpu.py
@@ -24,10 +24,6 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-from __future__ import with_statement
-
-import codecs
-import os
import sys
import chromium_linux
@@ -82,10 +78,9 @@ def _gpu_overrides(port):
'layout_tests', 'test_expectations_gpu.txt')
except AssertionError:
return None
- if not os.path.exists(overrides_path):
+ if not port._filesystem.exists(overrides_path):
return None
- with codecs.open(overrides_path, "r", "utf-8") as file:
- return file.read()
+ return port._filesystem.read_text_file(overrides_path)
class ChromiumGpuLinuxPort(chromium_linux.ChromiumLinuxPort):
diff --git a/Tools/Scripts/webkitpy/layout_tests/port/chromium_gpu_unittest.py b/Tools/Scripts/webkitpy/layout_tests/port/chromium_gpu_unittest.py
index ad0404c..0bfb127 100644
--- a/Tools/Scripts/webkitpy/layout_tests/port/chromium_gpu_unittest.py
+++ b/Tools/Scripts/webkitpy/layout_tests/port/chromium_gpu_unittest.py
@@ -24,7 +24,6 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-import os
import unittest
from webkitpy.tool import mocktool
diff --git a/Tools/Scripts/webkitpy/layout_tests/port/chromium_linux.py b/Tools/Scripts/webkitpy/layout_tests/port/chromium_linux.py
index 4fddd83..c1c85f8 100644
--- a/Tools/Scripts/webkitpy/layout_tests/port/chromium_linux.py
+++ b/Tools/Scripts/webkitpy/layout_tests/port/chromium_linux.py
@@ -83,14 +83,14 @@ class ChromiumLinuxPort(chromium.ChromiumPort):
*comps)
base = self.path_from_chromium_base()
- if os.path.exists(os.path.join(base, 'sconsbuild')):
- return os.path.join(base, 'sconsbuild', *comps)
- if os.path.exists(os.path.join(base, 'out', *comps)) or self.get_option('use_test_shell'):
- return os.path.join(base, 'out', *comps)
+ if self._filesystem.exists(self._filesystem.join(base, 'sconsbuild')):
+ return self._filesystem.join(base, 'sconsbuild', *comps)
+ if self._filesystem.exists(self._filesystem.join(base, 'out', *comps)) or self.get_option('use_test_shell'):
+ return self._filesystem.join(base, 'out', *comps)
base = self.path_from_webkit_base()
- if os.path.exists(os.path.join(base, 'sconsbuild')):
- return os.path.join(base, 'sconsbuild', *comps)
- return os.path.join(base, 'out', *comps)
+ if self._filesystem.exists(self._filesystem.join(base, 'sconsbuild')):
+ return self._filesystem.join(base, 'sconsbuild', *comps)
+ return self._filesystem.join(base, 'out', *comps)
def _check_apache_install(self):
result = self._check_file_exists(self._path_to_apache(),
@@ -137,7 +137,7 @@ class ChromiumLinuxPort(chromium.ChromiumPort):
else:
config_name = 'apache2-debian-httpd.conf'
- return os.path.join(self.layout_tests_dir(), 'http', 'conf',
+ return self._filesystem.join(self.layout_tests_dir(), 'http', 'conf',
config_name)
def _path_to_lighttpd(self):
@@ -167,7 +167,7 @@ class ChromiumLinuxPort(chromium.ChromiumPort):
return '/usr/bin/wdiff'
def _is_redhat_based(self):
- return os.path.exists(os.path.join('/etc', 'redhat-release'))
+ return self._filesystem.exists(self._filesystem.join('/etc', 'redhat-release'))
def _shut_down_http_server(self, server_pid):
"""Shut down the lighttpd web server. Blocks until it's fully
diff --git a/Tools/Scripts/webkitpy/layout_tests/port/chromium_mac.py b/Tools/Scripts/webkitpy/layout_tests/port/chromium_mac.py
index b08a948..5360ab3 100644
--- a/Tools/Scripts/webkitpy/layout_tests/port/chromium_mac.py
+++ b/Tools/Scripts/webkitpy/layout_tests/port/chromium_mac.py
@@ -110,7 +110,7 @@ class ChromiumMacPort(chromium.ChromiumPort):
*comps)
path = self.path_from_chromium_base('xcodebuild', *comps)
- if os.path.exists(path) or self.get_option('use_test_shell'):
+ if self._filesystem.exists(path) or self.get_option('use_test_shell'):
return path
return self.path_from_webkit_base(
'Source', 'WebKit', 'chromium', 'xcodebuild', *comps)
@@ -132,8 +132,8 @@ class ChromiumMacPort(chromium.ChromiumPort):
return '/usr/sbin/httpd'
def _path_to_apache_config_file(self):
- return os.path.join(self.layout_tests_dir(), 'http', 'conf',
- 'apache2-httpd.conf')
+ return self._filesystem.join(self.layout_tests_dir(), 'http', 'conf',
+ 'apache2-httpd.conf')
def _path_to_lighttpd(self):
return self._lighttpd_path('bin', 'lighttpd')
diff --git a/Tools/Scripts/webkitpy/layout_tests/port/chromium_unittest.py b/Tools/Scripts/webkitpy/layout_tests/port/chromium_unittest.py
index 5a02cae..6c8987b 100644
--- a/Tools/Scripts/webkitpy/layout_tests/port/chromium_unittest.py
+++ b/Tools/Scripts/webkitpy/layout_tests/port/chromium_unittest.py
@@ -26,7 +26,6 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-import os
import unittest
import StringIO
@@ -131,7 +130,7 @@ class ChromiumPortTest(unittest.TestCase):
mock_options = mocktool.MockOptions()
port = ChromiumPortTest.TestLinuxPort(options=mock_options)
- fake_test = os.path.join(port.layout_tests_dir(), "fast/js/not-good.js")
+ fake_test = port._filesystem.join(port.layout_tests_dir(), "fast/js/not-good.js")
port.test_expectations = lambda: """BUG_TEST SKIP : fast/js/not-good.js = TEXT
LINUX WIN : fast/js/very-good.js = TIMEOUT PASS"""
diff --git a/Tools/Scripts/webkitpy/layout_tests/port/chromium_win.py b/Tools/Scripts/webkitpy/layout_tests/port/chromium_win.py
index 0fecc6d..14f2777 100644
--- a/Tools/Scripts/webkitpy/layout_tests/port/chromium_win.py
+++ b/Tools/Scripts/webkitpy/layout_tests/port/chromium_win.py
@@ -30,7 +30,6 @@
"""Chromium Win implementation of the Port interface."""
import logging
-import os
import sys
import chromium
@@ -111,13 +110,12 @@ class ChromiumWinPort(chromium.ChromiumPort):
*comps)
p = self.path_from_chromium_base('webkit', *comps)
- if os.path.exists(p):
+ if self._filesystem.exists(p):
return p
p = self.path_from_chromium_base('chrome', *comps)
- if os.path.exists(p) or self.get_option('use_test_shell'):
+ if self._filesystem.exists(p) or self.get_option('use_test_shell'):
return p
- return os.path.join(self.path_from_webkit_base(), 'WebKit', 'chromium',
- *comps)
+ return self._filesystem.join(self.path_from_webkit_base(), 'WebKit', 'chromium', *comps)
def _lighttpd_path(self, *comps):
return self.path_from_chromium_base('third_party', 'lighttpd', 'win',
@@ -128,8 +126,7 @@ class ChromiumWinPort(chromium.ChromiumPort):
'sbin', 'httpd')
def _path_to_apache_config_file(self):
- return os.path.join(self.layout_tests_dir(), 'http', 'conf',
- 'cygwin-httpd.conf')
+ return self._filesystem.join(self.layout_tests_dir(), 'http', 'conf', 'cygwin-httpd.conf')
def _path_to_lighttpd(self):
return self._lighttpd_path('LightTPD.exe')
diff --git a/Tools/Scripts/webkitpy/layout_tests/port/chromium_win_unittest.py b/Tools/Scripts/webkitpy/layout_tests/port/chromium_win_unittest.py
index 36f3c6b..d677589 100644
--- a/Tools/Scripts/webkitpy/layout_tests/port/chromium_win_unittest.py
+++ b/Tools/Scripts/webkitpy/layout_tests/port/chromium_win_unittest.py
@@ -45,13 +45,15 @@ class ChromiumWinTest(unittest.TestCase):
def tearDown(self):
sys.platform = self.orig_platform
+ self._port = None
def _mock_path_from_chromium_base(self, *comps):
- return os.path.join("/chromium/src", *comps)
+ return self._port._filesystem.join("/chromium/src", *comps)
def test_setup_environ_for_server(self):
port = chromium_win.ChromiumWinPort()
port._executive = mocktool.MockExecutive(should_log=True)
+ self._port = port
port.path_from_chromium_base = self._mock_path_from_chromium_base
output = outputcapture.OutputCapture()
orig_environ = os.environ.copy()
@@ -65,6 +67,7 @@ class ChromiumWinTest(unittest.TestCase):
options=ChromiumWinTest.RegisterCygwinOption())
port._executive = mocktool.MockExecutive(should_log=True)
port.path_from_chromium_base = self._mock_path_from_chromium_base
+ self._port = port
setup_mount = self._mock_path_from_chromium_base("third_party",
"cygwin",
"setup_mount.bat")
diff --git a/Tools/Scripts/webkitpy/layout_tests/port/google_chrome.py b/Tools/Scripts/webkitpy/layout_tests/port/google_chrome.py
index 8d94bb5..ae90374 100644
--- a/Tools/Scripts/webkitpy/layout_tests/port/google_chrome.py
+++ b/Tools/Scripts/webkitpy/layout_tests/port/google_chrome.py
@@ -24,11 +24,6 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-from __future__ import with_statement
-
-import codecs
-import os
-
def _test_expectations_overrides(port, super):
# The chrome ports use the regular overrides plus anything in the
@@ -40,14 +35,11 @@ def _test_expectations_overrides(port, super):
# this changed in r60427. This should probably be changed back.
overrides_path = port.path_from_chromium_base('webkit', 'tools',
'layout_tests', 'test_expectations_chrome.txt')
- if not os.path.exists(overrides_path):
+ if not port._filesystem.exists(overrides_path):
return chromium_overrides
- with codecs.open(overrides_path, "r", "utf-8") as file:
- if chromium_overrides:
- return chromium_overrides + file.read()
- else:
- return file.read()
+ chromium_overrides = chromium_overrides or ''
+ return chromium_overrides + port._filesystem.read_text_file(overrides_path)
def GetGoogleChromePort(**kwargs):
"""Some tests have slightly different results when compiled as Google
diff --git a/Tools/Scripts/webkitpy/layout_tests/port/google_chrome_unittest.py b/Tools/Scripts/webkitpy/layout_tests/port/google_chrome_unittest.py
index e60c274..6539bb2 100644
--- a/Tools/Scripts/webkitpy/layout_tests/port/google_chrome_unittest.py
+++ b/Tools/Scripts/webkitpy/layout_tests/port/google_chrome_unittest.py
@@ -50,7 +50,7 @@ class GetGoogleChromePortTest(unittest.TestCase):
port = google_chrome.GetGoogleChromePort(port_name=port_name,
options=None)
path = port.baseline_search_path()[0]
- self.assertEqual(expected_path, os.path.split(path)[1])
+ self.assertEqual(expected_path, port._filesystem.basename(path))
def _verify_expectations_overrides(self, port_name):
# FIXME: make this more robust when we have the Tree() abstraction.
diff --git a/Tools/Scripts/webkitpy/layout_tests/port/gtk.py b/Tools/Scripts/webkitpy/layout_tests/port/gtk.py
index a18fdff..0ec9f87 100644
--- a/Tools/Scripts/webkitpy/layout_tests/port/gtk.py
+++ b/Tools/Scripts/webkitpy/layout_tests/port/gtk.py
@@ -57,8 +57,8 @@ class GtkPort(WebKitPort):
def _path_to_apache_config_file(self):
# FIXME: This needs to detect the distribution and change config files.
- return os.path.join(self.layout_tests_dir(), 'http', 'conf',
- 'apache2-debian-httpd.conf')
+ return self._filesystem.join(self.layout_tests_dir(), 'http', 'conf',
+ 'apache2-debian-httpd.conf')
def _shut_down_http_server(self, server_pid):
"""Shut down the httpd web server. Blocks until it's fully
@@ -103,7 +103,7 @@ class GtkPort(WebKitPort):
else:
config_name = 'apache2-debian-httpd.conf'
- return os.path.join(self.layout_tests_dir(), 'http', 'conf',
+ return self._filesystem.join(self.layout_tests_dir(), 'http', 'conf',
config_name)
def _path_to_wdiff(self):
@@ -113,4 +113,4 @@ class GtkPort(WebKitPort):
return '/usr/bin/wdiff'
def _is_redhat_based(self):
- return os.path.exists(os.path.join('/etc', 'redhat-release'))
+ return self._filesystem.exists(self._filesystem.join('/etc', 'redhat-release'))
diff --git a/Tools/Scripts/webkitpy/layout_tests/port/mac.py b/Tools/Scripts/webkitpy/layout_tests/port/mac.py
index 696e339..0622196 100644
--- a/Tools/Scripts/webkitpy/layout_tests/port/mac.py
+++ b/Tools/Scripts/webkitpy/layout_tests/port/mac.py
@@ -76,9 +76,9 @@ class MacPort(WebKitPort):
# platforms and moved into base.Port.
skipped_files = []
if self._name in ('mac-tiger', 'mac-leopard', 'mac-snowleopard'):
- skipped_files.append(os.path.join(
+ skipped_files.append(self._filesystem.join(
self._webkit_baseline_path(self._name), 'Skipped'))
- skipped_files.append(os.path.join(self._webkit_baseline_path('mac'),
+ skipped_files.append(self._filesystem.join(self._webkit_baseline_path('mac'),
'Skipped'))
return skipped_files
@@ -99,7 +99,7 @@ class MacPort(WebKitPort):
return ''
def _build_java_test_support(self):
- java_tests_path = os.path.join(self.layout_tests_dir(), "java")
+ java_tests_path = self._filesystem.join(self.layout_tests_dir(), "java")
build_java = ["/usr/bin/make", "-C", java_tests_path]
if self._executive.run_command(build_java, return_exit_code=True):
_log.error("Failed to build Java support files: %s" % build_java)
@@ -124,8 +124,8 @@ class MacPort(WebKitPort):
]
def _path_to_apache_config_file(self):
- return os.path.join(self.layout_tests_dir(), 'http', 'conf',
- 'apache2-httpd.conf')
+ return self._filesystem.join(self.layout_tests_dir(), 'http', 'conf',
+ 'apache2-httpd.conf')
# FIXME: This doesn't have anything to do with WebKit.
def _shut_down_http_server(self, server_pid):
diff --git a/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py b/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py
index c4b36ac..30f3a56 100644
--- a/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py
+++ b/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py
@@ -28,8 +28,6 @@
"""Unit testing base class for Port implementations."""
-import os
-import tempfile
import unittest
from webkitpy.tool import mocktool
@@ -64,30 +62,25 @@ class PortTestCase(unittest.TestCase):
if not port:
return
- # FIXME: not sure why this shouldn't always be True
- #self.assertTrue(port.check_image_diff())
if not port.check_image_diff():
+ # The port hasn't been built - don't run the tests.
return
dir = port.layout_tests_dir()
- file1 = os.path.join(dir, 'fast', 'css', 'button_center.png')
- fh1 = file(file1)
- contents1 = fh1.read()
- file2 = os.path.join(dir, 'fast', 'css',
- 'remove-shorthand-expected.png')
- fh2 = file(file2)
- contents2 = fh2.read()
- tmpfile = tempfile.mktemp()
+ file1 = port._filesystem.join(dir, 'fast', 'css', 'button_center.png')
+ contents1 = port._filesystem.read_binary_file(file1)
+ file2 = port._filesystem.join(dir, 'fast', 'css',
+ 'remove-shorthand-expected.png')
+ contents2 = port._filesystem.read_binary_file(file2)
+ tmpfd, tmpfile = port._filesystem.open_binary_tempfile('')
+ tmpfd.close()
self.assertFalse(port.diff_image(contents1, contents1))
self.assertTrue(port.diff_image(contents1, contents2))
self.assertTrue(port.diff_image(contents1, contents2, tmpfile))
- fh1.close()
- fh2.close()
- # FIXME: this may not be being written?
- # self.assertTrue(os.path.exists(tmpfile))
- # os.remove(tmpfile)
+
+ port._filesystem.remove(tmpfile)
def test_websocket_server(self):
port = self.make_port()
diff --git a/Tools/Scripts/webkitpy/layout_tests/port/qt.py b/Tools/Scripts/webkitpy/layout_tests/port/qt.py
index af94acc..1695b60 100644
--- a/Tools/Scripts/webkitpy/layout_tests/port/qt.py
+++ b/Tools/Scripts/webkitpy/layout_tests/port/qt.py
@@ -71,8 +71,8 @@ class QtPort(WebKitPort):
def _path_to_apache_config_file(self):
# FIXME: This needs to detect the distribution and change config files.
- return os.path.join(self.layout_tests_dir(), 'http', 'conf',
- 'apache2-debian-httpd.conf')
+ return self._filesystem.join(self.layout_tests_dir(), 'http', 'conf',
+ 'apache2-debian-httpd.conf')
def _shut_down_http_server(self, server_pid):
"""Shut down the httpd web server. Blocks until it's fully
diff --git a/Tools/Scripts/webkitpy/layout_tests/port/webkit.py b/Tools/Scripts/webkitpy/layout_tests/port/webkit.py
index afdebeb..577acd4 100644
--- a/Tools/Scripts/webkitpy/layout_tests/port/webkit.py
+++ b/Tools/Scripts/webkitpy/layout_tests/port/webkit.py
@@ -31,20 +31,14 @@
"""WebKit implementations of the Port interface."""
-from __future__ import with_statement
-
-import codecs
import logging
+import operator
import os
import re
-import shutil
import signal
import sys
import time
import webbrowser
-import operator
-import tempfile
-import shutil
import webkitpy.common.system.ospath as ospath
import webkitpy.layout_tests.layout_package.test_output as test_output
@@ -72,8 +66,8 @@ class WebKitPort(base.Port):
return [self._webkit_baseline_path(self._name)]
def path_to_test_expectations_file(self):
- return os.path.join(self._webkit_baseline_path(self._name),
- 'test_expectations.txt')
+ return self._filesystem.join(self._webkit_baseline_path(self._name),
+ 'test_expectations.txt')
# Only needed by ports which maintain versioned test expectations (like mac-tiger vs. mac-leopard)
def version(self):
@@ -85,7 +79,7 @@ class WebKitPort(base.Port):
def _check_driver(self):
driver_path = self._path_to_driver()
- if not os.path.exists(driver_path):
+ if not self._filesystem.exists(driver_path):
_log.error("DumpRenderTree was not found at %s" % driver_path)
return False
return True
@@ -108,7 +102,7 @@ class WebKitPort(base.Port):
def check_image_diff(self, override_step=None, logging=True):
image_diff_path = self._path_to_image_diff()
- if not os.path.exists(image_diff_path):
+ if not self._filesystem.exists(image_diff_path):
_log.error("ImageDiff was not found at %s" % image_diff_path)
return False
return True
@@ -165,8 +159,7 @@ class WebKitPort(base.Port):
if m.group(2) == 'passed':
result = False
elif output and diff_filename:
- with open(diff_filename, 'w') as file:
- file.write(output)
+ self._filesystem.write_text_file(diff_filename, output)
elif sp.timed_out:
_log.error("ImageDiff timed out")
elif sp.crashed:
@@ -300,25 +293,22 @@ class WebKitPort(base.Port):
return tests_to_skip
def _skipped_file_paths(self):
- return [os.path.join(self._webkit_baseline_path(self._name),
- 'Skipped')]
+ return [self._filesystem.join(self._webkit_baseline_path(self._name), 'Skipped')]
def _expectations_from_skipped_files(self):
tests_to_skip = []
for filename in self._skipped_file_paths():
- if not os.path.exists(filename):
+ if not self._filesystem.exists(filename):
_log.warn("Failed to open Skipped file: %s" % filename)
continue
- with codecs.open(filename, "r", "utf-8") as skipped_file:
- tests_to_skip.extend(self._tests_from_skipped_file(skipped_file))
+ skipped_file = self._filesystem.read_text_file(filename)
return tests_to_skip
def test_expectations(self):
# The WebKit mac port uses a combination of a test_expectations file
# and 'Skipped' files.
expectations_path = self.path_to_test_expectations_file()
- with codecs.open(expectations_path, "r", "utf-8") as file:
- return file.read() + self._skips()
+ return self._filesystem.read_text_file(expectations_path) + self._skips()
def _skips(self):
# Each Skipped file contains a list of files
@@ -373,7 +363,7 @@ class WebKitPort(base.Port):
# The Apache binary path can vary depending on OS and distribution
# See http://wiki.apache.org/httpd/DistrosDefaultLayout
for path in ["/usr/sbin/httpd", "/usr/sbin/apache2"]:
- if os.path.exists(path):
+ if self._filesystem.exists(path):
self._cached_apache_path = path
break
@@ -389,10 +379,10 @@ class WebKitDriver(base.Driver):
def __init__(self, port, worker_number):
self._worker_number = worker_number
self._port = port
- self._driver_tempdir = tempfile.mkdtemp(prefix='DumpRenderTree-')
+ self._driver_tempdir = port._filesystem.mkdtemp(prefix='DumpRenderTree-')
def __del__(self):
- shutil.rmtree(self._driver_tempdir)
+ self._port._filesystem.rmtree(str(self._driver_tempdir))
def cmd_line(self):
cmd = self._command_wrapper(self._port.get_option('wrapper'))
@@ -406,7 +396,7 @@ class WebKitDriver(base.Driver):
def start(self):
environment = self._port.setup_environ_for_server()
environment['DYLD_FRAMEWORK_PATH'] = self._port._build_path()
- environment['DUMPRENDERTREE_TEMP'] = self._driver_tempdir
+ environment['DUMPRENDERTREE_TEMP'] = str(self._driver_tempdir)
self._server_process = server_process.ServerProcess(self._port,
"DumpRenderTree", self.cmd_line(), environment)
diff --git a/Tools/Scripts/webkitpy/layout_tests/port/win.py b/Tools/Scripts/webkitpy/layout_tests/port/win.py
index 9e30155..e7d2004 100644
--- a/Tools/Scripts/webkitpy/layout_tests/port/win.py
+++ b/Tools/Scripts/webkitpy/layout_tests/port/win.py
@@ -29,7 +29,6 @@
"""WebKit Win implementation of the Port interface."""
import logging
-import os
from webkitpy.layout_tests.port.webkit import WebKitPort
@@ -60,8 +59,8 @@ class WinPort(WebKitPort):
]
def _path_to_apache_config_file(self):
- return os.path.join(self.layout_tests_dir(), 'http', 'conf',
- 'cygwin-httpd.conf')
+ return self._filesystem.join(self.layout_tests_dir(), 'http', 'conf',
+ 'cygwin-httpd.conf')
def _shut_down_http_server(self, server_pid):
"""Shut down the httpd web server. Blocks until it's fully
diff --git a/Tools/Scripts/webkitpy/layout_tests/test_types/image_diff.py b/Tools/Scripts/webkitpy/layout_tests/test_types/image_diff.py
index da466c8..44605d2 100644
--- a/Tools/Scripts/webkitpy/layout_tests/test_types/image_diff.py
+++ b/Tools/Scripts/webkitpy/layout_tests/test_types/image_diff.py
@@ -34,13 +34,8 @@ match, returns FailureImageHashMismatch and outputs both hashes into the layout
test results directory.
"""
-from __future__ import with_statement
-
-import codecs
import errno
import logging
-import os
-import shutil
from webkitpy.layout_tests.layout_package import test_failures
from webkitpy.layout_tests.test_types import test_type_base
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list