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