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 |
11 | 11 |
12 _SDK_OUT_DIR = os.path.join(constants.CHROME_DIR, 'out') | 12 _SDK_OUT_DIR = os.path.join(constants.CHROME_DIR, 'out') |
13 | 13 |
14 | 14 |
15 def AddBuildTypeOption(option_parser): | 15 def AddBuildTypeOption(option_parser): |
16 """Decorates OptionParser with build type option.""" | 16 """Decorates OptionParser with build type option.""" |
17 default_build_type = 'Debug' | 17 default_build_type = 'Debug' |
18 if 'BUILDTYPE' in os.environ: | 18 if 'BUILDTYPE' in os.environ: |
19 default_build_type = os.environ['BUILDTYPE'] | 19 default_build_type = os.environ['BUILDTYPE'] |
20 option_parser.add_option('--debug', action='store_const', const='Debug', | 20 option_parser.add_option('--debug', action='store_const', const='Debug', |
21 dest='build_type', default=default_build_type, | 21 dest='build_type', default=default_build_type, |
22 help='If set, run test suites under out/Debug. ' | 22 help='If set, run test suites under out/Debug. ' |
23 'Default is env var BUILDTYPE or Debug') | 23 'Default is env var BUILDTYPE or Debug') |
24 option_parser.add_option('--release', action='store_const', const='Release', | 24 option_parser.add_option('--release', action='store_const', const='Release', |
25 dest='build_type', | 25 dest='build_type', |
26 help='If set, run test suites under out/Release. ' | 26 help='If set, run test suites under out/Release. ' |
27 'Default is env var BUILDTYPE or Debug.') | 27 'Default is env var BUILDTYPE or Debug.') |
28 | 28 |
| 29 def AddInstallAPKOption(option_parser): |
| 30 """Decorates OptionParser with apk option used to install the APK.""" |
| 31 option_parser.add_option('--apk', |
| 32 help=('The name of the apk containing the ' |
| 33 ' application (with the .apk extension).')) |
| 34 option_parser.add_option('--apk_package', |
| 35 help=('The package name used by the apk containing ' |
| 36 'the application.')) |
29 | 37 |
30 def AddTestRunnerOptions(option_parser, default_timeout=60): | 38 def AddTestRunnerOptions(option_parser, default_timeout=60): |
31 """Decorates OptionParser with options applicable to all tests.""" | 39 """Decorates OptionParser with options applicable to all tests.""" |
32 | 40 |
33 option_parser.add_option('-t', dest='timeout', | 41 option_parser.add_option('-t', dest='timeout', |
34 help='Timeout to wait for each test', | 42 help='Timeout to wait for each test', |
35 type='int', | 43 type='int', |
36 default=default_timeout) | 44 default=default_timeout) |
37 option_parser.add_option('-c', dest='cleanup_test_files', | 45 option_parser.add_option('-c', dest='cleanup_test_files', |
38 help='Cleanup test files on the device after run', | 46 help='Cleanup test files on the device after run', |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 options.test_apk_jar_path = os.path.join(_SDK_OUT_DIR, | 134 options.test_apk_jar_path = os.path.join(_SDK_OUT_DIR, |
127 options.build_type, | 135 options.build_type, |
128 constants.SDK_BUILD_TEST_JAVALIB_DIR, | 136 constants.SDK_BUILD_TEST_JAVALIB_DIR, |
129 '%s-debug.jar' % options.test_apk) | 137 '%s-debug.jar' % options.test_apk) |
130 if options.annotation_str: | 138 if options.annotation_str: |
131 options.annotation = options.annotation_str.split() | 139 options.annotation = options.annotation_str.split() |
132 elif options.test_filter: | 140 elif options.test_filter: |
133 options.annotation = [] | 141 options.annotation = [] |
134 else: | 142 else: |
135 options.annotation = ['Smoke', 'SmallTest', 'MediumTest', 'LargeTest'] | 143 options.annotation = ['Smoke', 'SmallTest', 'MediumTest', 'LargeTest'] |
OLD | NEW |