OLD | NEW |
1 # Copyright (C) 2011 Google Inc. All rights reserved. | 1 # Copyright (C) 2011 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 self.measurements = measurements | 72 self.measurements = measurements |
73 self.timeout = timeout | 73 self.timeout = timeout |
74 self.error = error # stderr output | 74 self.error = error # stderr output |
75 self.pid = pid | 75 self.pid = pid |
76 | 76 |
77 def has_stderr(self): | 77 def has_stderr(self): |
78 return bool(self.error) | 78 return bool(self.error) |
79 | 79 |
80 | 80 |
81 class Driver(object): | 81 class Driver(object): |
82 """object for running test(s) using DumpRenderTree/WebKitTestRunner.""" | 82 """object for running test(s) using content_shell or other driver.""" |
83 | 83 |
84 def __init__(self, port, worker_number, pixel_tests, no_timeout=False): | 84 def __init__(self, port, worker_number, pixel_tests, no_timeout=False): |
85 """Initialize a Driver to subsequently run tests. | 85 """Initialize a Driver to subsequently run tests. |
86 | 86 |
87 Typically this routine will spawn DumpRenderTree in a config | 87 Typically this routine will spawn content_shell in a config |
88 ready for subsequent input. | 88 ready for subsequent input. |
89 | 89 |
90 port - reference back to the port object. | 90 port - reference back to the port object. |
91 worker_number - identifier for a particular worker/driver instance | 91 worker_number - identifier for a particular worker/driver instance |
92 """ | 92 """ |
93 self._port = port | 93 self._port = port |
94 self._worker_number = worker_number | 94 self._worker_number = worker_number |
95 self._no_timeout = no_timeout | 95 self._no_timeout = no_timeout |
96 | 96 |
97 self._driver_tempdir = None | 97 self._driver_tempdir = None |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 | 251 |
252 def start(self, pixel_tests, per_test_args): | 252 def start(self, pixel_tests, per_test_args): |
253 new_cmd_line = self.cmd_line(pixel_tests, per_test_args) | 253 new_cmd_line = self.cmd_line(pixel_tests, per_test_args) |
254 if not self._server_process or new_cmd_line != self._current_cmd_line: | 254 if not self._server_process or new_cmd_line != self._current_cmd_line: |
255 self._start(pixel_tests, per_test_args) | 255 self._start(pixel_tests, per_test_args) |
256 self._run_post_start_tasks() | 256 self._run_post_start_tasks() |
257 | 257 |
258 def _setup_environ_for_driver(self, environment): | 258 def _setup_environ_for_driver(self, environment): |
259 environment['DYLD_LIBRARY_PATH'] = self._port._build_path() | 259 environment['DYLD_LIBRARY_PATH'] = self._port._build_path() |
260 environment['DYLD_FRAMEWORK_PATH'] = self._port._build_path() | 260 environment['DYLD_FRAMEWORK_PATH'] = self._port._build_path() |
261 # FIXME: We're assuming that WebKitTestRunner checks this DumpRenderTree
-named environment variable. | |
262 environment['DUMPRENDERTREE_TEMP'] = str(self._driver_tempdir) | |
263 environment['LOCAL_RESOURCE_ROOT'] = self._port.layout_tests_dir() | 261 environment['LOCAL_RESOURCE_ROOT'] = self._port.layout_tests_dir() |
264 if 'WEBKITOUTPUTDIR' in os.environ: | 262 if 'WEBKITOUTPUTDIR' in os.environ: |
265 environment['WEBKITOUTPUTDIR'] = os.environ['WEBKITOUTPUTDIR'] | 263 environment['WEBKITOUTPUTDIR'] = os.environ['WEBKITOUTPUTDIR'] |
266 if self._profiler: | 264 if self._profiler: |
267 environment = self._profiler.adjusted_environment(environment) | 265 environment = self._profiler.adjusted_environment(environment) |
268 return environment | 266 return environment |
269 | 267 |
270 def _start(self, pixel_tests, per_test_args): | 268 def _start(self, pixel_tests, per_test_args): |
271 self.stop() | 269 self.stop() |
272 self._driver_tempdir = self._port._filesystem.mkdtemp(prefix='%s-' % sel
f._port.driver_name()) | 270 self._driver_tempdir = self._port._filesystem.mkdtemp(prefix='%s-' % sel
f._port.driver_name()) |
(...skipping 27 matching lines...) Expand all Loading... |
300 self._port._filesystem.rmtree(str(self._driver_tempdir)) | 298 self._port._filesystem.rmtree(str(self._driver_tempdir)) |
301 self._driver_tempdir = None | 299 self._driver_tempdir = None |
302 | 300 |
303 self._current_cmd_line = None | 301 self._current_cmd_line = None |
304 | 302 |
305 def cmd_line(self, pixel_tests, per_test_args): | 303 def cmd_line(self, pixel_tests, per_test_args): |
306 cmd = self._command_wrapper(self._port.get_option('wrapper')) | 304 cmd = self._command_wrapper(self._port.get_option('wrapper')) |
307 cmd.append(self._port._path_to_driver()) | 305 cmd.append(self._port._path_to_driver()) |
308 if self._no_timeout: | 306 if self._no_timeout: |
309 cmd.append('--no-timeout') | 307 cmd.append('--no-timeout') |
310 # FIXME: We need to pass --timeout=SECONDS to WebKitTestRunner for WebKi
t2. | |
311 | |
312 cmd.extend(self._port.get_option('additional_drt_flag', [])) | 308 cmd.extend(self._port.get_option('additional_drt_flag', [])) |
313 cmd.extend(self._port.additional_drt_flag()) | 309 cmd.extend(self._port.additional_drt_flag()) |
314 | |
315 cmd.extend(per_test_args) | 310 cmd.extend(per_test_args) |
316 | |
317 cmd.append('-') | 311 cmd.append('-') |
318 return cmd | 312 return cmd |
319 | 313 |
320 def _check_for_driver_crash(self, error_line): | 314 def _check_for_driver_crash(self, error_line): |
321 if error_line == "#CRASHED\n": | 315 if error_line == "#CRASHED\n": |
322 # This is used on Windows to report that the process has crashed | 316 # This is used on Windows to report that the process has crashed |
323 # See http://trac.webkit.org/changeset/65537. | 317 # See http://trac.webkit.org/changeset/65537. |
324 self._crashed_process_name = self._server_process.name() | 318 self._crashed_process_name = self._server_process.name() |
325 self._crashed_pid = self._server_process.pid() | 319 self._crashed_pid = self._server_process.pid() |
326 elif (error_line.startswith("#CRASHED - ") | 320 elif (error_line.startswith("#CRASHED - ") |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 self.content = str() # FIXME: Should be bytearray() once we require Pyt
hon 2.6. | 461 self.content = str() # FIXME: Should be bytearray() once we require Pyt
hon 2.6. |
468 self.decoded_content = None | 462 self.decoded_content = None |
469 self.malloc = None | 463 self.malloc = None |
470 self.js_heap = None | 464 self.js_heap = None |
471 | 465 |
472 def decode_content(self): | 466 def decode_content(self): |
473 if self.encoding == 'base64' and self.content is not None: | 467 if self.encoding == 'base64' and self.content is not None: |
474 self.decoded_content = base64.b64decode(self.content) | 468 self.decoded_content = base64.b64decode(self.content) |
475 else: | 469 else: |
476 self.decoded_content = self.content | 470 self.decoded_content = self.content |
OLD | NEW |