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

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

Issue 1254843002: telemetry: Fix killing the perf profiler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update monkey test runner. Created 5 years, 4 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
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 logging
8 import random 8 import random
9 9
10 from pylib import constants 10 from pylib import constants
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 action='android.intent.action.MAIN'), 59 action='android.intent.action.MAIN'),
60 blocking=True, force_stop=True) 60 blocking=True, force_stop=True)
61 61
62 # Chrome crashes are not always caught by Monkey test runner. 62 # Chrome crashes are not always caught by Monkey test runner.
63 # Verify Chrome has the same PID before and after the test. 63 # Verify Chrome has the same PID before and after the test.
64 before_pids = self.device.GetPids(self._package) 64 before_pids = self.device.GetPids(self._package)
65 65
66 # Run the test. 66 # Run the test.
67 output = '' 67 output = ''
68 if before_pids: 68 if before_pids:
69 if len(before_pids[self._package]) > 1:
jbudorick 2015/07/27 15:25:32 This should probably be before_pids.get(self._pack
Sami 2015/07/27 15:33:23 Done.
70 raise Exception(
71 'At most one instance of process %s expected but found pids: '
72 '%s' % (self._package, before_pids))
69 output = '\n'.join(self._LaunchMonkeyTest()) 73 output = '\n'.join(self._LaunchMonkeyTest())
70 after_pids = self.device.GetPids(self._package) 74 after_pids = self.device.GetPids(self._package)
71 75
72 crashed = True 76 crashed = True
73 if not self._package in before_pids: 77 if not self._package in before_pids:
74 logging.error('Failed to start the process.') 78 logging.error('Failed to start the process.')
75 elif not self._package in after_pids: 79 elif not self._package in after_pids:
76 logging.error('Process %s has died.', before_pids[self._package]) 80 logging.error('Process %s has died.', before_pids[self._package])
77 elif before_pids[self._package] != after_pids[self._package]: 81 elif before_pids[self._package] != after_pids[self._package]:
78 logging.error('Detected process restart %s -> %s', 82 logging.error('Detected process restart %s -> %s',
(...skipping 18 matching lines...) Expand all
97 activity='%s.crash.MinidumpUploadService' % _CHROME_PACKAGE) 101 activity='%s.crash.MinidumpUploadService' % _CHROME_PACKAGE)
98 try: 102 try:
99 self.device.RunShellCommand( 103 self.device.RunShellCommand(
100 ['am', 'startservice'] + minidump_intent.am_args, 104 ['am', 'startservice'] + minidump_intent.am_args,
101 as_root=True, check_return=True) 105 as_root=True, check_return=True)
102 except device_errors.CommandFailedError: 106 except device_errors.CommandFailedError:
103 logging.exception('Failed to start MinidumpUploadService') 107 logging.exception('Failed to start MinidumpUploadService')
104 108
105 results.AddResult(result) 109 results.AddResult(result)
106 return results, False 110 return results, False
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698