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