Bug 1856942: part 5) Factor async loading of a sheet out of `Loader::LoadSheet`....
[gecko.git] / testing / xpcshell / xpcshellcommandline.py
blobba8bdf3eabd7c551bfd73ac0eaf53e1f9f22f811
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 import argparse
7 from mozlog import commandline
10 def add_common_arguments(parser):
11 parser.add_argument(
12 "--app-binary",
13 type=str,
14 dest="app_binary",
15 default=None,
16 help="path to application binary (eg: c:\\program files\\mozilla firefox\\firefox.exe)",
18 parser.add_argument(
19 "--app-path",
20 type=str,
21 dest="appPath",
22 default=None,
23 help="application directory (as opposed to XRE directory)",
25 parser.add_argument(
26 "--interactive",
27 action="store_true",
28 dest="interactive",
29 default=False,
30 help="don't automatically run tests, drop to an xpcshell prompt",
32 parser.add_argument(
33 "--verbose",
34 action="store_true",
35 dest="verbose",
36 default=False,
37 help="always print stdout and stderr from tests",
39 parser.add_argument(
40 "--verbose-if-fails",
41 action="store_true",
42 dest="verboseIfFails",
43 default=False,
44 help="Output the log if a test fails, even when run in parallel",
46 parser.add_argument(
47 "--keep-going",
48 action="store_true",
49 dest="keepGoing",
50 default=False,
51 help="continue running tests after test killed with control-C (SIGINT)",
53 parser.add_argument(
54 "--logfiles",
55 action="store_true",
56 dest="logfiles",
57 default=True,
58 help="create log files (default, only used to override --no-logfiles)",
60 parser.add_argument(
61 "--dump-tests",
62 type=str,
63 dest="dump_tests",
64 default=None,
65 help="Specify path to a filename to dump all the tests that will be run",
67 parser.add_argument(
68 "--manifest",
69 type=str,
70 dest="manifest",
71 default=None,
72 help="Manifest of test directories to use",
74 parser.add_argument(
75 "--no-logfiles",
76 action="store_false",
77 dest="logfiles",
78 help="don't create log files",
80 parser.add_argument(
81 "--sequential",
82 action="store_true",
83 dest="sequential",
84 default=False,
85 help="Run all tests sequentially",
87 parser.add_argument(
88 "--temp-dir",
89 dest="tempDir",
90 default=None,
91 help="Directory to use for temporary files",
93 parser.add_argument(
94 "--testing-modules-dir",
95 dest="testingModulesDir",
96 default=None,
97 help="Directory where testing modules are located.",
99 parser.add_argument(
100 "--total-chunks",
101 type=int,
102 dest="totalChunks",
103 default=1,
104 help="how many chunks to split the tests up into",
106 parser.add_argument(
107 "--this-chunk",
108 type=int,
109 dest="thisChunk",
110 default=1,
111 help="which chunk to run between 1 and --total-chunks",
113 parser.add_argument(
114 "--profile-name",
115 type=str,
116 dest="profileName",
117 default=None,
118 help="name of application profile being tested",
120 parser.add_argument(
121 "--build-info-json",
122 type=str,
123 dest="mozInfo",
124 default=None,
125 help="path to a mozinfo.json including information about the build "
126 "configuration. defaults to looking for mozinfo.json next to "
127 "the script.",
129 parser.add_argument(
130 "--shuffle",
131 action="store_true",
132 dest="shuffle",
133 default=False,
134 help="Execute tests in random order",
136 parser.add_argument(
137 "--xre-path",
138 action="store",
139 type=str,
140 dest="xrePath",
141 # individual scripts will set a sane default
142 default=None,
143 help="absolute path to directory containing XRE (probably xulrunner)",
145 parser.add_argument(
146 "--symbols-path",
147 action="store",
148 type=str,
149 dest="symbolsPath",
150 default=None,
151 help="absolute path to directory containing breakpad symbols, "
152 "or the URL of a zip file containing symbols",
154 parser.add_argument(
155 "--jscov-dir-prefix",
156 action="store",
157 type=str,
158 dest="jscovdir",
159 default=argparse.SUPPRESS,
160 help="Directory to store per-test javascript line coverage data as json.",
162 parser.add_argument(
163 "--debugger",
164 action="store",
165 dest="debugger",
166 help="use the given debugger to launch the application",
168 parser.add_argument(
169 "--debugger-args",
170 action="store",
171 dest="debuggerArgs",
172 help="pass the given args to the debugger _before_ "
173 "the application on the command line",
175 parser.add_argument(
176 "--debugger-interactive",
177 action="store_true",
178 dest="debuggerInteractive",
179 help="prevents the test harness from redirecting "
180 "stdout and stderr for interactive debuggers",
182 parser.add_argument(
183 "--jsdebugger",
184 dest="jsDebugger",
185 action="store_true",
186 help="Waits for a devtools JS debugger to connect before " "starting the test.",
188 parser.add_argument(
189 "--jsdebugger-port",
190 type=int,
191 dest="jsDebuggerPort",
192 default=6000,
193 help="The port to listen on for a debugger connection if "
194 "--jsdebugger is specified.",
196 parser.add_argument(
197 "--tag",
198 action="append",
199 dest="test_tags",
200 default=None,
201 help="filter out tests that don't have the given tag. Can be "
202 "used multiple times in which case the test must contain "
203 "at least one of the given tags.",
205 parser.add_argument(
206 "--utility-path",
207 action="store",
208 dest="utility_path",
209 default=None,
210 help="Path to a directory containing utility programs, such "
211 "as stack fixer scripts.",
213 parser.add_argument(
214 "--xpcshell",
215 action="store",
216 dest="xpcshell",
217 default=None,
218 help="Path to xpcshell binary",
220 parser.add_argument(
221 "--http3server",
222 action="store",
223 dest="http3server",
224 default=None,
225 help="Path to http3server binary",
227 # This argument can be just present, or the path to a manifest file. The
228 # just-present case is usually used for mach which can provide a default
229 # path to the failure file from the previous run
230 parser.add_argument(
231 "--rerun-failures",
232 action="store_true",
233 help="Rerun failures from the previous run, if any",
235 parser.add_argument(
236 "--failure-manifest",
237 action="store",
238 help="Path to a manifest file from which to rerun failures "
239 "(with --rerun-failure) or in which to record failed tests",
241 parser.add_argument(
242 "--threads",
243 type=int,
244 dest="threadCount",
245 default=0,
246 help="override the number of jobs (threads) when running tests "
247 "in parallel, the default is CPU x 1.5 when running via mach "
248 "and CPU x 4 when running in automation",
250 parser.add_argument(
251 "--setpref",
252 action="append",
253 dest="extraPrefs",
254 metavar="PREF=VALUE",
255 help="Defines an extra user preference (can be passed multiple times.",
257 parser.add_argument(
258 "testPaths", nargs="*", default=None, help="Paths of tests to run."
260 parser.add_argument(
261 "--verify",
262 action="store_true",
263 default=False,
264 help="Run tests in verification mode: Run many times in different "
265 "ways, to see if there are intermittent failures.",
267 parser.add_argument(
268 "--verify-max-time",
269 dest="verifyMaxTime",
270 type=int,
271 default=3600,
272 help="Maximum time, in seconds, to run in --verify mode.",
274 parser.add_argument(
275 "--headless",
276 action="store_true",
277 default=False,
278 dest="headless",
279 help="Enable headless mode by default for tests which don't specify "
280 "whether to use headless mode",
282 parser.add_argument(
283 "--conditioned-profile",
284 action="store_true",
285 default=False,
286 dest="conditionedProfile",
287 help="Run with conditioned profile instead of fresh blank profile",
289 parser.add_argument(
290 "--self-test",
291 action="store_true",
292 default=False,
293 dest="self_test",
294 help="Run self tests",
296 parser.add_argument(
297 "--run-failures",
298 action="store",
299 default="",
300 dest="runFailures",
301 help="Run failures matching keyword",
303 parser.add_argument(
304 "--timeout-as-pass",
305 action="store_true",
306 default=False,
307 dest="timeoutAsPass",
308 help="Harness level timeouts will be treated as passing",
310 parser.add_argument(
311 "--crash-as-pass",
312 action="store_true",
313 default=False,
314 dest="crashAsPass",
315 help="Harness level crashes will be treated as passing",
317 parser.add_argument(
318 "--disable-fission",
319 action="store_true",
320 default=False,
321 dest="disableFission",
322 help="disable fission mode (back to e10s || 1proc)",
324 parser.add_argument(
325 "--repeat",
326 action="store",
327 default=0,
328 type=int,
329 dest="repeat",
330 help="repeat the test X times, default [0]",
334 def add_remote_arguments(parser):
335 parser.add_argument(
336 "--objdir",
337 action="store",
338 type=str,
339 dest="objdir",
340 help="Local objdir, containing xpcshell binaries.",
343 parser.add_argument(
344 "--apk",
345 action="store",
346 type=str,
347 dest="localAPK",
348 help="Local path to Firefox for Android APK.",
351 parser.add_argument(
352 "--deviceSerial",
353 action="store",
354 type=str,
355 dest="deviceSerial",
356 help="adb serial number of remote device. This is required "
357 "when more than one device is connected to the host. "
358 "Use 'adb devices' to see connected devices.",
361 parser.add_argument(
362 "--adbPath",
363 action="store",
364 type=str,
365 dest="adbPath",
366 default=None,
367 help="Path to adb binary.",
370 parser.add_argument(
371 "--noSetup",
372 action="store_false",
373 dest="setup",
374 default=True,
375 help="Do not copy any files to device (to be used only if "
376 "device is already setup).",
378 parser.add_argument(
379 "--no-install",
380 action="store_false",
381 dest="setup",
382 default=True,
383 help="Don't install the app or any files to the device (to be used if "
384 "the device is already set up)",
387 parser.add_argument(
388 "--local-bin-dir",
389 action="store",
390 type=str,
391 dest="localBin",
392 help="Local path to bin directory.",
395 parser.add_argument(
396 "--remoteTestRoot",
397 action="store",
398 type=str,
399 dest="remoteTestRoot",
400 help="Remote directory to use as test root " "(eg. /data/local/tmp/test_root).",
404 def parser_desktop():
405 parser = argparse.ArgumentParser()
406 add_common_arguments(parser)
407 commandline.add_logging_group(parser)
409 return parser
412 def parser_remote():
413 parser = argparse.ArgumentParser()
414 common = parser.add_argument_group("Common Options")
415 add_common_arguments(common)
416 remote = parser.add_argument_group("Remote Options")
417 add_remote_arguments(remote)
418 commandline.add_logging_group(parser)
420 return parser