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

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 additional README for maintenance. 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 102 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._is_wpt_enabled = hasattr(options, 'enable_wptserve') and options.e nable_wptserve
192 self._wpt_server = None
190 self._image_differ = None 193 self._image_differ = None
191 self._server_process_constructor = server_process.ServerProcess # overr idable for testing 194 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? 195 self._http_lock = None # FIXME: Why does this live on the port object?
193 self._dump_reader = None 196 self._dump_reader = None
194 197
195 # Python's Popen has a bug that causes any pipes opened to a 198 # 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 199 # process that can't be executed to be leaked. Since this
197 # code is specifically designed to tolerate exec failures 200 # code is specifically designed to tolerate exec failures
198 # to gracefully handle cases where wdiff is not installed, 201 # to gracefully handle cases where wdiff is not installed,
199 # the bug results in a massive file descriptor leak. As a 202 # 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): 1159 def start_websocket_server(self):
1157 """Start a web server. Raise an error if it can't start or is already ru nning. 1160 """Start a web server. Raise an error if it can't start or is already ru nning.
1158 1161
1159 Ports can stub this out if they don't need a websocket server to be runn ing.""" 1162 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.' 1163 assert not self._websocket_server, 'Already running a websocket server.'
1161 1164
1162 server = pywebsocket.PyWebSocket(self, self.results_directory()) 1165 server = pywebsocket.PyWebSocket(self, self.results_directory())
1163 server.start() 1166 server.start()
1164 self._websocket_server = server 1167 self._websocket_server = server
1165 1168
1169 def is_wpt_enabled(self):
1170 """Used as feature flag for WPT Serve feature."""
1171 return self._is_wpt_enabled
1172
1173 def is_wpt_test(self, test):
1174 """Whether this test is part of a web-platform-tests which require wptse rve servers."""
1175 return "web-platform-tests" in test
1176
1177 def start_wptserve(self):
1178 """Start a WPT web server. Raise an error if it can't start or is alread y running.
1179
1180 Ports can stub this out if they don't need a WPT web server to be runnin g."""
1181 assert not self._wpt_server, 'Already running an http server.'
1182 assert self.is_wpt_enabled(), 'Cannot start server if WPT is not enabled .'
1183
1184 # We currently don't support any output mechanism for the WPT server.
1185 server = wptserve.WPTServe(self, self.results_directory())
1186 server.start()
1187 self._wpt_server = server
1188
1189 def stop_wptserve(self):
1190 """Shut down the WPT server if it is running. Do nothing if it isn't."""
1191 if self._wpt_server:
1192 self._wpt_server.stop()
1193 self._wpt_server = None
1194
1166 def http_server_supports_ipv6(self): 1195 def http_server_supports_ipv6(self):
1167 # Apache < 2.4 on win32 does not support IPv6, nor does cygwin apache. 1196 # 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(): 1197 if self.host.platform.is_cygwin() or self.host.platform.is_win():
1169 return False 1198 return False
1170 return True 1199 return True
1171 1200
1172 def stop_helper(self): 1201 def stop_helper(self):
1173 """Shut down the test helper if it is running. Do nothing if 1202 """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() 1203 it isn't, or it isn't available. If a port overrides start_helper()
1175 it must override this routine as well.""" 1204 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(): 1658 for suite in self.physical_test_suites():
1630 if test_name.startswith(suite.name): 1659 if test_name.startswith(suite.name):
1631 return suite.reference_args 1660 return suite.reference_args
1632 return [] 1661 return []
1633 1662
1634 def should_run_as_pixel_test(self, test_input): 1663 def should_run_as_pixel_test(self, test_input):
1635 if not self._options.pixel_tests: 1664 if not self._options.pixel_tests:
1636 return False 1665 return False
1637 if self._options.pixel_test_directories: 1666 if self._options.pixel_test_directories:
1638 return any(test_input.test_name.startswith(directory) for directory in self._options.pixel_test_directories) 1667 return any(test_input.test_name.startswith(directory) for directory in self._options.pixel_test_directories)
1668 # TODO(burnik): Make sure this is the right way to do it.
1669 if self.is_wpt_enabled() and self.is_wpt_test(test_input.test_name):
1670 return False
1639 return True 1671 return True
1640 1672
1641 def _modules_to_search_for_symbols(self): 1673 def _modules_to_search_for_symbols(self):
1642 path = self._path_to_webcore_library() 1674 path = self._path_to_webcore_library()
1643 if path: 1675 if path:
1644 return [path] 1676 return [path]
1645 return [] 1677 return []
1646 1678
1647 def _symbols_string(self): 1679 def _symbols_string(self):
1648 symbols = '' 1680 symbols = ''
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1752 class PhysicalTestSuite(object): 1784 class PhysicalTestSuite(object):
1753 def __init__(self, base, args, reference_args=None): 1785 def __init__(self, base, args, reference_args=None):
1754 self.name = base 1786 self.name = base
1755 self.base = base 1787 self.base = base
1756 self.args = args 1788 self.args = args
1757 self.reference_args = args if reference_args is None else reference_args 1789 self.reference_args = args if reference_args is None else reference_args
1758 self.tests = set() 1790 self.tests = set()
1759 1791
1760 def __repr__(self): 1792 def __repr__(self):
1761 return "PhysicalTestSuite('%s', '%s', %s, %s)" % (self.name, self.base, self.args, self.reference_args) 1793 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