| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Runs the Monkey tests on one or more devices.""" | 6 """Runs the Monkey tests on one or more devices.""" |
| 7 import logging | 7 import logging |
| 8 import optparse | 8 import optparse |
| 9 import random | 9 import random |
| 10 import sys | 10 import sys |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 '%d' % event_count] | 89 '%d' % event_count] |
| 90 return self.adb.RunShellCommand(' '.join(cmd), timeout_time=timeout_ms) | 90 return self.adb.RunShellCommand(' '.join(cmd), timeout_time=timeout_ms) |
| 91 | 91 |
| 92 | 92 |
| 93 | 93 |
| 94 def DispatchPythonTests(options): | 94 def DispatchPythonTests(options): |
| 95 """Dispatches the Monkey tests, sharding it if there multiple devices.""" | 95 """Dispatches the Monkey tests, sharding it if there multiple devices.""" |
| 96 logger = logging.getLogger() | 96 logger = logging.getLogger() |
| 97 logger.setLevel(logging.DEBUG) | 97 logger.setLevel(logging.DEBUG) |
| 98 | 98 |
| 99 available_tests = [MonkeyTest('testMonkey', options)] | 99 available_tests = [MonkeyTest('testMonkey')] |
| 100 attached_devices = android_commands.GetAttachedDevices() | 100 attached_devices = android_commands.GetAttachedDevices() |
| 101 if not attached_devices: | 101 if not attached_devices: |
| 102 raise Exception('You have no devices attached or visible!') | 102 raise Exception('You have no devices attached or visible!') |
| 103 | 103 |
| 104 # Actually run the tests. | 104 # Actually run the tests. |
| 105 logging.debug('Running monkey tests.') | 105 logging.debug('Running monkey tests.') |
| 106 available_tests *= len(attached_devices) | 106 available_tests *= len(attached_devices) |
| 107 options.ensure_value('shard_retries',1) | 107 options.ensure_value('shard_retries',1) |
| 108 sharder = python_test_sharder.PythonTestSharder( | 108 sharder = python_test_sharder.PythonTestSharder( |
| 109 attached_devices, available_tests, options) | 109 attached_devices, available_tests, options) |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 parser.error('Missing package name') | 145 parser.error('Missing package name') |
| 146 | 146 |
| 147 if options.category: | 147 if options.category: |
| 148 options.category = options.category.split(',') | 148 options.category = options.category.split(',') |
| 149 | 149 |
| 150 DispatchPythonTests(options) | 150 DispatchPythonTests(options) |
| 151 | 151 |
| 152 | 152 |
| 153 if __name__ == '__main__': | 153 if __name__ == '__main__': |
| 154 main() | 154 main() |
| OLD | NEW |