OLD | NEW |
---|---|
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 Loading... | |
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_http | |
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 Loading... | |
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 Loading... | |
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 set_is_wpt_enabled(self, is_wpt_enabled): | |
1170 self._is_wpt_enabled = is_wpt_enabled | |
Dirk Pranke
2015/06/05 18:27:48
It doesn't seem like you need this, since it is se
burnik
2015/06/08 12:37:01
That's right. I wasn't sure if I would be able to
| |
1171 | |
1172 def is_wpt_enabled(self): | |
1173 """Used as feature flag for WPT Serve feature.""" | |
1174 return self._is_wpt_enabled | |
1175 | |
1176 def is_wpt_test(self, test): | |
1177 """Whether this test is part of a web-platform-tests which require wptse rve servers.""" | |
1178 return "web-platform-tests" in test | |
1179 | |
1180 def start_wptserve(self): | |
1181 """Start a WPT web server. Raise an error if it can't start or is alread y running. | |
1182 | |
1183 Ports can stub this out if they don't need a WPT web server to be runnin g.""" | |
1184 assert not self._wpt_server, 'Already running an http server.' | |
1185 assert self.is_wpt_enabled(), 'Cannot start server if WPT is not enabled .' | |
1186 | |
1187 # We currently don't support any output mechanism for the WPT server. | |
1188 server = wptserve_http.WPTServeHTTP(self, self.results_directory()) | |
1189 server.start() | |
1190 self._wpt_server = server | |
1191 | |
1192 def stop_wptserve(self): | |
1193 """Shut down the WPT server if it is running. Do nothing if it isn't.""" | |
1194 if self._wpt_server: | |
1195 self._wpt_server.stop() | |
1196 self._wpt_server = None | |
1197 | |
1166 def http_server_supports_ipv6(self): | 1198 def http_server_supports_ipv6(self): |
1167 # Apache < 2.4 on win32 does not support IPv6, nor does cygwin apache. | 1199 # 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(): | 1200 if self.host.platform.is_cygwin() or self.host.platform.is_win(): |
1169 return False | 1201 return False |
1170 return True | 1202 return True |
1171 | 1203 |
1172 def stop_helper(self): | 1204 def stop_helper(self): |
1173 """Shut down the test helper if it is running. Do nothing if | 1205 """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() | 1206 it isn't, or it isn't available. If a port overrides start_helper() |
1175 it must override this routine as well.""" | 1207 it must override this routine as well.""" |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1629 for suite in self.physical_test_suites(): | 1661 for suite in self.physical_test_suites(): |
1630 if test_name.startswith(suite.name): | 1662 if test_name.startswith(suite.name): |
1631 return suite.reference_args | 1663 return suite.reference_args |
1632 return [] | 1664 return [] |
1633 | 1665 |
1634 def should_run_as_pixel_test(self, test_input): | 1666 def should_run_as_pixel_test(self, test_input): |
1635 if not self._options.pixel_tests: | 1667 if not self._options.pixel_tests: |
1636 return False | 1668 return False |
1637 if self._options.pixel_test_directories: | 1669 if self._options.pixel_test_directories: |
1638 return any(test_input.test_name.startswith(directory) for directory in self._options.pixel_test_directories) | 1670 return any(test_input.test_name.startswith(directory) for directory in self._options.pixel_test_directories) |
1671 # TODO(burnik): Make sure this is the right way to do it. | |
1672 if self.is_wpt_enabled() and self.is_wpt_test(test_input.test_name): | |
1673 return False | |
1639 return True | 1674 return True |
1640 | 1675 |
1641 def _modules_to_search_for_symbols(self): | 1676 def _modules_to_search_for_symbols(self): |
1642 path = self._path_to_webcore_library() | 1677 path = self._path_to_webcore_library() |
1643 if path: | 1678 if path: |
1644 return [path] | 1679 return [path] |
1645 return [] | 1680 return [] |
1646 | 1681 |
1647 def _symbols_string(self): | 1682 def _symbols_string(self): |
1648 symbols = '' | 1683 symbols = '' |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1752 class PhysicalTestSuite(object): | 1787 class PhysicalTestSuite(object): |
1753 def __init__(self, base, args, reference_args=None): | 1788 def __init__(self, base, args, reference_args=None): |
1754 self.name = base | 1789 self.name = base |
1755 self.base = base | 1790 self.base = base |
1756 self.args = args | 1791 self.args = args |
1757 self.reference_args = args if reference_args is None else reference_args | 1792 self.reference_args = args if reference_args is None else reference_args |
1758 self.tests = set() | 1793 self.tests = set() |
1759 | 1794 |
1760 def __repr__(self): | 1795 def __repr__(self): |
1761 return "PhysicalTestSuite('%s', '%s', %s, %s)" % (self.name, self.base, self.args, self.reference_args) | 1796 return "PhysicalTestSuite('%s', '%s', %s, %s)" % (self.name, self.base, self.args, self.reference_args) |
OLD | NEW |