| 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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 _log.error("content_shell took too long to startup.") | 327 _log.error("content_shell took too long to startup.") |
| 328 | 328 |
| 329 def _wait_for_server_process_output(self, server_process, deadline, text): | 329 def _wait_for_server_process_output(self, server_process, deadline, text): |
| 330 output = '' | 330 output = '' |
| 331 line = server_process.read_stdout_line(deadline) | 331 line = server_process.read_stdout_line(deadline) |
| 332 while not server_process.timed_out and not server_process.has_crashed()
and not text in line.rstrip(): | 332 while not server_process.timed_out and not server_process.has_crashed()
and not text in line.rstrip(): |
| 333 output += line | 333 output += line |
| 334 line = server_process.read_stdout_line(deadline) | 334 line = server_process.read_stdout_line(deadline) |
| 335 | 335 |
| 336 if server_process.timed_out or server_process.has_crashed(): | 336 if server_process.timed_out or server_process.has_crashed(): |
| 337 _log.error('Failed to start the %s process: \n%s' % (server_process.
name(), output)) | 337 _log.error('Failed to start the %s process: \n%s', server_process.na
me(), output) |
| 338 return False | 338 return False |
| 339 | 339 |
| 340 return True | 340 return True |
| 341 | 341 |
| 342 def _run_post_start_tasks(self): | 342 def _run_post_start_tasks(self): |
| 343 # Remote drivers may override this to delay post-start tasks until the s
erver has ack'd. | 343 # Remote drivers may override this to delay post-start tasks until the s
erver has ack'd. |
| 344 if self._profiler: | 344 if self._profiler: |
| 345 self._profiler.attach_to_pid(self._pid_on_target()) | 345 self._profiler.attach_to_pid(self._pid_on_target()) |
| 346 | 346 |
| 347 def _pid_on_target(self): | 347 def _pid_on_target(self): |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 self._crashed_pid = self._server_process.pid() | 382 self._crashed_pid = self._server_process.pid() |
| 383 elif (error_line.startswith("#CRASHED - ") | 383 elif (error_line.startswith("#CRASHED - ") |
| 384 or error_line.startswith("#PROCESS UNRESPONSIVE - ")): | 384 or error_line.startswith("#PROCESS UNRESPONSIVE - ")): |
| 385 # WebKitTestRunner uses this to report that the WebProcess subproces
s crashed. | 385 # WebKitTestRunner uses this to report that the WebProcess subproces
s crashed. |
| 386 match = re.match('#(?:CRASHED|PROCESS UNRESPONSIVE) - (\S+)', error_
line) | 386 match = re.match('#(?:CRASHED|PROCESS UNRESPONSIVE) - (\S+)', error_
line) |
| 387 self._crashed_process_name = match.group(1) if match else 'WebProces
s' | 387 self._crashed_process_name = match.group(1) if match else 'WebProces
s' |
| 388 match = re.search('pid (\d+)', error_line) | 388 match = re.search('pid (\d+)', error_line) |
| 389 pid = int(match.group(1)) if match else None | 389 pid = int(match.group(1)) if match else None |
| 390 self._crashed_pid = pid | 390 self._crashed_pid = pid |
| 391 # FIXME: delete this after we're sure this code is working :) | 391 # FIXME: delete this after we're sure this code is working :) |
| 392 _log.debug('%s crash, pid = %s, error_line = %s' % (self._crashed_pr
ocess_name, str(pid), error_line)) | 392 _log.debug('%s crash, pid = %s, error_line = %s', self._crashed_proc
ess_name, str(pid), error_line) |
| 393 if error_line.startswith("#PROCESS UNRESPONSIVE - "): | 393 if error_line.startswith("#PROCESS UNRESPONSIVE - "): |
| 394 self._subprocess_was_unresponsive = True | 394 self._subprocess_was_unresponsive = True |
| 395 self._port.sample_process(self._crashed_process_name, self._cras
hed_pid) | 395 self._port.sample_process(self._crashed_process_name, self._cras
hed_pid) |
| 396 # We want to show this since it's not a regular crash and probab
ly we don't have a crash log. | 396 # We want to show this since it's not a regular crash and probab
ly we don't have a crash log. |
| 397 self.error_from_test += error_line | 397 self.error_from_test += error_line |
| 398 return True | 398 return True |
| 399 return self.has_crashed() | 399 return self.has_crashed() |
| 400 | 400 |
| 401 def _check_for_leak(self, error_line): | 401 def _check_for_leak(self, error_line): |
| 402 if error_line.startswith("#LEAK - "): | 402 if error_line.startswith("#LEAK - "): |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 self.decoded_content = None | 541 self.decoded_content = None |
| 542 self.malloc = None | 542 self.malloc = None |
| 543 self.js_heap = None | 543 self.js_heap = None |
| 544 self.stdin_path = None | 544 self.stdin_path = None |
| 545 | 545 |
| 546 def decode_content(self): | 546 def decode_content(self): |
| 547 if self.encoding == 'base64' and self.content is not None: | 547 if self.encoding == 'base64' and self.content is not None: |
| 548 self.decoded_content = base64.b64decode(self.content) | 548 self.decoded_content = base64.b64decode(self.content) |
| 549 else: | 549 else: |
| 550 self.decoded_content = self.content | 550 self.decoded_content = self.content |
| OLD | NEW |