| 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 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 if line and line.endswith("#EOF\r\n"): | 444 if line and line.endswith("#EOF\r\n"): |
| 445 _log.error("Got a CRLF-terminated #EOF - this is a driver bug.") | 445 _log.error("Got a CRLF-terminated #EOF - this is a driver bug.") |
| 446 return line[:-6], True | 446 return line[:-6], True |
| 447 return line, False | 447 return line, False |
| 448 | 448 |
| 449 def _read_block(self, deadline, is_first_block=False, wait_for_stderr_eof=Fa
lse): | 449 def _read_block(self, deadline, is_first_block=False, wait_for_stderr_eof=Fa
lse): |
| 450 block = ContentBlock() | 450 block = ContentBlock() |
| 451 out_seen_eof = False | 451 out_seen_eof = False |
| 452 | 452 |
| 453 have_seen_begin = not is_first_block | 453 have_seen_begin = not is_first_block |
| 454 have_printed_stdout_limbo_line = False |
| 455 have_printed_stderr_limbo_line = False |
| 454 | 456 |
| 455 while not self.has_crashed(): | 457 while not self.has_crashed(): |
| 456 if out_seen_eof and (self.err_seen_eof or not wait_for_stderr_eof): | 458 if out_seen_eof and (self.err_seen_eof or not wait_for_stderr_eof): |
| 457 break | 459 break |
| 458 | 460 |
| 459 if self.err_seen_eof: | 461 if self.err_seen_eof: |
| 460 out_line = self._server_process.read_stdout_line(deadline) | 462 out_line = self._server_process.read_stdout_line(deadline) |
| 461 err_line = None | 463 err_line = None |
| 462 elif out_seen_eof: | 464 elif out_seen_eof: |
| 463 out_line = None | 465 out_line = None |
| 464 err_line = self._server_process.read_stderr_line(deadline) | 466 err_line = self._server_process.read_stderr_line(deadline) |
| 465 else: | 467 else: |
| 466 out_line, err_line = self._server_process.read_either_stdout_or_
stderr_line(deadline) | 468 out_line, err_line = self._server_process.read_either_stdout_or_
stderr_line(deadline) |
| 467 | 469 |
| 468 if not have_seen_begin: | 470 if not have_seen_begin: |
| 469 # FIXME(sky): Instead of logging, this should cause the previous
test to fail. | 471 # FIXME(sky): Instead of logging, this should cause the previous
test to fail. |
| 470 if err_line: | 472 if err_line: |
| 471 _log.error('Saw a stderr line between the end of the previou
s test and the start of the current one: %s' % ( | 473 if not have_printed_stdout_limbo_line: |
| 472 err_line)) | 474 have_printed_stdout_limbo_line = True |
| 475 _log.error('\nSaw a stderr lines between the end of the
previous test and the start of the current one:') |
| 476 _log.error(err_line) |
| 473 if out_line: | 477 if out_line: |
| 474 if out_line == '#BEGIN\n': | 478 if out_line == '#BEGIN\n': |
| 475 have_seen_begin = True | 479 have_seen_begin = True |
| 476 out_line = '' | 480 out_line = '' |
| 477 block.content = '' | 481 block.content = '' |
| 478 else: | 482 else: |
| 479 _log.error('Saw a stdout line between the end of the pre
vious test and the start of the current one: %s' % ( | 483 if not have_printed_stdout_limbo_line: |
| 480 out_line)) | 484 have_printed_stdout_limbo_line = True |
| 485 _log.error('\nSaw a stdout line between the end of t
he previous test and the start of the current one:') |
| 486 _log.error(out_line) |
| 481 | 487 |
| 482 if self._server_process.timed_out or self.has_crashed(): | 488 if self._server_process.timed_out or self.has_crashed(): |
| 483 break | 489 break |
| 484 | 490 |
| 485 if out_line: | 491 if out_line: |
| 486 assert not out_seen_eof | 492 assert not out_seen_eof |
| 487 out_line, out_seen_eof = self._strip_eof(out_line) | 493 out_line, out_seen_eof = self._strip_eof(out_line) |
| 488 if err_line: | 494 if err_line: |
| 489 assert not self.err_seen_eof | 495 assert not self.err_seen_eof |
| 490 err_line, self.err_seen_eof = self._strip_eof(err_line) | 496 err_line, self.err_seen_eof = self._strip_eof(err_line) |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 self.decoded_content = None | 531 self.decoded_content = None |
| 526 self.malloc = None | 532 self.malloc = None |
| 527 self.js_heap = None | 533 self.js_heap = None |
| 528 self.stdin_path = None | 534 self.stdin_path = None |
| 529 | 535 |
| 530 def decode_content(self): | 536 def decode_content(self): |
| 531 if self.encoding == 'base64' and self.content is not None: | 537 if self.encoding == 'base64' and self.content is not None: |
| 532 self.decoded_content = base64.b64decode(self.content) | 538 self.decoded_content = base64.b64decode(self.content) |
| 533 else: | 539 else: |
| 534 self.decoded_content = self.content | 540 self.decoded_content = self.content |
| OLD | NEW |