| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 | 5 |
| 6 import logging | 6 import logging |
| 7 import os | 7 import os |
| 8 import re | 8 import re |
| 9 | 9 |
| 10 from pylib import constants | 10 from pylib import constants |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 re_fail = re.compile('\[ FAILED \] ?(.*)\r\n') | 137 re_fail = re.compile('\[ FAILED \] ?(.*)\r\n') |
| 138 re_ok = re.compile('\[ OK \] ?(.*?) .*\r\n') | 138 re_ok = re.compile('\[ OK \] ?(.*?) .*\r\n') |
| 139 | 139 |
| 140 # Test run statuses. | 140 # Test run statuses. |
| 141 re_passed = re.compile('\[ PASSED \] ?(.*)\r\n') | 141 re_passed = re.compile('\[ PASSED \] ?(.*)\r\n') |
| 142 re_runner_fail = re.compile('\[ RUNNER_FAILED \] ?(.*)\r\n') | 142 re_runner_fail = re.compile('\[ RUNNER_FAILED \] ?(.*)\r\n') |
| 143 # Signal handlers are installed before starting tests | 143 # Signal handlers are installed before starting tests |
| 144 # to output the CRASHED marker when a crash happens. | 144 # to output the CRASHED marker when a crash happens. |
| 145 re_crash = re.compile('\[ CRASHED \](.*)\r\n') | 145 re_crash = re.compile('\[ CRASHED \](.*)\r\n') |
| 146 | 146 |
| 147 log = '' |
| 147 try: | 148 try: |
| 148 while True: | 149 while True: |
| 149 full_test_name = None | 150 full_test_name = None |
| 150 found = p.expect([re_run, re_passed, re_runner_fail], | 151 found = p.expect([re_run, re_passed, re_runner_fail], |
| 151 timeout=self.timeout) | 152 timeout=self.timeout) |
| 152 if found == 1: # re_passed | 153 if found == 1: # re_passed |
| 153 break | 154 break |
| 154 elif found == 2: # re_runner_fail | 155 elif found == 2: # re_runner_fail |
| 155 break | 156 break |
| 156 else: # re_run | 157 else: # re_run |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 finally: | 190 finally: |
| 190 p.close() | 191 p.close() |
| 191 | 192 |
| 192 ret_code = self._GetGTestReturnCode() | 193 ret_code = self._GetGTestReturnCode() |
| 193 if ret_code: | 194 if ret_code: |
| 194 logging.critical( | 195 logging.critical( |
| 195 'gtest exit code: %d\npexpect.before: %s\npexpect.after: %s', | 196 'gtest exit code: %d\npexpect.before: %s\npexpect.after: %s', |
| 196 ret_code, p.before, p.after) | 197 ret_code, p.before, p.after) |
| 197 | 198 |
| 198 return results | 199 return results |
| OLD | NEW |