Changeset 76322 in webkit
- Timestamp:
- Jan 20, 2011 6:30:17 PM (13 years ago)
- Location:
- trunk/Tools
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r76321 r76322 1 2011-01-20 Dirk Pranke <dpranke@chromium.org> 2 3 Reviewed by Eric Siedel. 4 5 nrwt: clean up almost all remaining port references, remove 6 unnecessary import clauses. The only remaining references are 7 in places where a mock filesystem makes no sense or can't be 8 used, and in one routine in port/google_chrome_unittest that 9 I'll rewrite in a separate patch. 10 11 https://bugs.webkit.org/show_bug.cgi?id=52771 12 13 * Scripts/webkitpy/layout_tests/layout_package/test_runner.py: 14 * Scripts/webkitpy/layout_tests/port/chromium_gpu.py: 15 * Scripts/webkitpy/layout_tests/port/chromium_gpu_unittest.py: 16 * Scripts/webkitpy/layout_tests/port/chromium_linux.py: 17 * Scripts/webkitpy/layout_tests/port/chromium_mac.py: 18 * Scripts/webkitpy/layout_tests/port/chromium_unittest.py: 19 * Scripts/webkitpy/layout_tests/port/chromium_win.py: 20 * Scripts/webkitpy/layout_tests/port/chromium_win_unittest.py: 21 * Scripts/webkitpy/layout_tests/port/google_chrome.py: 22 * Scripts/webkitpy/layout_tests/port/google_chrome_unittest.py: 23 * Scripts/webkitpy/layout_tests/port/gtk.py: 24 * Scripts/webkitpy/layout_tests/port/mac.py: 25 * Scripts/webkitpy/layout_tests/port/port_testcase.py: 26 * Scripts/webkitpy/layout_tests/port/qt.py: 27 * Scripts/webkitpy/layout_tests/port/webkit.py: 28 * Scripts/webkitpy/layout_tests/port/win.py: 29 * Scripts/webkitpy/layout_tests/test_types/image_diff.py: 30 1 31 2011-01-20 Dirk Pranke <dpranke@chromium.org> 2 32 -
trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/test_runner.py
r76200 r76322 43 43 import Queue 44 44 import random 45 import shutil46 45 import sys 47 46 import time -
trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_gpu.py
r73748 r76322 25 25 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 26 27 from __future__ import with_statement28 29 import codecs30 import os31 27 import sys 32 28 … … 83 79 except AssertionError: 84 80 return None 85 if not os.path.exists(overrides_path):81 if not port._filesystem.exists(overrides_path): 86 82 return None 87 with codecs.open(overrides_path, "r", "utf-8") as file: 88 return file.read() 83 return port._filesystem.read_text_file(overrides_path) 89 84 90 85 -
trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_gpu_unittest.py
r73748 r76322 25 25 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 26 27 import os28 27 import unittest 29 28 -
trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_linux.py
r76190 r76322 84 84 85 85 base = self.path_from_chromium_base() 86 if os.path.exists(os.path.join(base, 'sconsbuild')):87 return os.path.join(base, 'sconsbuild', *comps)88 if os.path.exists(os.path.join(base, 'out', *comps)) or self.get_option('use_test_shell'):89 return os.path.join(base, 'out', *comps)86 if self._filesystem.exists(self._filesystem.join(base, 'sconsbuild')): 87 return self._filesystem.join(base, 'sconsbuild', *comps) 88 if self._filesystem.exists(self._filesystem.join(base, 'out', *comps)) or self.get_option('use_test_shell'): 89 return self._filesystem.join(base, 'out', *comps) 90 90 base = self.path_from_webkit_base() 91 if os.path.exists(os.path.join(base, 'sconsbuild')):92 return os.path.join(base, 'sconsbuild', *comps)93 return os.path.join(base, 'out', *comps)91 if self._filesystem.exists(self._filesystem.join(base, 'sconsbuild')): 92 return self._filesystem.join(base, 'sconsbuild', *comps) 93 return self._filesystem.join(base, 'out', *comps) 94 94 95 95 def _check_apache_install(self): … … 138 138 config_name = 'apache2-debian-httpd.conf' 139 139 140 return os.path.join(self.layout_tests_dir(), 'http', 'conf',140 return self._filesystem.join(self.layout_tests_dir(), 'http', 'conf', 141 141 config_name) 142 142 … … 168 168 169 169 def _is_redhat_based(self): 170 return os.path.exists(os.path.join('/etc', 'redhat-release'))170 return self._filesystem.exists(self._filesystem.join('/etc', 'redhat-release')) 171 171 172 172 def _shut_down_http_server(self, server_pid): -
trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_mac.py
r76101 r76322 111 111 112 112 path = self.path_from_chromium_base('xcodebuild', *comps) 113 if os.path.exists(path) or self.get_option('use_test_shell'):113 if self._filesystem.exists(path) or self.get_option('use_test_shell'): 114 114 return path 115 115 return self.path_from_webkit_base( … … 133 133 134 134 def _path_to_apache_config_file(self): 135 return os.path.join(self.layout_tests_dir(), 'http', 'conf',136 'apache2-httpd.conf')135 return self._filesystem.join(self.layout_tests_dir(), 'http', 'conf', 136 'apache2-httpd.conf') 137 137 138 138 def _path_to_lighttpd(self): -
trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_unittest.py
r76184 r76322 27 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 28 29 import os30 29 import unittest 31 30 import StringIO … … 132 131 port = ChromiumPortTest.TestLinuxPort(options=mock_options) 133 132 134 fake_test = os.path.join(port.layout_tests_dir(), "fast/js/not-good.js")133 fake_test = port._filesystem.join(port.layout_tests_dir(), "fast/js/not-good.js") 135 134 136 135 port.test_expectations = lambda: """BUG_TEST SKIP : fast/js/not-good.js = TEXT -
trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_win.py
r76101 r76322 31 31 32 32 import logging 33 import os34 33 import sys 35 34 … … 112 111 113 112 p = self.path_from_chromium_base('webkit', *comps) 114 if os.path.exists(p):113 if self._filesystem.exists(p): 115 114 return p 116 115 p = self.path_from_chromium_base('chrome', *comps) 117 if os.path.exists(p) or self.get_option('use_test_shell'):116 if self._filesystem.exists(p) or self.get_option('use_test_shell'): 118 117 return p 119 return os.path.join(self.path_from_webkit_base(), 'WebKit', 'chromium', 120 *comps) 118 return self._filesystem.join(self.path_from_webkit_base(), 'WebKit', 'chromium', *comps) 121 119 122 120 def _lighttpd_path(self, *comps): … … 129 127 130 128 def _path_to_apache_config_file(self): 131 return os.path.join(self.layout_tests_dir(), 'http', 'conf', 132 'cygwin-httpd.conf') 129 return self._filesystem.join(self.layout_tests_dir(), 'http', 'conf', 'cygwin-httpd.conf') 133 130 134 131 def _path_to_lighttpd(self): -
trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_win_unittest.py
r70731 r76322 46 46 def tearDown(self): 47 47 sys.platform = self.orig_platform 48 self._port = None 48 49 49 50 def _mock_path_from_chromium_base(self, *comps): 50 return os.path.join("/chromium/src", *comps)51 return self._port._filesystem.join("/chromium/src", *comps) 51 52 52 53 def test_setup_environ_for_server(self): 53 54 port = chromium_win.ChromiumWinPort() 54 55 port._executive = mocktool.MockExecutive(should_log=True) 56 self._port = port 55 57 port.path_from_chromium_base = self._mock_path_from_chromium_base 56 58 output = outputcapture.OutputCapture() … … 66 68 port._executive = mocktool.MockExecutive(should_log=True) 67 69 port.path_from_chromium_base = self._mock_path_from_chromium_base 70 self._port = port 68 71 setup_mount = self._mock_path_from_chromium_base("third_party", 69 72 "cygwin", -
trunk/Tools/Scripts/webkitpy/layout_tests/port/google_chrome.py
r69079 r76322 25 25 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 26 27 from __future__ import with_statement28 29 import codecs30 import os31 32 27 33 28 def _test_expectations_overrides(port, super): … … 41 36 overrides_path = port.path_from_chromium_base('webkit', 'tools', 42 37 'layout_tests', 'test_expectations_chrome.txt') 43 if not os.path.exists(overrides_path):38 if not port._filesystem.exists(overrides_path): 44 39 return chromium_overrides 45 40 46 with codecs.open(overrides_path, "r", "utf-8") as file: 47 if chromium_overrides: 48 return chromium_overrides + file.read() 49 else: 50 return file.read() 41 chromium_overrides = chromium_overrides or '' 42 return chromium_overrides + port._filesystem.read_text_file(overrides_path) 51 43 52 44 def GetGoogleChromePort(**kwargs): -
trunk/Tools/Scripts/webkitpy/layout_tests/port/google_chrome_unittest.py
r71580 r76322 51 51 options=None) 52 52 path = port.baseline_search_path()[0] 53 self.assertEqual(expected_path, os.path.split(path)[1])53 self.assertEqual(expected_path, port._filesystem.basename(path)) 54 54 55 55 def _verify_expectations_overrides(self, port_name): -
trunk/Tools/Scripts/webkitpy/layout_tests/port/gtk.py
r73873 r76322 58 58 def _path_to_apache_config_file(self): 59 59 # FIXME: This needs to detect the distribution and change config files. 60 return os.path.join(self.layout_tests_dir(), 'http', 'conf',61 'apache2-debian-httpd.conf')60 return self._filesystem.join(self.layout_tests_dir(), 'http', 'conf', 61 'apache2-debian-httpd.conf') 62 62 63 63 def _shut_down_http_server(self, server_pid): … … 104 104 config_name = 'apache2-debian-httpd.conf' 105 105 106 return os.path.join(self.layout_tests_dir(), 'http', 'conf',106 return self._filesystem.join(self.layout_tests_dir(), 'http', 'conf', 107 107 config_name) 108 108 … … 114 114 115 115 def _is_redhat_based(self): 116 return os.path.exists(os.path.join('/etc', 'redhat-release'))116 return self._filesystem.exists(self._filesystem.join('/etc', 'redhat-release')) -
trunk/Tools/Scripts/webkitpy/layout_tests/port/mac.py
r68008 r76322 77 77 skipped_files = [] 78 78 if self._name in ('mac-tiger', 'mac-leopard', 'mac-snowleopard'): 79 skipped_files.append( os.path.join(79 skipped_files.append(self._filesystem.join( 80 80 self._webkit_baseline_path(self._name), 'Skipped')) 81 skipped_files.append( os.path.join(self._webkit_baseline_path('mac'),81 skipped_files.append(self._filesystem.join(self._webkit_baseline_path('mac'), 82 82 'Skipped')) 83 83 return skipped_files … … 100 100 101 101 def _build_java_test_support(self): 102 java_tests_path = os.path.join(self.layout_tests_dir(), "java")102 java_tests_path = self._filesystem.join(self.layout_tests_dir(), "java") 103 103 build_java = ["/usr/bin/make", "-C", java_tests_path] 104 104 if self._executive.run_command(build_java, return_exit_code=True): … … 125 125 126 126 def _path_to_apache_config_file(self): 127 return os.path.join(self.layout_tests_dir(), 'http', 'conf',128 'apache2-httpd.conf')127 return self._filesystem.join(self.layout_tests_dir(), 'http', 'conf', 128 'apache2-httpd.conf') 129 129 130 130 # FIXME: This doesn't have anything to do with WebKit. -
trunk/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py
r75626 r76322 29 29 """Unit testing base class for Port implementations.""" 30 30 31 import os32 import tempfile33 31 import unittest 34 32 … … 65 63 return 66 64 67 # FIXME: not sure why this shouldn't always be True68 #self.assertTrue(port.check_image_diff())69 65 if not port.check_image_diff(): 66 # The port hasn't been built - don't run the tests. 70 67 return 71 68 72 69 dir = port.layout_tests_dir() 73 file1 = os.path.join(dir, 'fast', 'css', 'button_center.png') 74 fh1 = file(file1) 75 contents1 = fh1.read() 76 file2 = os.path.join(dir, 'fast', 'css', 77 'remove-shorthand-expected.png') 78 fh2 = file(file2) 79 contents2 = fh2.read() 80 tmpfile = tempfile.mktemp() 70 file1 = port._filesystem.join(dir, 'fast', 'css', 'button_center.png') 71 contents1 = port._filesystem.read_binary_file(file1) 72 file2 = port._filesystem.join(dir, 'fast', 'css', 73 'remove-shorthand-expected.png') 74 contents2 = port._filesystem.read_binary_file(file2) 75 tmpfd, tmpfile = port._filesystem.open_binary_tempfile('') 76 tmpfd.close() 81 77 82 78 self.assertFalse(port.diff_image(contents1, contents1)) … … 84 80 85 81 self.assertTrue(port.diff_image(contents1, contents2, tmpfile)) 86 fh1.close() 87 fh2.close() 88 # FIXME: this may not be being written? 89 # self.assertTrue(os.path.exists(tmpfile)) 90 # os.remove(tmpfile) 82 83 port._filesystem.remove(tmpfile) 91 84 92 85 def test_websocket_server(self): -
trunk/Tools/Scripts/webkitpy/layout_tests/port/qt.py
r70643 r76322 72 72 def _path_to_apache_config_file(self): 73 73 # FIXME: This needs to detect the distribution and change config files. 74 return os.path.join(self.layout_tests_dir(), 'http', 'conf',75 'apache2-debian-httpd.conf')74 return self._filesystem.join(self.layout_tests_dir(), 'http', 'conf', 75 'apache2-debian-httpd.conf') 76 76 77 77 def _shut_down_http_server(self, server_pid): -
trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit.py
r73748 r76322 32 32 33 33 34 from __future__ import with_statement35 36 import codecs37 34 import logging 35 import operator 38 36 import os 39 37 import re 40 import shutil41 38 import signal 42 39 import sys 43 40 import time 44 41 import webbrowser 45 import operator46 import tempfile47 import shutil48 42 49 43 import webkitpy.common.system.ospath as ospath … … 73 67 74 68 def path_to_test_expectations_file(self): 75 return os.path.join(self._webkit_baseline_path(self._name),76 'test_expectations.txt')69 return self._filesystem.join(self._webkit_baseline_path(self._name), 70 'test_expectations.txt') 77 71 78 72 # Only needed by ports which maintain versioned test expectations (like mac-tiger vs. mac-leopard) … … 86 80 def _check_driver(self): 87 81 driver_path = self._path_to_driver() 88 if not os.path.exists(driver_path):82 if not self._filesystem.exists(driver_path): 89 83 _log.error("DumpRenderTree was not found at %s" % driver_path) 90 84 return False … … 109 103 def check_image_diff(self, override_step=None, logging=True): 110 104 image_diff_path = self._path_to_image_diff() 111 if not os.path.exists(image_diff_path):105 if not self._filesystem.exists(image_diff_path): 112 106 _log.error("ImageDiff was not found at %s" % image_diff_path) 113 107 return False … … 166 160 result = False 167 161 elif output and diff_filename: 168 with open(diff_filename, 'w') as file: 169 file.write(output) 162 self._filesystem.write_text_file(diff_filename, output) 170 163 elif sp.timed_out: 171 164 _log.error("ImageDiff timed out") … … 301 294 302 295 def _skipped_file_paths(self): 303 return [os.path.join(self._webkit_baseline_path(self._name), 304 'Skipped')] 296 return [self._filesystem.join(self._webkit_baseline_path(self._name), 'Skipped')] 305 297 306 298 def _expectations_from_skipped_files(self): 307 299 tests_to_skip = [] 308 300 for filename in self._skipped_file_paths(): 309 if not os.path.exists(filename):301 if not self._filesystem.exists(filename): 310 302 _log.warn("Failed to open Skipped file: %s" % filename) 311 303 continue 312 with codecs.open(filename, "r", "utf-8") as skipped_file: 313 tests_to_skip.extend(self._tests_from_skipped_file(skipped_file)) 304 skipped_file = self._filesystem.read_text_file(filename) 314 305 return tests_to_skip 315 306 … … 318 309 # and 'Skipped' files. 319 310 expectations_path = self.path_to_test_expectations_file() 320 with codecs.open(expectations_path, "r", "utf-8") as file: 321 return file.read() + self._skips() 311 return self._filesystem.read_text_file(expectations_path) + self._skips() 322 312 323 313 def _skips(self): … … 374 364 # See http://wiki.apache.org/httpd/DistrosDefaultLayout 375 365 for path in ["/usr/sbin/httpd", "/usr/sbin/apache2"]: 376 if os.path.exists(path):366 if self._filesystem.exists(path): 377 367 self._cached_apache_path = path 378 368 break … … 390 380 self._worker_number = worker_number 391 381 self._port = port 392 self._driver_tempdir = tempfile.mkdtemp(prefix='DumpRenderTree-')382 self._driver_tempdir = port._filesystem.mkdtemp(prefix='DumpRenderTree-') 393 383 394 384 def __del__(self): 395 s hutil.rmtree(self._driver_tempdir)385 self._port._filesystem.rmtree(str(self._driver_tempdir)) 396 386 397 387 def cmd_line(self): … … 407 397 environment = self._port.setup_environ_for_server() 408 398 environment['DYLD_FRAMEWORK_PATH'] = self._port._build_path() 409 environment['DUMPRENDERTREE_TEMP'] = s elf._driver_tempdir399 environment['DUMPRENDERTREE_TEMP'] = str(self._driver_tempdir) 410 400 self._server_process = server_process.ServerProcess(self._port, 411 401 "DumpRenderTree", self.cmd_line(), environment) -
trunk/Tools/Scripts/webkitpy/layout_tests/port/win.py
r68008 r76322 30 30 31 31 import logging 32 import os33 32 34 33 from webkitpy.layout_tests.port.webkit import WebKitPort … … 61 60 62 61 def _path_to_apache_config_file(self): 63 return os.path.join(self.layout_tests_dir(), 'http', 'conf',64 'cygwin-httpd.conf')62 return self._filesystem.join(self.layout_tests_dir(), 'http', 'conf', 63 'cygwin-httpd.conf') 65 64 66 65 def _shut_down_http_server(self, server_pid): -
trunk/Tools/Scripts/webkitpy/layout_tests/test_types/image_diff.py
r73256 r76322 35 35 """ 36 36 37 from __future__ import with_statement38 39 import codecs40 37 import errno 41 38 import logging 42 import os43 import shutil44 39 45 40 from webkitpy.layout_tests.layout_package import test_failures
Note: See TracChangeset
for help on using the changeset viewer.