Bug 1755973 - Try implied arr+[0] in GetUniformIndices. r=gfx-reviewers,bradwerth
[gecko.git] / testing / xpcshell / xpcshellcommandline.py
blob48cbfccd88ccc4073f355b2db879c887d56ba655
1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 from __future__ import absolute_import
7 import argparse
9 from mozlog import commandline
12 def add_common_arguments(parser):
13 parser.add_argument(
14 "--app-path",
15 type=str,
16 dest="appPath",
17 default=None,
18 help="application directory (as opposed to XRE directory)",
20 parser.add_argument(
21 "--interactive",
22 action="store_true",
23 dest="interactive",
24 default=False,
25 help="don't automatically run tests, drop to an xpcshell prompt",
27 parser.add_argument(
28 "--verbose",
29 action="store_true",
30 dest="verbose",
31 default=False,
32 help="always print stdout and stderr from tests",
34 parser.add_argument(
35 "--verbose-if-fails",
36 action="store_true",
37 dest="verboseIfFails",
38 default=False,
39 help="Output the log if a test fails, even when run in parallel",
41 parser.add_argument(
42 "--keep-going",
43 action="store_true",
44 dest="keepGoing",
45 default=False,
46 help="continue running tests after test killed with control-C (SIGINT)",
48 parser.add_argument(
49 "--logfiles",
50 action="store_true",
51 dest="logfiles",
52 default=True,
53 help="create log files (default, only used to override --no-logfiles)",
55 parser.add_argument(
56 "--dump-tests",
57 type=str,
58 dest="dump_tests",
59 default=None,
60 help="Specify path to a filename to dump all the tests that will be run",
62 parser.add_argument(
63 "--manifest",
64 type=str,
65 dest="manifest",
66 default=None,
67 help="Manifest of test directories to use",
69 parser.add_argument(
70 "--no-logfiles",
71 action="store_false",
72 dest="logfiles",
73 help="don't create log files",
75 parser.add_argument(
76 "--sequential",
77 action="store_true",
78 dest="sequential",
79 default=False,
80 help="Run all tests sequentially",
82 parser.add_argument(
83 "--temp-dir",
84 dest="tempDir",
85 default=None,
86 help="Directory to use for temporary files",
88 parser.add_argument(
89 "--testing-modules-dir",
90 dest="testingModulesDir",
91 default=None,
92 help="Directory where testing modules are located.",
94 parser.add_argument(
95 "--test-plugin-path",
96 type=str,
97 dest="pluginsPath",
98 default=None,
99 help="Path to the location of a plugins directory containing the "
100 "test plugin or plugins required for tests. "
101 "By default xpcshell's dir svc provider returns gre/plugins. "
102 "Use test-plugin-path to add a directory "
103 "to return for NS_APP_PLUGINS_DIR_LIST when queried.",
105 parser.add_argument(
106 "--total-chunks",
107 type=int,
108 dest="totalChunks",
109 default=1,
110 help="how many chunks to split the tests up into",
112 parser.add_argument(
113 "--this-chunk",
114 type=int,
115 dest="thisChunk",
116 default=1,
117 help="which chunk to run between 1 and --total-chunks",
119 parser.add_argument(
120 "--profile-name",
121 type=str,
122 dest="profileName",
123 default=None,
124 help="name of application profile being tested",
126 parser.add_argument(
127 "--build-info-json",
128 type=str,
129 dest="mozInfo",
130 default=None,
131 help="path to a mozinfo.json including information about the build "
132 "configuration. defaults to looking for mozinfo.json next to "
133 "the script.",
135 parser.add_argument(
136 "--shuffle",
137 action="store_true",
138 dest="shuffle",
139 default=False,
140 help="Execute tests in random order",
142 parser.add_argument(
143 "--xre-path",
144 action="store",
145 type=str,
146 dest="xrePath",
147 # individual scripts will set a sane default
148 default=None,
149 help="absolute path to directory containing XRE (probably xulrunner)",
151 parser.add_argument(
152 "--symbols-path",
153 action="store",
154 type=str,
155 dest="symbolsPath",
156 default=None,
157 help="absolute path to directory containing breakpad symbols, "
158 "or the URL of a zip file containing symbols",
160 parser.add_argument(
161 "--jscov-dir-prefix",
162 action="store",
163 type=str,
164 dest="jscovdir",
165 default=argparse.SUPPRESS,
166 help="Directory to store per-test javascript line coverage data as json.",
168 parser.add_argument(
169 "--debugger",
170 action="store",
171 dest="debugger",
172 help="use the given debugger to launch the application",
174 parser.add_argument(
175 "--debugger-args",
176 action="store",
177 dest="debuggerArgs",
178 help="pass the given args to the debugger _before_ "
179 "the application on the command line",
181 parser.add_argument(
182 "--debugger-interactive",
183 action="store_true",
184 dest="debuggerInteractive",
185 help="prevents the test harness from redirecting "
186 "stdout and stderr for interactive debuggers",
188 parser.add_argument(
189 "--jsdebugger",
190 dest="jsDebugger",
191 action="store_true",
192 help="Waits for a devtools JS debugger to connect before " "starting the test.",
194 parser.add_argument(
195 "--jsdebugger-port",
196 type=int,
197 dest="jsDebuggerPort",
198 default=6000,
199 help="The port to listen on for a debugger connection if "
200 "--jsdebugger is specified.",
202 parser.add_argument(
203 "--tag",
204 action="append",
205 dest="test_tags",
206 default=None,
207 help="filter out tests that don't have the given tag. Can be "
208 "used multiple times in which case the test must contain "
209 "at least one of the given tags.",
211 parser.add_argument(
212 "--utility-path",
213 action="store",
214 dest="utility_path",
215 default=None,
216 help="Path to a directory containing utility programs, such "
217 "as stack fixer scripts.",
219 parser.add_argument(
220 "--xpcshell",
221 action="store",
222 dest="xpcshell",
223 default=None,
224 help="Path to xpcshell binary",
226 parser.add_argument(
227 "--http3server",
228 action="store",
229 dest="http3server",
230 default=None,
231 help="Path to http3server binary",
233 # This argument can be just present, or the path to a manifest file. The
234 # just-present case is usually used for mach which can provide a default
235 # path to the failure file from the previous run
236 parser.add_argument(
237 "--rerun-failures",
238 action="store_true",
239 help="Rerun failures from the previous run, if any",
241 parser.add_argument(
242 "--failure-manifest",
243 action="store",
244 help="Path to a manifest file from which to rerun failures "
245 "(with --rerun-failure) or in which to record failed tests",
247 parser.add_argument(
248 "--threads",
249 type=int,
250 dest="threadCount",
251 default=0,
252 help="override the number of jobs (threads) when running tests "
253 "in parallel, the default is CPU x 1.5 when running via mach "
254 "and CPU x 4 when running in automation",
256 parser.add_argument(
257 "--setpref",
258 action="append",
259 dest="extraPrefs",
260 metavar="PREF=VALUE",
261 help="Defines an extra user preference (can be passed multiple times.",
263 parser.add_argument(
264 "testPaths", nargs="*", default=None, help="Paths of tests to run."
266 parser.add_argument(
267 "--verify",
268 action="store_true",
269 default=False,
270 help="Run tests in verification mode: Run many times in different "
271 "ways, to see if there are intermittent failures.",
273 parser.add_argument(
274 "--verify-max-time",
275 dest="verifyMaxTime",
276 type=int,
277 default=3600,
278 help="Maximum time, in seconds, to run in --verify mode.",
280 parser.add_argument(
281 "--headless",
282 action="store_true",
283 default=False,
284 dest="headless",
285 help="Enable headless mode by default for tests which don't specify "
286 "whether to use headless mode",
288 parser.add_argument(
289 "--conditioned-profile",
290 action="store_true",
291 default=False,
292 dest="conditionedProfile",
293 help="Run with conditioned profile instead of fresh blank profile",
295 parser.add_argument(
296 "--self-test",
297 action="store_true",
298 default=False,
299 dest="self_test",
300 help="Run self tests",
302 parser.add_argument(
303 "--run-failures",
304 action="store",
305 default="",
306 dest="runFailures",
307 help="Run failures matching keyword",
309 parser.add_argument(
310 "--timeout-as-pass",
311 action="store_true",
312 default=False,
313 dest="timeoutAsPass",
314 help="Harness level timeouts will be treated as passing",
316 parser.add_argument(
317 "--crash-as-pass",
318 action="store_true",
319 default=False,
320 dest="crashAsPass",
321 help="Harness level crashes will be treated as passing",
323 parser.add_argument(
324 "--disable-fission",
325 action="store_true",
326 default=False,
327 dest="disableFission",
328 help="disable fission mode (back to e10s || 1proc)",
332 def add_remote_arguments(parser):
333 parser.add_argument(
334 "--objdir",
335 action="store",
336 type=str,
337 dest="objdir",
338 help="Local objdir, containing xpcshell binaries.",
341 parser.add_argument(
342 "--apk",
343 action="store",
344 type=str,
345 dest="localAPK",
346 help="Local path to Firefox for Android APK.",
349 parser.add_argument(
350 "--deviceSerial",
351 action="store",
352 type=str,
353 dest="deviceSerial",
354 help="adb serial number of remote device. This is required "
355 "when more than one device is connected to the host. "
356 "Use 'adb devices' to see connected devices.",
359 parser.add_argument(
360 "--adbPath",
361 action="store",
362 type=str,
363 dest="adbPath",
364 default=None,
365 help="Path to adb binary.",
368 parser.add_argument(
369 "--noSetup",
370 action="store_false",
371 dest="setup",
372 default=True,
373 help="Do not copy any files to device (to be used only if "
374 "device is already setup).",
376 parser.add_argument(
377 "--no-install",
378 action="store_false",
379 dest="setup",
380 default=True,
381 help="Don't install the app or any files to the device (to be used if "
382 "the device is already set up)",
385 parser.add_argument(
386 "--local-bin-dir",
387 action="store",
388 type=str,
389 dest="localBin",
390 help="Local path to bin directory.",
393 parser.add_argument(
394 "--remoteTestRoot",
395 action="store",
396 type=str,
397 dest="remoteTestRoot",
398 help="Remote directory to use as test root " "(eg. /data/local/tmp/test_root).",
402 def parser_desktop():
403 parser = argparse.ArgumentParser()
404 add_common_arguments(parser)
405 commandline.add_logging_group(parser)
407 return parser
410 def parser_remote():
411 parser = argparse.ArgumentParser()
412 common = parser.add_argument_group("Common Options")
413 add_common_arguments(common)
414 remote = parser.add_argument_group("Remote Options")
415 add_remote_arguments(remote)
416 commandline.add_logging_group(parser)
418 return parser