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

Side by Side Diff: build/android/pylib/monkey/test_runner.py

Issue 59813007: [Android] Enable starting the crash upload service using an intent (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Better logging for monkey Created 7 years, 1 month 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 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 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 """Runs a monkey test on a single device.""" 5 """Runs a monkey test on a single device."""
6 6
7 import logging
7 import random 8 import random
8 9
9 from pylib import constants 10 from pylib import constants
10 from pylib.base import base_test_result 11 from pylib.base import base_test_result
11 from pylib.base import base_test_runner 12 from pylib.base import base_test_runner
12 13
13 14
14 class TestRunner(base_test_runner.BaseTestRunner): 15 class TestRunner(base_test_runner.BaseTestRunner):
15 """A TestRunner instance runs a monkey test on a single device.""" 16 """A TestRunner instance runs a monkey test on a single device."""
16 17
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 # Chrome crashes are not always caught by Monkey test runner. 60 # Chrome crashes are not always caught by Monkey test runner.
60 # Verify Chrome has the same PID before and after the test. 61 # Verify Chrome has the same PID before and after the test.
61 before_pids = self.adb.ExtractPid(self._package) 62 before_pids = self.adb.ExtractPid(self._package)
62 63
63 # Run the test. 64 # Run the test.
64 output = '' 65 output = ''
65 if before_pids: 66 if before_pids:
66 output = '\n'.join(self._LaunchMonkeyTest()) 67 output = '\n'.join(self._LaunchMonkeyTest())
67 after_pids = self.adb.ExtractPid(self._package) 68 after_pids = self.adb.ExtractPid(self._package)
68 69
69 crashed = (not before_pids or not after_pids 70 crashed = True
70 or after_pids[0] != before_pids[0]) 71 if not before_pids:
72 logging.error('Failed to start the process.')
73 elif not after_pids:
74 logging.error('Process %s has died.', before_pids[0])
75 elif before_pids[0] != after_pids[0]:
76 logging.error('Detected process restart %s -> %s',
77 before_pids[0], after_pids[0])
78 else:
79 crashed = False
71 80
72 results = base_test_result.TestRunResults() 81 results = base_test_result.TestRunResults()
73 success_pattern = 'Events injected: %d' % self._options.event_count 82 success_pattern = 'Events injected: %d' % self._options.event_count
74 if success_pattern in output and not crashed: 83 if success_pattern in output and not crashed:
75 result = base_test_result.BaseTestResult( 84 result = base_test_result.BaseTestResult(
76 test_name, base_test_result.ResultType.PASS, log=output) 85 test_name, base_test_result.ResultType.PASS, log=output)
77 else: 86 else:
78 result = base_test_result.BaseTestResult( 87 result = base_test_result.BaseTestResult(
79 test_name, base_test_result.ResultType.FAIL, log=output) 88 test_name, base_test_result.ResultType.FAIL, log=output)
89 if 'chrome' in self._options.package:
90 logging.warning('Start MinidumpUploadService...')
91 self.adb.StartCrashUploadService(self._package)
80 results.AddResult(result) 92 results.AddResult(result)
81 return results, False 93 return results, False
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