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 #TODO(craigdh): pylib/utils/ should not depend on pylib/. | 7 #TODO(craigdh): pylib/utils/ should not depend on pylib/. |
8 from pylib import constants | 8 from pylib import constants |
9 | 9 |
10 import optparse | 10 import optparse |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 def AddTestRunnerOptions(option_parser, default_timeout=60): | 57 def AddTestRunnerOptions(option_parser, default_timeout=60): |
58 """Decorates OptionParser with options applicable to all tests.""" | 58 """Decorates OptionParser with options applicable to all tests.""" |
59 | 59 |
60 option_parser.add_option('-t', dest='timeout', | 60 option_parser.add_option('-t', dest='timeout', |
61 help='Timeout to wait for each test', | 61 help='Timeout to wait for each test', |
62 type='int', | 62 type='int', |
63 default=default_timeout) | 63 default=default_timeout) |
64 option_parser.add_option('-c', dest='cleanup_test_files', | 64 option_parser.add_option('-c', dest='cleanup_test_files', |
65 help='Cleanup test files on the device after run', | 65 help='Cleanup test files on the device after run', |
66 action='store_true') | 66 action='store_true') |
| 67 option_parser.add_option('--num_retries', dest='num_retries', type='int', |
| 68 default=2, |
| 69 help='Number of retries for a test before ' |
| 70 'giving up.') |
67 option_parser.add_option('-v', | 71 option_parser.add_option('-v', |
68 '--verbose', | 72 '--verbose', |
69 dest='verbose_count', | 73 dest='verbose_count', |
70 default=0, | 74 default=0, |
71 action='count', | 75 action='count', |
72 help='Verbose level (multiple times for more)') | 76 help='Verbose level (multiple times for more)') |
73 profilers = ['devicestatsmonitor', 'chrometrace', 'dumpheap', 'smaps', | 77 profilers = ['devicestatsmonitor', 'chrometrace', 'dumpheap', 'smaps', |
74 'traceview'] | 78 'traceview'] |
75 option_parser.add_option('--profiler', dest='profilers', action='append', | 79 option_parser.add_option('--profiler', dest='profilers', action='append', |
76 choices=profilers, | 80 choices=profilers, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 help='Run tests in a new instance of emulator.') | 114 help='Run tests in a new instance of emulator.') |
111 option_parser.add_option('-n', '--emulator_count', | 115 option_parser.add_option('-n', '--emulator_count', |
112 type='int', default=1, | 116 type='int', default=1, |
113 help='Number of emulators to launch for running the ' | 117 help='Number of emulators to launch for running the ' |
114 'tests.') | 118 'tests.') |
115 option_parser.add_option('-x', '--xvfb', dest='use_xvfb', | 119 option_parser.add_option('-x', '--xvfb', dest='use_xvfb', |
116 action='store_true', | 120 action='store_true', |
117 help='Use Xvfb around tests (ignored if not Linux).') | 121 help='Use Xvfb around tests (ignored if not Linux).') |
118 option_parser.add_option('--webkit', action='store_true', | 122 option_parser.add_option('--webkit', action='store_true', |
119 help='Run the tests from a WebKit checkout.') | 123 help='Run the tests from a WebKit checkout.') |
120 option_parser.add_option('--repeat', dest='repeat', type='int', | |
121 default=2, | |
122 help='Repeat count on test timeout.') | |
123 option_parser.add_option('--exit_code', action='store_true', | 124 option_parser.add_option('--exit_code', action='store_true', |
124 help='If set, the exit code will be total number ' | 125 help='If set, the exit code will be total number ' |
125 'of failures.') | 126 'of failures.') |
126 option_parser.add_option('--exe', action='store_true', | 127 option_parser.add_option('--exe', action='store_true', |
127 help='If set, use the exe test runner instead of ' | 128 help='If set, use the exe test runner instead of ' |
128 'the APK.') | 129 'the APK.') |
129 option_parser.add_option('--abi', default='armeabi-v7a', | 130 option_parser.add_option('--abi', default='armeabi-v7a', |
130 help='Platform of emulators to launch.') | 131 help='Platform of emulators to launch.') |
131 | 132 |
132 | 133 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 # The dexed JAR is fully qualified, assume the info JAR lives along side. | 278 # The dexed JAR is fully qualified, assume the info JAR lives along side. |
278 options.uiautomator_jar = options.test_jar | 279 options.uiautomator_jar = options.test_jar |
279 else: | 280 else: |
280 options.uiautomator_jar = os.path.join( | 281 options.uiautomator_jar = os.path.join( |
281 _SDK_OUT_DIR, options.build_type, constants.SDK_BUILD_JAVALIB_DIR, | 282 _SDK_OUT_DIR, options.build_type, constants.SDK_BUILD_JAVALIB_DIR, |
282 '%s.dex.jar' % options.test_jar) | 283 '%s.dex.jar' % options.test_jar) |
283 options.uiautomator_info_jar = ( | 284 options.uiautomator_info_jar = ( |
284 options.uiautomator_jar[:options.uiautomator_jar.find('.dex.jar')] + | 285 options.uiautomator_jar[:options.uiautomator_jar.find('.dex.jar')] + |
285 '_java.jar') | 286 '_java.jar') |
286 | 287 |
OLD | NEW |