diff options
author | frankf@chromium.org <frankf@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-14 20:57:45 +0000 |
---|---|---|
committer | frankf@chromium.org <frankf@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-14 20:57:45 +0000 |
commit | bf4d544188e75233d54a870bdb711301a37a2b01 (patch) | |
tree | fbfe2510600d2570bad980664aeb0df235fe183f /build | |
parent | c74c418f65c0d572abd7897399433c513ff92082 (diff) | |
download | chromium_src-bf4d544188e75233d54a870bdb711301a37a2b01.zip chromium_src-bf4d544188e75233d54a870bdb711301a37a2b01.tar.gz chromium_src-bf4d544188e75233d54a870bdb711301a37a2b01.tar.bz2 |
[Android] Enable starting the crash upload service using an intent
This utility can be used by stability tests to upload any crashers
before the profile is cleared.
BUG=None
R=feng@chromium.org, yfriedman@chromium.org
Review URL: https://codereview.chromium.org/59813007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@235229 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build')
-rw-r--r-- | build/android/pylib/android_commands.py | 13 | ||||
-rw-r--r-- | build/android/pylib/monkey/test_runner.py | 16 |
2 files changed, 27 insertions, 2 deletions
diff --git a/build/android/pylib/android_commands.py b/build/android/pylib/android_commands.py index 4c27907..5ac4a30 100644 --- a/build/android/pylib/android_commands.py +++ b/build/android/pylib/android_commands.py @@ -741,6 +741,19 @@ class AndroidCommands(object): start_line = m.group(0) return GetLogTimestamp(start_line, self.GetDeviceYear()) + def StartCrashUploadService(self, package): + # TODO(frankf): We really need a python wrapper around Intent + # to be shared with StartActivity/BroadcastIntent. + cmd = ( + 'am startservice -a %s.crash.ACTION_FIND_ALL -n ' + '%s/%s.crash.MinidumpUploadService' % + (constants.PACKAGE_INFO['chrome'].package, + package, + constants.PACKAGE_INFO['chrome'].package)) + am_output = self.RunShellCommand(cmd) + assert am_output and 'Starting' in am_output[-1], 'Service failed to start' + time.sleep(15) + def BroadcastIntent(self, package, intent, *args): """Send a broadcast intent. diff --git a/build/android/pylib/monkey/test_runner.py b/build/android/pylib/monkey/test_runner.py index b088039..1920464 100644 --- a/build/android/pylib/monkey/test_runner.py +++ b/build/android/pylib/monkey/test_runner.py @@ -4,6 +4,7 @@ """Runs a monkey test on a single device.""" +import logging import random from pylib import constants @@ -66,8 +67,16 @@ class TestRunner(base_test_runner.BaseTestRunner): output = '\n'.join(self._LaunchMonkeyTest()) after_pids = self.adb.ExtractPid(self._package) - crashed = (not before_pids or not after_pids - or after_pids[0] != before_pids[0]) + crashed = True + if not before_pids: + logging.error('Failed to start the process.') + elif not after_pids: + logging.error('Process %s has died.', before_pids[0]) + elif before_pids[0] != after_pids[0]: + logging.error('Detected process restart %s -> %s', + before_pids[0], after_pids[0]) + else: + crashed = False results = base_test_result.TestRunResults() success_pattern = 'Events injected: %d' % self._options.event_count @@ -77,5 +86,8 @@ class TestRunner(base_test_runner.BaseTestRunner): else: result = base_test_result.BaseTestResult( test_name, base_test_result.ResultType.FAIL, log=output) + if 'chrome' in self._options.package: + logging.warning('Start MinidumpUploadService...') + self.adb.StartCrashUploadService(self._package) results.AddResult(result) return results, False |