OLD | NEW |
---|---|
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 """Parses options for the instrumentation tests.""" | 5 """Parses options for the instrumentation tests.""" |
6 | 6 |
7 import constants | 7 import constants |
8 import optparse | 8 import optparse |
9 import os | 9 import os |
10 | 10 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
77 option_parser.add_option('-j', '--java_only', action='store_true', | 77 option_parser.add_option('-j', '--java_only', action='store_true', |
78 help='Run only the Java tests.') | 78 help='Run only the Java tests.') |
79 option_parser.add_option('-p', '--python_only', action='store_true', | 79 option_parser.add_option('-p', '--python_only', action='store_true', |
80 help='Run only the Python tests.') | 80 help='Run only the Python tests.') |
81 option_parser.add_option('-n', '--run_count', type='int', | 81 option_parser.add_option('-n', '--run_count', type='int', |
82 dest='number_of_runs', default=1, | 82 dest='number_of_runs', default=1, |
83 help=('How many times to run each test, regardless ' | 83 help=('How many times to run each test, regardless ' |
84 'of the result. (Default is 1)')) | 84 'of the result. (Default is 1)')) |
85 option_parser.add_option('--test-apk', dest='test_apk', | 85 option_parser.add_option('--test-apk', dest='test_apk', |
86 help=('The name of the apk containing the tests ' | 86 help=('The name of the apk containing the tests ' |
87 '(without the .apk extension) or for SDK ' | 87 '(without the .apk extension) or For SDK ' |
cjhopman
2012/09/07 19:50:35
Nit: lowercase for (or delete 'or' and start a new
shashi
2012/09/07 23:31:31
Done.
| |
88 'builds, the path to the APK from ' | 88 'builds, the apk name without the debug' |
89 'out/(Debug|Release) (for example, ' | 89 ' suffix. for example, ContentShellTest).')) |
90 'content_shell_test/ContentShellTest-debug).')) | |
91 option_parser.add_option('--screenshot', dest='screenshot_failures', | 90 option_parser.add_option('--screenshot', dest='screenshot_failures', |
92 action='store_true', | 91 action='store_true', |
93 help='Capture screenshots of test failures') | 92 help='Capture screenshots of test failures') |
94 option_parser.add_option('--save-perf-json', action='store_true', | 93 option_parser.add_option('--save-perf-json', action='store_true', |
95 help='Saves the JSON file for each UI Perf test.') | 94 help='Saves the JSON file for each UI Perf test.') |
96 option_parser.add_option('--shard_retries', type=int, default=1, | 95 option_parser.add_option('--shard_retries', type=int, default=1, |
97 help=('Number of times to retry each failure when ' | 96 help=('Number of times to retry each failure when ' |
98 'sharding.')) | 97 'sharding.')) |
99 option_parser.add_option('--official-build', help='Run official build tests.') | 98 option_parser.add_option('--official-build', help='Run official build tests.') |
100 option_parser.add_option('--device', | 99 option_parser.add_option('--device', |
101 help='Serial number of device we should use.') | 100 help='Serial number of device we should use.') |
102 option_parser.add_option('--python_test_root', | 101 option_parser.add_option('--python_test_root', |
103 help='Root of the python-driven tests.') | 102 help='Root of the python-driven tests.') |
104 | 103 |
105 options, args = option_parser.parse_args(args) | 104 options, args = option_parser.parse_args(args) |
106 if len(args) > 1: | 105 if len(args) > 1: |
107 option_parser.error('Unknown argument:', args[1:]) | 106 option_parser.error('Unknown argument:', args[1:]) |
108 if options.java_only and options.python_only: | 107 if options.java_only and options.python_only: |
109 option_parser.error('Options java_only (-j) and python_only (-p) ' | 108 option_parser.error('Options java_only (-j) and python_only (-p) ' |
110 'are mutually exclusive') | 109 'are mutually exclusive') |
111 | 110 |
112 options.run_java_tests = True | 111 options.run_java_tests = True |
113 options.run_python_tests = True | 112 options.run_python_tests = True |
114 if options.java_only: | 113 if options.java_only: |
115 options.run_python_tests = False | 114 options.run_python_tests = False |
116 elif options.python_only: | 115 elif options.python_only: |
117 options.run_java_tests = False | 116 options.run_java_tests = False |
118 | 117 |
118 # In case of SDK Build, the jars and apks have a -debug suffix. | |
119 options.test_apk_path = os.path.join(_SDK_OUT_DIR, | 119 options.test_apk_path = os.path.join(_SDK_OUT_DIR, |
120 options.build_type, | 120 options.build_type, |
121 '%s.apk' % options.test_apk) | 121 constants.SDK_BUILD_APKS_DIR, |
122 '%s-debug.apk' % options.test_apk) | |
122 options.test_apk_jar_path = os.path.join(_SDK_OUT_DIR, | 123 options.test_apk_jar_path = os.path.join(_SDK_OUT_DIR, |
123 options.build_type, | 124 options.build_type, |
124 '%s.jar' | 125 constants.SDK_BUILD_TEST_JAVALIB_DIR, |
126 '%s-debug.jar' | |
125 % options.test_apk) | 127 % options.test_apk) |
126 if options.annotation_str: | 128 if options.annotation_str: |
127 options.annotation = options.annotation_str.split() | 129 options.annotation = options.annotation_str.split() |
128 elif options.test_filter: | 130 elif options.test_filter: |
129 options.annotation = [] | 131 options.annotation = [] |
130 else: | 132 else: |
131 options.annotation = ['Smoke', 'SmallTest', 'MediumTest', 'LargeTest'] | 133 options.annotation = ['Smoke', 'SmallTest', 'MediumTest', 'LargeTest'] |
132 | 134 |
133 return options | 135 return options |
OLD | NEW |