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

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: 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 from webkitpy.common.system.systemhost import SystemHost 57 from webkitpy.common.system.systemhost import SystemHost
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.third_party import wptserve_http
jsbell 2015/06/04 17:43:25 nit: sort the import lines
burnik 2015/06/05 12:59:28 Done.
67 from webkitpy.layout_tests.servers import pywebsocket 68 from webkitpy.layout_tests.servers import pywebsocket
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
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 181
181 self.host = host 182 self.host = host
182 self._executive = host.executive 183 self._executive = host.executive
183 self._filesystem = host.filesystem 184 self._filesystem = host.filesystem
184 self._webkit_finder = WebKitFinder(host.filesystem) 185 self._webkit_finder = WebKitFinder(host.filesystem)
185 self._config = port_config.Config(self._executive, self._filesystem, sel f.port_name) 186 self._config = port_config.Config(self._executive, self._filesystem, sel f.port_name)
186 187
187 self._helper = None 188 self._helper = None
188 self._http_server = None 189 self._http_server = None
189 self._websocket_server = None 190 self._websocket_server = None
191 self._wpt_server = None
190 self._image_differ = None 192 self._image_differ = None
191 self._server_process_constructor = server_process.ServerProcess # overr idable for testing 193 self._server_process_constructor = server_process.ServerProcess # overr idable for testing
192 self._http_lock = None # FIXME: Why does this live on the port object? 194 self._http_lock = None # FIXME: Why does this live on the port object?
193 self._dump_reader = None 195 self._dump_reader = None
194 196
195 # Python's Popen has a bug that causes any pipes opened to a 197 # Python's Popen has a bug that causes any pipes opened to a
196 # process that can't be executed to be leaked. Since this 198 # process that can't be executed to be leaked. Since this
197 # code is specifically designed to tolerate exec failures 199 # code is specifically designed to tolerate exec failures
198 # to gracefully handle cases where wdiff is not installed, 200 # to gracefully handle cases where wdiff is not installed,
199 # the bug results in a massive file descriptor leak. As a 201 # the bug results in a massive file descriptor leak. As a
(...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after
1156 def start_websocket_server(self): 1158 def start_websocket_server(self):
1157 """Start a web server. Raise an error if it can't start or is already ru nning. 1159 """Start a web server. Raise an error if it can't start or is already ru nning.
1158 1160
1159 Ports can stub this out if they don't need a websocket server to be runn ing.""" 1161 Ports can stub this out if they don't need a websocket server to be runn ing."""
1160 assert not self._websocket_server, 'Already running a websocket server.' 1162 assert not self._websocket_server, 'Already running a websocket server.'
1161 1163
1162 server = pywebsocket.PyWebSocket(self, self.results_directory()) 1164 server = pywebsocket.PyWebSocket(self, self.results_directory())
1163 server.start() 1165 server.start()
1164 self._websocket_server = server 1166 self._websocket_server = server
1165 1167
1168 @memoized
1169 def is_wpt_enabled(self):
1170 """Used as feature flag for WPT Serve feature."""
1171 wpt_flag_file = self._filesystem.join(self.layout_tests_dir(), "WPT_DISA BLED")
1172 return not self._filesystem.exists(wpt_flag_file)
1173
1174 def start_wptserve(self):
1175 """Start a WPT web server. Raise an error if it can't start or is alread y running.
1176
1177 Ports can stub this out if they don't need a WPT web server to be runnin g."""
1178 assert not self._wpt_server, 'Already running an http server.'
1179 assert self.is_wpt_enabled(), 'Cannot start server if WPT is not enabled .'
1180
1181 # We currently don't support any output mechanism for the WPT server.
1182 server = wptserve_http.WPTServeHTTP(self, self.results_directory())
1183 server.start()
1184 self._wpt_server = server
1185
1186 def stop_wptserve(self):
1187 """Shut down the WPT server if it is running. Do nothing if it isn't."""
1188 if self._wpt_server:
1189 self._wpt_server.stop()
1190 self._wpt_server = None
1191
1166 def http_server_supports_ipv6(self): 1192 def http_server_supports_ipv6(self):
1167 # Apache < 2.4 on win32 does not support IPv6, nor does cygwin apache. 1193 # Apache < 2.4 on win32 does not support IPv6, nor does cygwin apache.
1168 if self.host.platform.is_cygwin() or self.host.platform.is_win(): 1194 if self.host.platform.is_cygwin() or self.host.platform.is_win():
1169 return False 1195 return False
1170 return True 1196 return True
1171 1197
1172 def stop_helper(self): 1198 def stop_helper(self):
1173 """Shut down the test helper if it is running. Do nothing if 1199 """Shut down the test helper if it is running. Do nothing if
1174 it isn't, or it isn't available. If a port overrides start_helper() 1200 it isn't, or it isn't available. If a port overrides start_helper()
1175 it must override this routine as well.""" 1201 it must override this routine as well."""
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
1629 for suite in self.physical_test_suites(): 1655 for suite in self.physical_test_suites():
1630 if test_name.startswith(suite.name): 1656 if test_name.startswith(suite.name):
1631 return suite.reference_args 1657 return suite.reference_args
1632 return [] 1658 return []
1633 1659
1634 def should_run_as_pixel_test(self, test_input): 1660 def should_run_as_pixel_test(self, test_input):
1635 if not self._options.pixel_tests: 1661 if not self._options.pixel_tests:
1636 return False 1662 return False
1637 if self._options.pixel_test_directories: 1663 if self._options.pixel_test_directories:
1638 return any(test_input.test_name.startswith(directory) for directory in self._options.pixel_test_directories) 1664 return any(test_input.test_name.startswith(directory) for directory in self._options.pixel_test_directories)
1665 # TODO(burnik): Make sure this is the right way to do it.
1666 # Also, remove the feature check when WPT serve becomes stable.
1667 if self.is_wpt_enabled() and "web-platform-tests" in test_input.test_nam e:
jsbell 2015/06/04 17:43:25 Can you factor out is_wpt_test() or just use one f
burnik 2015/06/05 12:59:28 Done.
1668 return False
Dirk Pranke 2015/06/04 20:51:53 why do you need this block at all?
burnik 2015/06/05 12:59:28 When this was regarded as a pixel test, I had issu
1639 return True 1669 return True
1640 1670
1641 def _modules_to_search_for_symbols(self): 1671 def _modules_to_search_for_symbols(self):
1642 path = self._path_to_webcore_library() 1672 path = self._path_to_webcore_library()
1643 if path: 1673 if path:
1644 return [path] 1674 return [path]
1645 return [] 1675 return []
1646 1676
1647 def _symbols_string(self): 1677 def _symbols_string(self):
1648 symbols = '' 1678 symbols = ''
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1752 class PhysicalTestSuite(object): 1782 class PhysicalTestSuite(object):
1753 def __init__(self, base, args, reference_args=None): 1783 def __init__(self, base, args, reference_args=None):
1754 self.name = base 1784 self.name = base
1755 self.base = base 1785 self.base = base
1756 self.args = args 1786 self.args = args
1757 self.reference_args = args if reference_args is None else reference_args 1787 self.reference_args = args if reference_args is None else reference_args
1758 self.tests = set() 1788 self.tests = set()
1759 1789
1760 def __repr__(self): 1790 def __repr__(self):
1761 return "PhysicalTestSuite('%s', '%s', %s, %s)" % (self.name, self.base, self.args, self.reference_args) 1791 return "PhysicalTestSuite('%s', '%s', %s, %s)" % (self.name, self.base, self.args, self.reference_args)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698