Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(368)

Side by Side Diff: Tools/Scripts/webkitpy/layout_tests/port/base.py

Issue 1154373005: Introduce WPTServe for running W3C Blink Layout tests (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add executable bit to pass permchecks. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright (C) 2010 Google Inc. All rights reserved. 1 # Copyright (C) 2010 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 from webkitpy.common.webkit_finder import WebKitFinder 58 from webkitpy.common.webkit_finder import WebKitFinder
59 from webkitpy.layout_tests.layout_package.bot_test_expectations import BotTestEx pectationsFactory 59 from webkitpy.layout_tests.layout_package.bot_test_expectations import BotTestEx pectationsFactory
60 from webkitpy.layout_tests.models import test_run_results 60 from webkitpy.layout_tests.models import test_run_results
61 from webkitpy.layout_tests.models.test_configuration import TestConfiguration 61 from webkitpy.layout_tests.models.test_configuration import TestConfiguration
62 from webkitpy.layout_tests.port import config as port_config 62 from webkitpy.layout_tests.port import config as port_config
63 from webkitpy.layout_tests.port import driver 63 from webkitpy.layout_tests.port import driver
64 from webkitpy.layout_tests.port import server_process 64 from webkitpy.layout_tests.port import server_process
65 from webkitpy.layout_tests.port.factory import PortFactory 65 from webkitpy.layout_tests.port.factory import PortFactory
66 from webkitpy.layout_tests.servers import apache_http 66 from webkitpy.layout_tests.servers import apache_http
67 from webkitpy.layout_tests.servers import pywebsocket 67 from webkitpy.layout_tests.servers import pywebsocket
68 from webkitpy.layout_tests.servers import wptserve
68 69
69 _log = logging.getLogger(__name__) 70 _log = logging.getLogger(__name__)
70 71
71 72
72 # FIXME: This class should merge with WebKitPort now that Chromium behaves mostl y like other webkit ports. 73 # FIXME: This class should merge with WebKitPort now that Chromium behaves mostl y like other webkit ports.
73 class Port(object): 74 class Port(object):
74 """Abstract class for Port-specific hooks for the layout_test package.""" 75 """Abstract class for Port-specific hooks for the layout_test package."""
75 76
76 # Subclasses override this. This should indicate the basic implementation 77 # Subclasses override this. This should indicate the basic implementation
77 # part of the port name, e.g., 'mac', 'win', 'gtk'; there is probably (?) 78 # part of the port name, e.g., 'mac', 'win', 'gtk'; there is probably (?)
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 182
182 self.host = host 183 self.host = host
183 self._executive = host.executive 184 self._executive = host.executive
184 self._filesystem = host.filesystem 185 self._filesystem = host.filesystem
185 self._webkit_finder = WebKitFinder(host.filesystem) 186 self._webkit_finder = WebKitFinder(host.filesystem)
186 self._config = port_config.Config(self._executive, self._filesystem, sel f.port_name) 187 self._config = port_config.Config(self._executive, self._filesystem, sel f.port_name)
187 188
188 self._helper = None 189 self._helper = None
189 self._http_server = None 190 self._http_server = None
190 self._websocket_server = None 191 self._websocket_server = None
192 self._is_wpt_enabled = hasattr(options, 'enable_wptserve') and options.e nable_wptserve
193 self._wpt_server = None
191 self._image_differ = None 194 self._image_differ = None
192 self._server_process_constructor = server_process.ServerProcess # overr idable for testing 195 self._server_process_constructor = server_process.ServerProcess # overr idable for testing
193 self._http_lock = None # FIXME: Why does this live on the port object? 196 self._http_lock = None # FIXME: Why does this live on the port object?
194 self._dump_reader = None 197 self._dump_reader = None
195 198
196 # Python's Popen has a bug that causes any pipes opened to a 199 # Python's Popen has a bug that causes any pipes opened to a
197 # process that can't be executed to be leaked. Since this 200 # process that can't be executed to be leaked. Since this
198 # code is specifically designed to tolerate exec failures 201 # code is specifically designed to tolerate exec failures
199 # to gracefully handle cases where wdiff is not installed, 202 # to gracefully handle cases where wdiff is not installed,
200 # the bug results in a massive file descriptor leak. As a 203 # the bug results in a massive file descriptor leak. As a
(...skipping 962 matching lines...) Expand 10 before | Expand all | Expand 10 after
1163 def start_websocket_server(self): 1166 def start_websocket_server(self):
1164 """Start a web server. Raise an error if it can't start or is already ru nning. 1167 """Start a web server. Raise an error if it can't start or is already ru nning.
1165 1168
1166 Ports can stub this out if they don't need a websocket server to be runn ing.""" 1169 Ports can stub this out if they don't need a websocket server to be runn ing."""
1167 assert not self._websocket_server, 'Already running a websocket server.' 1170 assert not self._websocket_server, 'Already running a websocket server.'
1168 1171
1169 server = pywebsocket.PyWebSocket(self, self.results_directory()) 1172 server = pywebsocket.PyWebSocket(self, self.results_directory())
1170 server.start() 1173 server.start()
1171 self._websocket_server = server 1174 self._websocket_server = server
1172 1175
1176 def is_wpt_enabled(self):
1177 """Used as feature flag for WPT Serve feature."""
1178 return self._is_wpt_enabled
1179
1180 def is_wpt_test(self, test):
1181 """Whether this test is part of a web-platform-tests which require wptse rve servers."""
1182 return "web-platform-tests" in test
1183
1184 def start_wptserve(self):
1185 """Start a WPT web server. Raise an error if it can't start or is alread y running.
1186
1187 Ports can stub this out if they don't need a WPT web server to be runnin g."""
1188 assert not self._wpt_server, 'Already running an http server.'
1189 assert self.is_wpt_enabled(), 'Cannot start server if WPT is not enabled .'
1190
1191 # We currently don't support any output mechanism for the WPT server.
1192 server = wptserve.WPTServe(self, self.results_directory())
1193 server.start()
1194 self._wpt_server = server
1195
1196 def stop_wptserve(self):
1197 """Shut down the WPT server if it is running. Do nothing if it isn't."""
1198 if self._wpt_server:
1199 self._wpt_server.stop()
1200 self._wpt_server = None
1201
1173 def http_server_supports_ipv6(self): 1202 def http_server_supports_ipv6(self):
1174 # Apache < 2.4 on win32 does not support IPv6, nor does cygwin apache. 1203 # Apache < 2.4 on win32 does not support IPv6, nor does cygwin apache.
1175 if self.host.platform.is_cygwin() or self.host.platform.is_win(): 1204 if self.host.platform.is_cygwin() or self.host.platform.is_win():
1176 return False 1205 return False
1177 return True 1206 return True
1178 1207
1179 def stop_helper(self): 1208 def stop_helper(self):
1180 """Shut down the test helper if it is running. Do nothing if 1209 """Shut down the test helper if it is running. Do nothing if
1181 it isn't, or it isn't available. If a port overrides start_helper() 1210 it isn't, or it isn't available. If a port overrides start_helper()
1182 it must override this routine as well.""" 1211 it must override this routine as well."""
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
1646 for suite in self.physical_test_suites(): 1675 for suite in self.physical_test_suites():
1647 if test_name.startswith(suite.name): 1676 if test_name.startswith(suite.name):
1648 return suite.reference_args 1677 return suite.reference_args
1649 return [] 1678 return []
1650 1679
1651 def should_run_as_pixel_test(self, test_input): 1680 def should_run_as_pixel_test(self, test_input):
1652 if not self._options.pixel_tests: 1681 if not self._options.pixel_tests:
1653 return False 1682 return False
1654 if self._options.pixel_test_directories: 1683 if self._options.pixel_test_directories:
1655 return any(test_input.test_name.startswith(directory) for directory in self._options.pixel_test_directories) 1684 return any(test_input.test_name.startswith(directory) for directory in self._options.pixel_test_directories)
1685 # TODO(burnik): Make sure this is the right way to do it.
1686 if self.is_wpt_enabled() and self.is_wpt_test(test_input.test_name):
1687 return False
1656 return True 1688 return True
1657 1689
1658 def _modules_to_search_for_symbols(self): 1690 def _modules_to_search_for_symbols(self):
1659 path = self._path_to_webcore_library() 1691 path = self._path_to_webcore_library()
1660 if path: 1692 if path:
1661 return [path] 1693 return [path]
1662 return [] 1694 return []
1663 1695
1664 def _symbols_string(self): 1696 def _symbols_string(self):
1665 symbols = '' 1697 symbols = ''
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1769 class PhysicalTestSuite(object): 1801 class PhysicalTestSuite(object):
1770 def __init__(self, base, args, reference_args=None): 1802 def __init__(self, base, args, reference_args=None):
1771 self.name = base 1803 self.name = base
1772 self.base = base 1804 self.base = base
1773 self.args = args 1805 self.args = args
1774 self.reference_args = args if reference_args is None else reference_args 1806 self.reference_args = args if reference_args is None else reference_args
1775 self.tests = set() 1807 self.tests = set()
1776 1808
1777 def __repr__(self): 1809 def __repr__(self):
1778 return "PhysicalTestSuite('%s', '%s', %s, %s)" % (self.name, self.base, self.args, self.reference_args) 1810 return "PhysicalTestSuite('%s', '%s', %s, %s)" % (self.name, self.base, self.args, self.reference_args)
OLDNEW
« no previous file with comments | « Tools/Scripts/webkitpy/layout_tests/controllers/manager.py ('k') | Tools/Scripts/webkitpy/layout_tests/port/driver.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698