Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright 2013 The Chromium Authors. All rights reserved. | 3 # Copyright 2013 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 """Runs all types of tests from one unified interface.""" | 7 """Runs all types of tests from one unified interface.""" |
| 8 | 8 |
| 9 import collections | 9 import collections |
| 10 import logging | 10 import logging |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 164 '-E', '--exclude-annotation', dest='exclude_annotation_str', | 164 '-E', '--exclude-annotation', dest='exclude_annotation_str', |
| 165 help=('Comma-separated list of annotations. Exclude tests with these ' | 165 help=('Comma-separated list of annotations. Exclude tests with these ' |
| 166 'annotations.')) | 166 'annotations.')) |
| 167 option_parser.add_option('--screenshot', dest='screenshot_failures', | 167 option_parser.add_option('--screenshot', dest='screenshot_failures', |
| 168 action='store_true', | 168 action='store_true', |
| 169 help='Capture screenshots of test failures') | 169 help='Capture screenshots of test failures') |
| 170 option_parser.add_option('--save-perf-json', action='store_true', | 170 option_parser.add_option('--save-perf-json', action='store_true', |
| 171 help='Saves the JSON file for each UI Perf test.') | 171 help='Saves the JSON file for each UI Perf test.') |
| 172 option_parser.add_option('--official-build', action='store_true', | 172 option_parser.add_option('--official-build', action='store_true', |
| 173 help='Run official build tests.') | 173 help='Run official build tests.') |
| 174 option_parser.add_option('--keep_test_server_ports', | |
| 175 action='store_true', | |
| 176 help=('Indicates the test server ports must be ' | |
| 177 'kept. When this is run via a sharder ' | |
| 178 'the test server ports should be kept and ' | |
| 179 'should not be reset.')) | |
| 180 option_parser.add_option('--test_data', action='append', default=[], | 174 option_parser.add_option('--test_data', action='append', default=[], |
| 181 help=('Each instance defines a directory of test ' | 175 help=('Each instance defines a directory of test ' |
| 182 'data that should be copied to the target(s) ' | 176 'data that should be copied to the target(s) ' |
| 183 'before running the tests. The argument ' | 177 'before running the tests. The argument ' |
| 184 'should be of the form <target>:<source>, ' | 178 'should be of the form <target>:<source>, ' |
| 185 '<target> is relative to the device data' | 179 '<target> is relative to the device data' |
| 186 'directory, and <source> is relative to the ' | 180 'directory, and <source> is relative to the ' |
| 187 'chromium build directory.')) | 181 'chromium build directory.')) |
| 188 | 182 |
| 189 | 183 |
| 190 def ProcessJavaTestOptions(options, error_func): | 184 def ProcessJavaTestOptions(options, error_func): |
| 191 """Processes options/arguments and populates |options| with defaults.""" | 185 """Processes options/arguments and populates |options| with defaults.""" |
| 192 | 186 |
| 193 if options.annotation_str: | 187 if options.annotation_str: |
| 194 options.annotations = options.annotation_str.split(',') | 188 options.annotations = options.annotation_str.split(',') |
| 195 elif options.test_filter: | 189 elif options.test_filter: |
| 196 options.annotations = [] | 190 options.annotations = [] |
| 197 else: | 191 else: |
| 198 options.annotations = ['Smoke', 'SmallTest', 'MediumTest', 'LargeTest', | 192 options.annotations = ['Smoke', 'SmallTest', 'MediumTest', 'LargeTest', |
| 199 'EnormousTest'] | 193 'EnormousTest'] |
| 200 | 194 |
| 201 if options.exclude_annotation_str: | 195 if options.exclude_annotation_str: |
| 202 options.exclude_annotations = options.exclude_annotation_str.split(',') | 196 options.exclude_annotations = options.exclude_annotation_str.split(',') |
| 203 else: | 197 else: |
| 204 options.exclude_annotations = [] | 198 options.exclude_annotations = [] |
| 205 | 199 |
| 206 if not options.keep_test_server_ports: | 200 if not ports.ResetTestServerPortAllocation(): |
|
frankf
2013/11/15 18:43:30
Can you unify all such calls into one? gtest/setup
bulach
2013/11/15 18:56:33
good point! done.
| |
| 207 if not ports.ResetTestServerPortAllocation(): | 201 raise Exception('Failed to reset test server port.') |
| 208 raise Exception('Failed to reset test server port.') | |
| 209 | 202 |
| 210 | 203 |
| 211 def AddInstrumentationTestOptions(option_parser): | 204 def AddInstrumentationTestOptions(option_parser): |
| 212 """Adds Instrumentation test options to |option_parser|.""" | 205 """Adds Instrumentation test options to |option_parser|.""" |
| 213 | 206 |
| 214 option_parser.usage = '%prog instrumentation [options]' | 207 option_parser.usage = '%prog instrumentation [options]' |
| 215 option_parser.commands_dict = {} | 208 option_parser.commands_dict = {} |
| 216 option_parser.example = ('%prog instrumentation ' | 209 option_parser.example = ('%prog instrumentation ' |
| 217 '--test-apk=ChromiumTestShellTest') | 210 '--test-apk=ChromiumTestShellTest') |
| 218 | 211 |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 794 | 787 |
| 795 | 788 |
| 796 def main(argv): | 789 def main(argv): |
| 797 option_parser = command_option_parser.CommandOptionParser( | 790 option_parser = command_option_parser.CommandOptionParser( |
| 798 commands_dict=VALID_COMMANDS) | 791 commands_dict=VALID_COMMANDS) |
| 799 return command_option_parser.ParseAndExecute(option_parser) | 792 return command_option_parser.ParseAndExecute(option_parser) |
| 800 | 793 |
| 801 | 794 |
| 802 if __name__ == '__main__': | 795 if __name__ == '__main__': |
| 803 sys.exit(main(sys.argv)) | 796 sys.exit(main(sys.argv)) |
| OLD | NEW |