Commit 5530c8c6 authored by frankf@chromium.org's avatar frankf@chromium.org

[Android] Better handle gtest crashes that generate pexpect.EOF.

BUG=175538

Review URL: https://codereview.chromium.org/12250010

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@182021 0039d316-1c4b-4281-b951-d872f2087c98
parent 76263d3d
...@@ -215,6 +215,15 @@ class AndroidCommands(object): ...@@ -215,6 +215,15 @@ class AndroidCommands(object):
"""Returns our AdbInterface to avoid us wrapping all its methods.""" """Returns our AdbInterface to avoid us wrapping all its methods."""
return self._adb return self._adb
def IsOnline(self):
"""Checks whether the device is online.
Returns:
True if device is in 'device' mode, False otherwise.
"""
out = self._adb.SendCommand('get-state')
return out.strip() == 'device'
def IsRootEnabled(self): def IsRootEnabled(self):
"""Checks if root is enabled on the device.""" """Checks if root is enabled on the device."""
root_test_output = self.RunShellCommand('ls /root') or [''] root_test_output = self.RunShellCommand('ls /root') or ['']
......
...@@ -157,7 +157,13 @@ class TestPackage(object): ...@@ -157,7 +157,13 @@ class TestPackage(object):
failed_tests += [BaseTestResult(full_test_name, p.before)] failed_tests += [BaseTestResult(full_test_name, p.before)]
except pexpect.EOF: except pexpect.EOF:
logging.error('Test terminated - EOF') logging.error('Test terminated - EOF')
raise errors.DeviceUnresponsiveError('Device may be offline') # We're here because either the device went offline, or the test harness
# crashed without outputting the CRASHED marker (crbug.com/175538).
if not self.adb.IsOnline():
raise errors.DeviceUnresponsiveError('Device %s went offline.' %
self.device)
elif full_test_name:
crashed_tests += [BaseTestResult(full_test_name, p.before)]
except pexpect.TIMEOUT: except pexpect.TIMEOUT:
logging.error('Test terminated after %d second timeout.', logging.error('Test terminated after %d second timeout.',
self.timeout) self.timeout)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment