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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 self._options = options or optparse.Values() | 168 self._options = options or optparse.Values() |
169 | 169 |
170 self.host = host | 170 self.host = host |
171 self._executive = host.executive | 171 self._executive = host.executive |
172 self._filesystem = host.filesystem | 172 self._filesystem = host.filesystem |
173 self._webkit_finder = WebKitFinder(host.filesystem) | 173 self._webkit_finder = WebKitFinder(host.filesystem) |
174 | 174 |
175 self._helper = None | 175 self._helper = None |
176 self._http_server = None | 176 self._http_server = None |
177 self._websocket_server = None | 177 self._websocket_server = None |
178 self._is_wpt_enabled = hasattr(options, 'enable_wptserve') and options.e
nable_wptserve | 178 self._is_wptserve_enabled = getattr(options, 'enable_wptserve', False) |
179 self._wpt_server = None | 179 self._wpt_server = None |
180 self._image_differ = None | 180 self._image_differ = None |
181 self._server_process_constructor = server_process.ServerProcess # overr
idable for testing | 181 self._server_process_constructor = server_process.ServerProcess # overr
idable for testing |
182 self._http_lock = None # FIXME: Why does this live on the port object? | 182 self._http_lock = None # FIXME: Why does this live on the port object? |
183 self._dump_reader = None | 183 self._dump_reader = None |
184 | 184 |
185 # Python's Popen has a bug that causes any pipes opened to a | 185 # Python's Popen has a bug that causes any pipes opened to a |
186 # process that can't be executed to be leaked. Since this | 186 # process that can't be executed to be leaked. Since this |
187 # code is specifically designed to tolerate exec failures | 187 # code is specifically designed to tolerate exec failures |
188 # to gracefully handle cases where wdiff is not installed, | 188 # to gracefully handle cases where wdiff is not installed, |
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1158 def start_websocket_server(self): | 1158 def start_websocket_server(self): |
1159 """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. |
1160 | 1160 |
1161 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.""" |
1162 assert not self._websocket_server, 'Already running a websocket server.' | 1162 assert not self._websocket_server, 'Already running a websocket server.' |
1163 | 1163 |
1164 server = pywebsocket.PyWebSocket(self, self.results_directory()) | 1164 server = pywebsocket.PyWebSocket(self, self.results_directory()) |
1165 server.start() | 1165 server.start() |
1166 self._websocket_server = server | 1166 self._websocket_server = server |
1167 | 1167 |
1168 def is_wpt_enabled(self): | 1168 def is_wptserve_enabled(self): |
1169 """Used as feature flag for WPT Serve feature.""" | 1169 """Used as feature flag for WPT Serve feature.""" |
1170 return self._is_wpt_enabled | 1170 return self._is_wptserve_enabled |
1171 | 1171 |
1172 def is_wpt_test(self, test): | 1172 @staticmethod |
1173 """Whether this test is part of a web-platform-tests which require wptse
rve servers.""" | 1173 def is_wptserve_test(test): |
| 1174 """Whether wptserve should be used for a given test if enabled.""" |
1174 return test.startswith("imported/wpt/") | 1175 return test.startswith("imported/wpt/") |
1175 | 1176 |
| 1177 def should_use_wptserve(self, test): |
| 1178 return self.is_wptserve_enabled() and self.is_wptserve_test(test) |
| 1179 |
1176 def start_wptserve(self): | 1180 def start_wptserve(self): |
1177 """Start a WPT web server. Raise an error if it can't start or is alread
y running. | 1181 """Start a WPT web server. Raise an error if it can't start or is alread
y running. |
1178 | 1182 |
1179 Ports can stub this out if they don't need a WPT web server to be runnin
g.""" | 1183 Ports can stub this out if they don't need a WPT web server to be runnin
g.""" |
1180 assert not self._wpt_server, 'Already running an http server.' | 1184 assert not self._wpt_server, 'Already running an http server.' |
1181 assert self.is_wpt_enabled(), 'Cannot start server if WPT is not enabled
.' | 1185 assert self.is_wptserve_enabled(), 'Cannot start server if WPT is not en
abled.' |
1182 | 1186 |
1183 # We currently don't support any output mechanism for the WPT server. | 1187 # We currently don't support any output mechanism for the WPT server. |
1184 server = wptserve.WPTServe(self, self.results_directory()) | 1188 server = wptserve.WPTServe(self, self.results_directory()) |
1185 server.start() | 1189 server.start() |
1186 self._wpt_server = server | 1190 self._wpt_server = server |
1187 | 1191 |
1188 def stop_wptserve(self): | 1192 def stop_wptserve(self): |
1189 """Shut down the WPT server if it is running. Do nothing if it isn't.""" | 1193 """Shut down the WPT server if it is running. Do nothing if it isn't.""" |
1190 if self._wpt_server: | 1194 if self._wpt_server: |
1191 self._wpt_server.stop() | 1195 self._wpt_server.stop() |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1316 _log.warning("Unexpected ignore mode: '%s'." % ignore_mode) | 1320 _log.warning("Unexpected ignore mode: '%s'." % ignore_mode) |
1317 return {} | 1321 return {} |
1318 | 1322 |
1319 def expectations_files(self): | 1323 def expectations_files(self): |
1320 paths = [ | 1324 paths = [ |
1321 self.path_to_generic_test_expectations_file(), | 1325 self.path_to_generic_test_expectations_file(), |
1322 self._filesystem.join(self.layout_tests_dir(), 'NeverFixTests'), | 1326 self._filesystem.join(self.layout_tests_dir(), 'NeverFixTests'), |
1323 self._filesystem.join(self.layout_tests_dir(), 'StaleTestExpectation
s'), | 1327 self._filesystem.join(self.layout_tests_dir(), 'StaleTestExpectation
s'), |
1324 self._filesystem.join(self.layout_tests_dir(), 'SlowTests'), | 1328 self._filesystem.join(self.layout_tests_dir(), 'SlowTests'), |
1325 ] | 1329 ] |
1326 if self._is_wpt_enabled: | 1330 if self.is_wptserve_enabled(): |
1327 paths.append(self._filesystem.join(self.layout_tests_dir(), 'WPTServ
eExpectations')) | 1331 paths.append(self._filesystem.join(self.layout_tests_dir(), 'WPTServ
eExpectations')) |
1328 paths.extend(self._flag_specific_expectations_files()) | 1332 paths.extend(self._flag_specific_expectations_files()) |
1329 return paths | 1333 return paths |
1330 | 1334 |
1331 def repository_path(self): | 1335 def repository_path(self): |
1332 """Returns the repository path for the chromium code base.""" | 1336 """Returns the repository path for the chromium code base.""" |
1333 return self.path_from_chromium_base('build') | 1337 return self.path_from_chromium_base('build') |
1334 | 1338 |
1335 _WDIFF_DEL = '##WDIFF_DEL##' | 1339 _WDIFF_DEL = '##WDIFF_DEL##' |
1336 _WDIFF_ADD = '##WDIFF_ADD##' | 1340 _WDIFF_ADD = '##WDIFF_ADD##' |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1650 if test_name.startswith(suite.name): | 1654 if test_name.startswith(suite.name): |
1651 return suite.reference_args | 1655 return suite.reference_args |
1652 return [] | 1656 return [] |
1653 | 1657 |
1654 def should_run_as_pixel_test(self, test_input): | 1658 def should_run_as_pixel_test(self, test_input): |
1655 if not self._options.pixel_tests: | 1659 if not self._options.pixel_tests: |
1656 return False | 1660 return False |
1657 if self._options.pixel_test_directories: | 1661 if self._options.pixel_test_directories: |
1658 return any(test_input.test_name.startswith(directory) for directory
in self._options.pixel_test_directories) | 1662 return any(test_input.test_name.startswith(directory) for directory
in self._options.pixel_test_directories) |
1659 # TODO(burnik): Make sure this is the right way to do it. | 1663 # TODO(burnik): Make sure this is the right way to do it. |
1660 if self.is_wpt_enabled() and self.is_wpt_test(test_input.test_name): | 1664 if self.should_use_wptserve(test_input.test_name): |
1661 return False | 1665 return False |
1662 return True | 1666 return True |
1663 | 1667 |
1664 def _modules_to_search_for_symbols(self): | 1668 def _modules_to_search_for_symbols(self): |
1665 path = self._path_to_webcore_library() | 1669 path = self._path_to_webcore_library() |
1666 if path: | 1670 if path: |
1667 return [path] | 1671 return [path] |
1668 return [] | 1672 return [] |
1669 | 1673 |
1670 def _symbols_string(self): | 1674 def _symbols_string(self): |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1784 | 1788 |
1785 def __init__(self, base, args, reference_args=None): | 1789 def __init__(self, base, args, reference_args=None): |
1786 self.name = base | 1790 self.name = base |
1787 self.base = base | 1791 self.base = base |
1788 self.args = args | 1792 self.args = args |
1789 self.reference_args = args if reference_args is None else reference_args | 1793 self.reference_args = args if reference_args is None else reference_args |
1790 self.tests = set() | 1794 self.tests = set() |
1791 | 1795 |
1792 def __repr__(self): | 1796 def __repr__(self): |
1793 return "PhysicalTestSuite('%s', '%s', %s, %s)" % (self.name, self.base,
self.args, self.reference_args) | 1797 return "PhysicalTestSuite('%s', '%s', %s, %s)" % (self.name, self.base,
self.args, self.reference_args) |
OLD | NEW |