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 import sys | 10 import sys |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 'sharding.')) | 106 'sharding.')) |
107 option_parser.add_option('--official-build', help='Run official build tests.') | 107 option_parser.add_option('--official-build', help='Run official build tests.') |
108 option_parser.add_option('--device', | 108 option_parser.add_option('--device', |
109 help='Serial number of device we should use.') | 109 help='Serial number of device we should use.') |
110 option_parser.add_option('--python_test_root', | 110 option_parser.add_option('--python_test_root', |
111 help='Root of the python-driven tests.') | 111 help='Root of the python-driven tests.') |
112 option_parser.add_option('--flakiness-dashboard-server', | 112 option_parser.add_option('--flakiness-dashboard-server', |
113 dest='flakiness_dashboard_server', | 113 dest='flakiness_dashboard_server', |
114 help=('Address of the server that is hosting the ' | 114 help=('Address of the server that is hosting the ' |
115 'Chrome for Android flakiness dashboard.')) | 115 'Chrome for Android flakiness dashboard.')) |
| 116 option_parser.add_option('--buildbot-step-failure', |
| 117 action='store_true', |
| 118 help=('If present, will set the buildbot status ' |
| 119 'as STEP_FAILURE, otherwise as STEP_WARNINGS ' |
| 120 'when test(s) fail.')) |
| 121 |
116 | 122 |
117 def ValidateInstrumentationOptions(option_parser, options, args): | 123 def ValidateInstrumentationOptions(option_parser, options, args): |
118 """Validate options/arguments and populate options with defaults.""" | 124 """Validate options/arguments and populate options with defaults.""" |
119 if len(args) > 1: | 125 if len(args) > 1: |
120 option_parser.print_help(sys.stderr) | 126 option_parser.print_help(sys.stderr) |
121 option_parser.error('Unknown arguments: %s' % args[1:]) | 127 option_parser.error('Unknown arguments: %s' % args[1:]) |
122 if options.java_only and options.python_only: | 128 if options.java_only and options.python_only: |
123 option_parser.error('Options java_only (-j) and python_only (-p) ' | 129 option_parser.error('Options java_only (-j) and python_only (-p) ' |
124 'are mutually exclusive.') | 130 'are mutually exclusive.') |
125 | 131 |
126 options.run_java_tests = True | 132 options.run_java_tests = True |
127 options.run_python_tests = True | 133 options.run_python_tests = True |
128 if options.java_only: | 134 if options.java_only: |
129 options.run_python_tests = False | 135 options.run_python_tests = False |
130 elif options.python_only: | 136 elif options.python_only: |
131 options.run_java_tests = False | 137 options.run_java_tests = False |
132 | 138 |
133 options.test_apk_path = os.path.join(_SDK_OUT_DIR, | 139 if os.path.exists(options.test_apk): |
134 options.build_type, | 140 # The APK is fully qualified, assume the JAR lives along side. |
135 constants.SDK_BUILD_APKS_DIR, | 141 options.test_apk_path = options.test_apk |
136 '%s.apk' % options.test_apk) | 142 options.test_apk_jar_path = os.path.splitext(options.test_apk_path) + '.jar' |
137 options.test_apk_jar_path = os.path.join(_SDK_OUT_DIR, | 143 else: |
138 options.build_type, | 144 options.test_apk_path = os.path.join(_SDK_OUT_DIR, |
139 constants.SDK_BUILD_TEST_JAVALIB_DIR, | 145 options.build_type, |
140 '%s.jar' % options.test_apk) | 146 constants.SDK_BUILD_APKS_DIR, |
| 147 '%s.apk' % options.test_apk) |
| 148 options.test_apk_jar_path = os.path.join( |
| 149 _SDK_OUT_DIR, options.build_type, constants.SDK_BUILD_TEST_JAVALIB_DIR, |
| 150 '%s.jar' % options.test_apk) |
141 if options.annotation_str: | 151 if options.annotation_str: |
142 options.annotation = options.annotation_str.split() | 152 options.annotation = options.annotation_str.split() |
143 elif options.test_filter: | 153 elif options.test_filter: |
144 options.annotation = [] | 154 options.annotation = [] |
145 else: | 155 else: |
146 options.annotation = ['Smoke', 'SmallTest', 'MediumTest', 'LargeTest'] | 156 options.annotation = ['Smoke', 'SmallTest', 'MediumTest', 'LargeTest'] |
OLD | NEW |