Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Side by Side Diff: build/android/pylib/gtest/test_package.py

Issue 12250010: [Android] Better handle gtest crashes that generate pexpect.EOF. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « build/android/pylib/android_commands.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 re 7 import re
8 import os 8 import os
9 9
10 from pylib import constants 10 from pylib import constants
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 if found == 0: # re_ok 150 if found == 0: # re_ok
151 if full_test_name == p.match.group(1).replace('\r', ''): 151 if full_test_name == p.match.group(1).replace('\r', ''):
152 ok_tests += [BaseTestResult(full_test_name, p.before)] 152 ok_tests += [BaseTestResult(full_test_name, p.before)]
153 elif found == 2: # re_crash 153 elif found == 2: # re_crash
154 crashed_tests += [BaseTestResult(full_test_name, p.before)] 154 crashed_tests += [BaseTestResult(full_test_name, p.before)]
155 break 155 break
156 else: # re_fail 156 else: # re_fail
157 failed_tests += [BaseTestResult(full_test_name, p.before)] 157 failed_tests += [BaseTestResult(full_test_name, p.before)]
158 except pexpect.EOF: 158 except pexpect.EOF:
159 logging.error('Test terminated - EOF') 159 logging.error('Test terminated - EOF')
160 raise errors.DeviceUnresponsiveError('Device may be offline') 160 # We're here because either the device went offline, or the test harness
161 # crashed without outputting the CRASHED marker (crbug.com/175538).
162 if not self.adb.IsOnline():
163 raise errors.DeviceUnresponsiveError('Device %s went offline.' %
164 self.device)
165 elif full_test_name:
166 crashed_tests += [BaseTestResult(full_test_name, p.before)]
161 except pexpect.TIMEOUT: 167 except pexpect.TIMEOUT:
162 logging.error('Test terminated after %d second timeout.', 168 logging.error('Test terminated after %d second timeout.',
163 self.timeout) 169 self.timeout)
164 if full_test_name: 170 if full_test_name:
165 timed_out_tests += [BaseTestResult(full_test_name, p.before)] 171 timed_out_tests += [BaseTestResult(full_test_name, p.before)]
166 finally: 172 finally:
167 p.close() 173 p.close()
168 174
169 ret_code = self._GetGTestReturnCode() 175 ret_code = self._GetGTestReturnCode()
170 if ret_code: 176 if ret_code:
171 logging.critical( 177 logging.critical(
172 'gtest exit code: %d\npexpect.before: %s\npexpect.after: %s', 178 'gtest exit code: %d\npexpect.before: %s\npexpect.after: %s',
173 ret_code, p.before, p.after) 179 ret_code, p.before, p.after)
174 180
175 # Create TestResults and return 181 # Create TestResults and return
176 return TestResults.FromRun(ok=ok_tests, failed=failed_tests, 182 return TestResults.FromRun(ok=ok_tests, failed=failed_tests,
177 crashed=crashed_tests, timed_out=timed_out_tests) 183 crashed=crashed_tests, timed_out=timed_out_tests)
OLDNEW
« no previous file with comments | « build/android/pylib/android_commands.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698