| OLD | NEW |
| 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 22 matching lines...) Expand all Loading... |
| 33 cmd = ['monkey', | 33 cmd = ['monkey', |
| 34 '-p %s' % self._package, | 34 '-p %s' % self._package, |
| 35 ' '.join(['-c %s' % c for c in self._options.category]), | 35 ' '.join(['-c %s' % c for c in self._options.category]), |
| 36 '--throttle %d' % self._options.throttle, | 36 '--throttle %d' % self._options.throttle, |
| 37 '-s %d' % (self._options.seed or random.randint(1, 100)), | 37 '-s %d' % (self._options.seed or random.randint(1, 100)), |
| 38 '-v ' * self._options.verbose_count, | 38 '-v ' * self._options.verbose_count, |
| 39 '--monitor-native-crashes', | 39 '--monitor-native-crashes', |
| 40 '--kill-process-after-error', | 40 '--kill-process-after-error', |
| 41 self._options.extra_args, | 41 self._options.extra_args, |
| 42 '%d' % self._options.event_count] | 42 '%d' % self._options.event_count] |
| 43 return self.device.old_interface.RunShellCommand( | 43 return self.device.RunShellCommand(' '.join(cmd), timeout=timeout_ms) |
| 44 ' '.join(cmd), timeout_time=timeout_ms) | |
| 45 | 44 |
| 46 def RunTest(self, test_name): | 45 def RunTest(self, test_name): |
| 47 """Run a Monkey test on the device. | 46 """Run a Monkey test on the device. |
| 48 | 47 |
| 49 Args: | 48 Args: |
| 50 test_name: String to use for logging the test result. | 49 test_name: String to use for logging the test result. |
| 51 | 50 |
| 52 Returns: | 51 Returns: |
| 53 A tuple of (TestRunResults, retry). | 52 A tuple of (TestRunResults, retry). |
| 54 """ | 53 """ |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 result = base_test_result.BaseTestResult( | 85 result = base_test_result.BaseTestResult( |
| 87 test_name, base_test_result.ResultType.FAIL, log=output) | 86 test_name, base_test_result.ResultType.FAIL, log=output) |
| 88 if 'chrome' in self._options.package: | 87 if 'chrome' in self._options.package: |
| 89 logging.warning('Starting MinidumpUploadService...') | 88 logging.warning('Starting MinidumpUploadService...') |
| 90 try: | 89 try: |
| 91 self.device.old_interface.StartCrashUploadService(self._package) | 90 self.device.old_interface.StartCrashUploadService(self._package) |
| 92 except AssertionError as e: | 91 except AssertionError as e: |
| 93 logging.error('Failed to start MinidumpUploadService: %s', e) | 92 logging.error('Failed to start MinidumpUploadService: %s', e) |
| 94 results.AddResult(result) | 93 results.AddResult(result) |
| 95 return results, False | 94 return results, False |
| OLD | NEW |