| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 available_tests.append(MonkeyTest(new_method)) | 106 available_tests.append(MonkeyTest(new_method)) |
| 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) |
| 110 results = sharder.RunShardedTests() | 110 results = sharder.RunShardedTests() |
| 111 report_results.LogFull( | 111 report_results.LogFull( |
| 112 results=results, | 112 results=results, |
| 113 test_type='Monkey', | 113 test_type='Monkey', |
| 114 test_package='Monkey', | 114 test_package='Monkey', |
| 115 build_type=options.build_type) | 115 build_type=options.build_type) |
| 116 report_results.PrintAnnotation(results) | 116 # TODO(gkanwar): After the host-driven tests have been refactored, they sould |
| 117 # use the comment exit code system (part of pylib/base/shard.py) |
| 118 if not results.DidRunPass(): |
| 119 return 1 |
| 120 return 0 |
| 117 | 121 |
| 118 | 122 |
| 119 def main(): | 123 def main(): |
| 120 desc = 'Run the Monkey tests on 1 or more devices.' | 124 desc = 'Run the Monkey tests on 1 or more devices.' |
| 121 parser = optparse.OptionParser(description=desc) | 125 parser = optparse.OptionParser(description=desc) |
| 122 test_options_parser.AddBuildTypeOption(parser) | 126 test_options_parser.AddBuildTypeOption(parser) |
| 123 parser.add_option('--package-name', help='Allowed package.') | 127 parser.add_option('--package-name', help='Allowed package.') |
| 124 parser.add_option('--activity-name', | 128 parser.add_option('--activity-name', |
| 125 default='com.google.android.apps.chrome.Main', | 129 default='com.google.android.apps.chrome.Main', |
| 126 help='Name of the activity to start [default: %default].') | 130 help='Name of the activity to start [default: %default].') |
| (...skipping 23 matching lines...) Expand all Loading... |
| 150 parser.error('Missing package name') | 154 parser.error('Missing package name') |
| 151 | 155 |
| 152 if options.category: | 156 if options.category: |
| 153 options.category = options.category.split(',') | 157 options.category = options.category.split(',') |
| 154 | 158 |
| 155 DispatchPythonTests(options) | 159 DispatchPythonTests(options) |
| 156 | 160 |
| 157 | 161 |
| 158 if __name__ == '__main__': | 162 if __name__ == '__main__': |
| 159 main() | 163 main() |
| OLD | NEW |