##// END OF EJS Templates
run-tests: organize options into argument groups...
Gregory Szorc -
r35189:d997b821 default
parent child Browse files
Show More
@@ -298,123 +298,128 b' def getparser():'
298 298 """Obtain the OptionParser used by the CLI."""
299 299 parser = argparse.ArgumentParser(usage='%(prog)s [options] [tests]')
300 300
301 # keep these sorted
302 parser.add_argument("--blacklist", action="append",
301 selection = parser.add_argument_group('Test Selection')
302 selection.add_argument('--allow-slow-tests', action='store_true',
303 help='allow extremely slow tests')
304 selection.add_argument("--blacklist", action="append",
303 305 help="skip tests listed in the specified blacklist file")
304 parser.add_argument("--whitelist", action="append",
305 help="always run tests listed in the specified whitelist file")
306 parser.add_argument("--test-list", action="append",
307 help="read tests to run from the specified file")
308 parser.add_argument("--changed",
306 selection.add_argument("--changed",
309 307 help="run tests that are changed in parent rev or working directory")
310 parser.add_argument("-C", "--annotate", action="store_true",
311 help="output files annotated with coverage")
312 parser.add_argument("-c", "--cover", action="store_true",
313 help="print a test coverage report")
314 parser.add_argument("--color", choices=["always", "auto", "never"],
315 default=os.environ.get('HGRUNTESTSCOLOR', 'auto'),
316 help="colorisation: always|auto|never (default: auto)")
317 parser.add_argument("-d", "--debug", action="store_true",
308 selection.add_argument("-k", "--keywords",
309 help="run tests matching keywords")
310 selection.add_argument("-r", "--retest", action="store_true",
311 help = "retest failed tests")
312 selection.add_argument("--test-list", action="append",
313 help="read tests to run from the specified file")
314 selection.add_argument("--whitelist", action="append",
315 help="always run tests listed in the specified whitelist file")
316 selection.add_argument('tests', metavar='TESTS', nargs='*',
317 help='Tests to run')
318
319 harness = parser.add_argument_group('Test Harness Behavior')
320 harness.add_argument('--bisect-repo',
321 metavar='bisect_repo',
322 help=("Path of a repo to bisect. Use together with "
323 "--known-good-rev"))
324 harness.add_argument("-d", "--debug", action="store_true",
318 325 help="debug mode: write output of test scripts to console"
319 326 " rather than capturing and diffing it (disables timeout)")
320 parser.add_argument("-f", "--first", action="store_true",
327 harness.add_argument("-f", "--first", action="store_true",
321 328 help="exit on the first test failure")
322 parser.add_argument("-H", "--htmlcov", action="store_true",
323 help="create an HTML report of the coverage of the files")
324 parser.add_argument("-i", "--interactive", action="store_true",
329 harness.add_argument("-i", "--interactive", action="store_true",
325 330 help="prompt to accept changed output")
326 parser.add_argument("-j", "--jobs", type=int,
331 harness.add_argument("-j", "--jobs", type=int,
327 332 help="number of jobs to run in parallel"
328 333 " (default: $%s or %d)" % defaults['jobs'])
329 parser.add_argument("--keep-tmpdir", action="store_true",
334 harness.add_argument("--keep-tmpdir", action="store_true",
330 335 help="keep temporary directory after running tests")
331 parser.add_argument("-k", "--keywords",
332 help="run tests matching keywords")
333 parser.add_argument("--list-tests", action="store_true",
336 harness.add_argument('--known-good-rev',
337 metavar="known_good_rev",
338 help=("Automatically bisect any failures using this "
339 "revision as a known-good revision."))
340 harness.add_argument("--list-tests", action="store_true",
334 341 help="list tests instead of running them")
335 parser.add_argument("-l", "--local", action="store_true",
342 harness.add_argument("--loop", action="store_true",
343 help="loop tests repeatedly")
344 harness.add_argument('--random', action="store_true",
345 help='run tests in random order')
346 harness.add_argument("-p", "--port", type=int,
347 help="port on which servers should listen"
348 " (default: $%s or %d)" % defaults['port'])
349 harness.add_argument('--profile-runner', action='store_true',
350 help='run statprof on run-tests')
351 harness.add_argument("-R", "--restart", action="store_true",
352 help="restart at last error")
353 harness.add_argument("--runs-per-test", type=int, dest="runs_per_test",
354 help="run each test N times (default=1)", default=1)
355 harness.add_argument("--shell",
356 help="shell to use (default: $%s or %s)" % defaults['shell'])
357 harness.add_argument('--showchannels', action='store_true',
358 help='show scheduling channels')
359 harness.add_argument("--slowtimeout", type=int,
360 help="kill errant slow tests after SLOWTIMEOUT seconds"
361 " (default: $%s or %d)" % defaults['slowtimeout'])
362 harness.add_argument("-t", "--timeout", type=int,
363 help="kill errant tests after TIMEOUT seconds"
364 " (default: $%s or %d)" % defaults['timeout'])
365 harness.add_argument("--tmpdir",
366 help="run tests in the given temporary directory"
367 " (implies --keep-tmpdir)")
368 harness.add_argument("-v", "--verbose", action="store_true",
369 help="output verbose messages")
370
371 hgconf = parser.add_argument_group('Mercurial Configuration')
372 hgconf.add_argument("--chg", action="store_true",
373 help="install and use chg wrapper in place of hg")
374 hgconf.add_argument("--compiler",
375 help="compiler to build with")
376 hgconf.add_argument('--extra-config-opt', action="append",
377 help='set the given config opt in the test hgrc')
378 hgconf.add_argument("-l", "--local", action="store_true",
336 379 help="shortcut for --with-hg=<testdir>/../hg, "
337 380 "and --with-chg=<testdir>/../contrib/chg/chg if --chg is set")
338 parser.add_argument("--loop", action="store_true",
339 help="loop tests repeatedly")
340 parser.add_argument("--runs-per-test", type=int, dest="runs_per_test",
341 help="run each test N times (default=1)", default=1)
342 parser.add_argument("-n", "--nodiff", action="store_true",
343 help="skip showing test changes")
344 parser.add_argument("--outputdir",
345 help="directory to write error logs to (default=test directory)")
346 parser.add_argument("-p", "--port", type=int,
347 help="port on which servers should listen"
348 " (default: $%s or %d)" % defaults['port'])
349 parser.add_argument("--compiler",
350 help="compiler to build with")
351 parser.add_argument("--pure", action="store_true",
381 hgconf.add_argument("--ipv6", action="store_true",
382 help="prefer IPv6 to IPv4 for network related tests")
383 hgconf.add_argument("--pure", action="store_true",
352 384 help="use pure Python code instead of C extensions")
353 parser.add_argument("-R", "--restart", action="store_true",
354 help="restart at last error")
355 parser.add_argument("-r", "--retest", action="store_true",
356 help="retest failed tests")
357 parser.add_argument("-S", "--noskips", action="store_true",
358 help="don't report skip tests verbosely")
359 parser.add_argument("--shell",
360 help="shell to use (default: $%s or %s)" % defaults['shell'])
361 parser.add_argument("-t", "--timeout", type=int,
362 help="kill errant tests after TIMEOUT seconds"
363 " (default: $%s or %d)" % defaults['timeout'])
364 parser.add_argument("--slowtimeout", type=int,
365 help="kill errant slow tests after SLOWTIMEOUT seconds"
366 " (default: $%s or %d)" % defaults['slowtimeout'])
367 parser.add_argument("--time", action="store_true",
368 help="time how long each test takes")
369 parser.add_argument("--json", action="store_true",
370 help="store test result data in 'report.json' file")
371 parser.add_argument("--tmpdir",
372 help="run tests in the given temporary directory"
373 " (implies --keep-tmpdir)")
374 parser.add_argument("-v", "--verbose", action="store_true",
375 help="output verbose messages")
376 parser.add_argument("--xunit",
377 help="record xunit results at specified path")
378 parser.add_argument("--view",
379 help="external diff viewer")
380 parser.add_argument("--with-hg",
385 hgconf.add_argument("-3", "--py3k-warnings", action="store_true",
386 help="enable Py3k warnings on Python 2.7+")
387 hgconf.add_argument("--with-chg", metavar="CHG",
388 help="use specified chg wrapper in place of hg")
389 hgconf.add_argument("--with-hg",
381 390 metavar="HG",
382 391 help="test using specified hg script rather than a "
383 392 "temporary installation")
384 parser.add_argument("--chg", action="store_true",
385 help="install and use chg wrapper in place of hg")
386 parser.add_argument("--with-chg", metavar="CHG",
387 help="use specified chg wrapper in place of hg")
388 parser.add_argument("--ipv6", action="store_true",
389 help="prefer IPv6 to IPv4 for network related tests")
390 parser.add_argument("-3", "--py3k-warnings", action="store_true",
391 help="enable Py3k warnings on Python 2.7+")
392 393 # This option should be deleted once test-check-py3-compat.t and other
393 394 # Python 3 tests run with Python 3.
394 parser.add_argument("--with-python3", metavar="PYTHON3",
395 help="Python 3 interpreter (if running under Python 2)"
396 " (TEMPORARY)")
397 parser.add_argument('--extra-config-opt', action="append",
398 help='set the given config opt in the test hgrc')
399 parser.add_argument('--random', action="store_true",
400 help='run tests in random order')
401 parser.add_argument('--profile-runner', action='store_true',
402 help='run statprof on run-tests')
403 parser.add_argument('--allow-slow-tests', action='store_true',
404 help='allow extremely slow tests')
405 parser.add_argument('--showchannels', action='store_true',
406 help='show scheduling channels')
407 parser.add_argument('--known-good-rev',
408 metavar="known_good_rev",
409 help=("Automatically bisect any failures using this "
410 "revision as a known-good revision."))
411 parser.add_argument('--bisect-repo',
412 metavar='bisect_repo',
413 help=("Path of a repo to bisect. Use together with "
414 "--known-good-rev"))
415
416 parser.add_argument('tests', metavar='TESTS', nargs='*',
417 help='Tests to run')
395 hgconf.add_argument("--with-python3", metavar="PYTHON3",
396 help="Python 3 interpreter (if running under Python 2)"
397 " (TEMPORARY)")
398
399 reporting = parser.add_argument_group('Results Reporting')
400 reporting.add_argument("-C", "--annotate", action="store_true",
401 help="output files annotated with coverage")
402 reporting.add_argument("--color", choices=["always", "auto", "never"],
403 default=os.environ.get('HGRUNTESTSCOLOR', 'auto'),
404 help="colorisation: always|auto|never (default: auto)")
405 reporting.add_argument("-c", "--cover", action="store_true",
406 help="print a test coverage report")
407 reporting.add_argument("-H", "--htmlcov", action="store_true",
408 help="create an HTML report of the coverage of the files")
409 reporting.add_argument("--json", action="store_true",
410 help="store test result data in 'report.json' file")
411 reporting.add_argument("--outputdir",
412 help="directory to write error logs to (default=test directory)")
413 reporting.add_argument("-n", "--nodiff", action="store_true",
414 help="skip showing test changes")
415 reporting.add_argument("-S", "--noskips", action="store_true",
416 help="don't report skip tests verbosely")
417 reporting.add_argument("--time", action="store_true",
418 help="time how long each test takes")
419 reporting.add_argument("--view",
420 help="external diff viewer")
421 reporting.add_argument("--xunit",
422 help="record xunit results at specified path")
418 423
419 424 for option, (envvar, default) in defaults.items():
420 425 defaults[option] = type(default)(os.environ.get(envvar, default))
General Comments 0
You need to be logged in to leave comments. Login now