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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 # options defined on it. | 181 # options defined on it. |
182 self._options = options or optparse.Values() | 182 self._options = options or optparse.Values() |
183 | 183 |
184 self.host = host | 184 self.host = host |
185 self._executive = host.executive | 185 self._executive = host.executive |
186 self._filesystem = host.filesystem | 186 self._filesystem = host.filesystem |
187 self._webkit_finder = WebKitFinder(host.filesystem) | 187 self._webkit_finder = WebKitFinder(host.filesystem) |
188 self._config = port_config.Config(self._executive, self._filesystem, sel
f.port_name) | 188 self._config = port_config.Config(self._executive, self._filesystem, sel
f.port_name) |
189 | 189 |
190 self._helper = None | 190 self._helper = None |
191 self._http_server = None | 191 self._sky_server = None |
192 self._websocket_server = None | 192 self._websocket_server = None |
193 self._image_differ = None | 193 self._image_differ = None |
194 self._server_process_constructor = server_process.ServerProcess # overr
idable for testing | 194 self._server_process_constructor = server_process.ServerProcess # overr
idable for testing |
195 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? |
196 self._dump_reader = None | 196 self._dump_reader = None |
197 | 197 |
198 # 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 |
199 # process that can't be executed to be leaked. Since this | 199 # process that can't be executed to be leaked. Since this |
200 # code is specifically designed to tolerate exec failures | 200 # code is specifically designed to tolerate exec failures |
201 # to gracefully handle cases where wdiff is not installed, | 201 # to gracefully handle cases where wdiff is not installed, |
(...skipping 20 matching lines...) Expand all Loading... |
222 | 222 |
223 def buildbot_archives_baselines(self): | 223 def buildbot_archives_baselines(self): |
224 return True | 224 return True |
225 | 225 |
226 def additional_drt_flag(self): | 226 def additional_drt_flag(self): |
227 driver_name = self.driver_name() | 227 driver_name = self.driver_name() |
228 if driver_name == self.CONTENT_SHELL_NAME: | 228 if driver_name == self.CONTENT_SHELL_NAME: |
229 return ['--dump-render-tree'] | 229 return ['--dump-render-tree'] |
230 if driver_name == self.MOJO_SHELL_NAME: | 230 if driver_name == self.MOJO_SHELL_NAME: |
231 return [ | 231 return [ |
| 232 # TODO(ianh): Remove text/sky once we remove .sky files |
232 '--args-for=mojo:native_viewport_service --use-headless-config -
-use-osmesa', | 233 '--args-for=mojo:native_viewport_service --use-headless-config -
-use-osmesa', |
233 '--args-for=mojo:sky_viewer --testing', | 234 '--args-for=mojo:sky_viewer --testing', |
234 '--content-handlers=text/sky,mojo:sky_viewer,text/plain,mojo:sky
_viewer', | 235 '--content-handlers=text/sky,mojo:sky_viewer,application/dart,mo
jo:sky_viewer', |
235 '--url-mappings=mojo:window_manager=mojo:sky_tester,mojo:surface
s_service=mojo:fake_surfaces_service', | 236 '--url-mappings=mojo:window_manager=mojo:sky_tester,mojo:surface
s_service=mojo:fake_surfaces_service', |
236 'mojo:window_manager', | 237 'mojo:window_manager', |
237 ] | 238 ] |
238 return [] | 239 return [] |
239 | 240 |
240 def supports_per_test_timeout(self): | 241 def supports_per_test_timeout(self): |
241 return False | 242 return False |
242 | 243 |
243 def default_pixel_tests(self): | 244 def default_pixel_tests(self): |
244 return False | 245 return False |
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1077 helper_path = self._path_to_helper() | 1078 helper_path = self._path_to_helper() |
1078 if helper_path: | 1079 if helper_path: |
1079 _log.debug("Starting layout helper %s" % helper_path) | 1080 _log.debug("Starting layout helper %s" % helper_path) |
1080 # Note: Not thread safe: http://bugs.python.org/issue2320 | 1081 # Note: Not thread safe: http://bugs.python.org/issue2320 |
1081 self._helper = self._executive.popen([helper_path], | 1082 self._helper = self._executive.popen([helper_path], |
1082 stdin=self._executive.PIPE, stdout=self._executive.PIPE, stderr=
None) | 1083 stdin=self._executive.PIPE, stdout=self._executive.PIPE, stderr=
None) |
1083 is_ready = self._helper.stdout.readline() | 1084 is_ready = self._helper.stdout.readline() |
1084 if not is_ready.startswith('ready'): | 1085 if not is_ready.startswith('ready'): |
1085 _log.error("layout_test_helper failed to be ready") | 1086 _log.error("layout_test_helper failed to be ready") |
1086 | 1087 |
1087 def requires_http_server(self): | 1088 def requires_sky_server(self): |
1088 """Does the port require an HTTP server for running tests? This could | 1089 """Does the port require an HTTP server for running tests? This could |
1089 be the case when the tests aren't run on the host platform.""" | 1090 be the case when the tests aren't run on the host platform.""" |
1090 return True | 1091 return True |
1091 | 1092 |
1092 def _dart_packages_root(self): | 1093 def _dart_packages_root(self): |
1093 return self._build_path('gen/dart-pkg/packages') | 1094 return self._build_path('gen/dart-pkg/packages') |
1094 | 1095 |
1095 def server_command_line(self): | 1096 def start_sky_server(self, additional_dirs, number_of_drivers): |
1096 # TODO(eseidel): Shouldn't this just use skyserver.py? | |
1097 path = (self._options.path_to_server or SkyServer.sky_server_path()) | |
1098 return [ | |
1099 path, | |
1100 '-t', self.get_option('configuration'), | |
1101 self.path_from_chromium_base(), | |
1102 '8000', | |
1103 self._dart_packages_root() | |
1104 ] | |
1105 | |
1106 def start_http_server(self, additional_dirs, number_of_drivers): | |
1107 """Start a web server. Raise an error if it can't start or is already ru
nning. | 1097 """Start a web server. Raise an error if it can't start or is already ru
nning. |
1108 | 1098 |
1109 Ports can stub this out if they don't need a web server to be running.""
" | 1099 Ports can stub this out if they don't need a web server to be running.""
" |
1110 assert not self._http_server, 'Already running an http server.' | 1100 assert not self._sky_server, 'Already running an http server.' |
1111 self._http_server = subprocess.Popen(self.server_command_line()) | 1101 self._sky_server = SkyServer(8000, self.path_from_chromium_base(), self.
_dart_packages_root()) |
| 1102 self._sky_server.start() |
1112 | 1103 |
1113 def start_websocket_server(self): | 1104 def start_websocket_server(self): |
1114 """Start a web server. Raise an error if it can't start or is already ru
nning. | 1105 """Start a web server. Raise an error if it can't start or is already ru
nning. |
1115 | 1106 |
1116 Ports can stub this out if they don't need a websocket server to be runn
ing.""" | 1107 Ports can stub this out if they don't need a websocket server to be runn
ing.""" |
1117 assert not self._websocket_server, 'Already running a websocket server.' | 1108 assert not self._websocket_server, 'Already running a websocket server.' |
1118 | 1109 |
1119 server = pywebsocket.PyWebSocket(self, self.results_directory()) | 1110 server = pywebsocket.PyWebSocket(self, self.results_directory()) |
1120 server.start() | 1111 server.start() |
1121 self._websocket_server = server | 1112 self._websocket_server = server |
(...skipping 12 matching lines...) Expand all Loading... |
1134 _log.debug("Stopping layout test helper") | 1125 _log.debug("Stopping layout test helper") |
1135 try: | 1126 try: |
1136 self._helper.stdin.write("x\n") | 1127 self._helper.stdin.write("x\n") |
1137 self._helper.stdin.close() | 1128 self._helper.stdin.close() |
1138 self._helper.wait() | 1129 self._helper.wait() |
1139 except IOError, e: | 1130 except IOError, e: |
1140 pass | 1131 pass |
1141 finally: | 1132 finally: |
1142 self._helper = None | 1133 self._helper = None |
1143 | 1134 |
1144 def stop_http_server(self): | 1135 def stop_sky_server(self): |
1145 """Shut down the http server if it is running. Do nothing if it isn't.""
" | 1136 """Shut down the Http server if it is running. Do nothing if it isn't.""
" |
1146 if self._http_server: | 1137 if self._sky_server: |
1147 self._http_server.terminate() | 1138 self._sky_server.stop() |
1148 self._http_server = None | 1139 self._sky_server = None |
1149 | 1140 |
1150 def stop_websocket_server(self): | 1141 def stop_websocket_server(self): |
1151 """Shut down the websocket server if it is running. Do nothing if it isn
't.""" | 1142 """Shut down the websocket server if it is running. Do nothing if it isn
't.""" |
1152 if self._websocket_server: | 1143 if self._websocket_server: |
1153 self._websocket_server.stop() | 1144 self._websocket_server.stop() |
1154 self._websocket_server = None | 1145 self._websocket_server = None |
1155 | 1146 |
1156 # | 1147 # |
1157 # TEST EXPECTATION-RELATED METHODS | 1148 # TEST EXPECTATION-RELATED METHODS |
1158 # | 1149 # |
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1776 | 1767 |
1777 class PhysicalTestSuite(object): | 1768 class PhysicalTestSuite(object): |
1778 def __init__(self, base, args): | 1769 def __init__(self, base, args): |
1779 self.name = base | 1770 self.name = base |
1780 self.base = base | 1771 self.base = base |
1781 self.args = args | 1772 self.args = args |
1782 self.tests = set() | 1773 self.tests = set() |
1783 | 1774 |
1784 def __repr__(self): | 1775 def __repr__(self): |
1785 return "PhysicalTestSuite('%s', '%s', %s)" % (self.name, self.base, self
.args) | 1776 return "PhysicalTestSuite('%s', '%s', %s)" % (self.name, self.base, self
.args) |
OLD | NEW |