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 from pylib import constants |
klundberg
2013/01/03 21:04:07
Does it make sense to move constants too?
I don't
craigdh
2013/01/03 21:13:12
I don't like it either, but constants.py is used i
| |
8 | |
8 import optparse | 9 import optparse |
9 import os | 10 import os |
10 import sys | 11 import sys |
11 | 12 |
12 _SDK_OUT_DIR = os.path.join(constants.CHROME_DIR, 'out') | 13 _SDK_OUT_DIR = os.path.join(constants.CHROME_DIR, 'out') |
13 | 14 |
14 | 15 |
15 def AddBuildTypeOption(option_parser): | 16 def AddBuildTypeOption(option_parser): |
16 """Decorates OptionParser with build type option.""" | 17 """Decorates OptionParser with build type option.""" |
17 default_build_type = 'Debug' | 18 default_build_type = 'Debug' |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
73 dest='tool', | 74 dest='tool', |
74 help='Run the test under a tool ' | 75 help='Run the test under a tool ' |
75 '(use --tool help to list them)') | 76 '(use --tool help to list them)') |
76 option_parser.add_option('--flakiness-dashboard-server', | 77 option_parser.add_option('--flakiness-dashboard-server', |
77 dest='flakiness_dashboard_server', | 78 dest='flakiness_dashboard_server', |
78 help=('Address of the server that is hosting the ' | 79 help=('Address of the server that is hosting the ' |
79 'Chrome for Android flakiness dashboard.')) | 80 'Chrome for Android flakiness dashboard.')) |
80 AddBuildTypeOption(option_parser) | 81 AddBuildTypeOption(option_parser) |
81 | 82 |
82 | 83 |
84 def AddGTestOptions(option_parser): | |
frankf
2013/01/03 21:17:23
So the reason the other options are here, is that
craigdh
2013/01/03 21:44:05
Improving consistency between the various test run
| |
85 """Decorates OptionParser with GTest tests options.""" | |
86 | |
87 AddTestRunnerOptions(option_parser, default_timeout=0) | |
88 option_parser.add_option('-s', '--suite', dest='test_suite', | |
89 help='Executable name of the test suite to run ' | |
90 '(use -s help to list them)') | |
klundberg
2013/01/03 21:04:07
nit: period at end of sentence.
craigdh
2013/01/03 21:44:05
Done.
| |
91 option_parser.add_option('--out-directory', dest='out_directory', | |
92 help='Path to the out/ directory, irrespective of ' | |
93 'the build type. Only for non-Chromium uses.') | |
94 option_parser.add_option('-d', '--device', dest='test_device', | |
95 help='Target device the test suite to run ') | |
klundberg
2013/01/03 21:04:07
Seems like something is missing in this sentence.
craigdh
2013/01/03 21:44:05
Done.
| |
96 option_parser.add_option('-f', '--gtest_filter', dest='gtest_filter', | |
97 help='gtest filter') | |
klundberg
2013/01/03 21:04:07
nit: period at end of sentence.
craigdh
2013/01/03 21:44:05
Done.
craigdh
2013/01/03 21:44:05
Done.
| |
98 option_parser.add_option('-a', '--test_arguments', dest='test_arguments', | |
99 help='Additional arguments to pass to the test') | |
klundberg
2013/01/03 21:04:07
nit: period at end of sentence.
craigdh
2013/01/03 21:44:05
Done.
| |
100 option_parser.add_option('-L', dest='log_dump', | |
101 help='file name of log dump, which will be put in ' | |
klundberg
2013/01/03 21:04:07
file/File
craigdh
2013/01/03 21:44:05
Done.
| |
102 'subfolder debug_info_dumps under the same ' | |
103 'directory in where the test_suite exists.') | |
104 option_parser.add_option('-e', '--emulator', dest='use_emulator', | |
105 action='store_true', | |
106 help='Run tests in a new instance of emulator') | |
klundberg
2013/01/03 21:04:07
nit: period at end of sentence.
craigdh
2013/01/03 21:44:05
Done.
| |
107 option_parser.add_option('-n', '--emulator_count', | |
frankf
2013/01/03 21:17:23
For reference: at some point (not in this CL), it'
craigdh
2013/01/03 21:44:05
Added a TODO.
| |
108 type='int', default=1, | |
109 help='Number of emulators to launch for running the ' | |
110 'tests.') | |
111 option_parser.add_option('-x', '--xvfb', dest='use_xvfb', | |
112 action='store_true', | |
113 help='Use Xvfb around tests (ignored if not Linux)') | |
klundberg
2013/01/03 21:04:07
nit: period at end of sentence.
craigdh
2013/01/03 21:44:05
Done.
| |
114 option_parser.add_option('--webkit', action='store_true', | |
115 help='Run the tests from a WebKit checkout.') | |
116 option_parser.add_option('--fast', '--fast_and_loose', dest='fast_and_loose', | |
117 action='store_true', | |
118 help='Go faster (but be less stable), ' | |
119 'for quick testing. Example: when tracking down ' | |
120 'tests that hang to add to the disabled list, ' | |
121 'there is no need to redeploy the test binary ' | |
122 'or data to the device again. ' | |
123 'Don\'t use on bots by default!') | |
124 option_parser.add_option('--repeat', dest='repeat', type='int', | |
125 default=2, | |
126 help='Repeat count on test timeout') | |
klundberg
2013/01/03 21:04:07
nit: period at end of sentence.
craigdh
2013/01/03 21:44:05
Done.
| |
127 option_parser.add_option('--exit_code', action='store_true', | |
128 help='If set, the exit code will be total number ' | |
129 'of failures.') | |
130 option_parser.add_option('--exe', action='store_true', | |
131 help='If set, use the exe test runner instead of ' | |
132 'the APK.') | |
133 | |
134 | |
83 def AddInstrumentationOptions(option_parser): | 135 def AddInstrumentationOptions(option_parser): |
84 """Decorates OptionParser with instrumentation tests options.""" | 136 """Decorates OptionParser with instrumentation tests options.""" |
85 | 137 |
86 AddTestRunnerOptions(option_parser) | 138 AddTestRunnerOptions(option_parser) |
87 option_parser.add_option('-w', '--wait_debugger', dest='wait_for_debugger', | 139 option_parser.add_option('-w', '--wait_debugger', dest='wait_for_debugger', |
88 action='store_true', help='Wait for debugger.') | 140 action='store_true', help='Wait for debugger.') |
89 option_parser.add_option('-I', dest='install_apk', help='Install APK.', | 141 option_parser.add_option('-I', dest='install_apk', help='Install APK.', |
90 action='store_true') | 142 action='store_true') |
91 option_parser.add_option('-f', '--test_filter', | 143 option_parser.add_option('-f', '--test_filter', |
92 help='Test filter (if not fully qualified, ' | 144 help='Test filter (if not fully qualified, ' |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
176 '%s.apk' % options.test_apk) | 228 '%s.apk' % options.test_apk) |
177 options.test_apk_jar_path = os.path.join( | 229 options.test_apk_jar_path = os.path.join( |
178 _SDK_OUT_DIR, options.build_type, constants.SDK_BUILD_TEST_JAVALIB_DIR, | 230 _SDK_OUT_DIR, options.build_type, constants.SDK_BUILD_TEST_JAVALIB_DIR, |
179 '%s.jar' % options.test_apk) | 231 '%s.jar' % options.test_apk) |
180 if options.annotation_str: | 232 if options.annotation_str: |
181 options.annotation = options.annotation_str.split() | 233 options.annotation = options.annotation_str.split() |
182 elif options.test_filter: | 234 elif options.test_filter: |
183 options.annotation = [] | 235 options.annotation = [] |
184 else: | 236 else: |
185 options.annotation = ['Smoke', 'SmallTest', 'MediumTest', 'LargeTest'] | 237 options.annotation = ['Smoke', 'SmallTest', 'MediumTest', 'LargeTest'] |
OLD | NEW |