| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -31,7 +31,7 @@ | |||
| 31 | 31 | from __future__ import print_function | |
| 32 | 32 | from typing import Dict | |
| 33 | 33 | import logging | |
| 34 | - import optparse | ||
| 34 | + import argparse | ||
| 35 | 35 | import os | |
| 36 | 36 | import re | |
| 37 | 37 | import signal | |
@@ -1369,84 +1369,84 @@ def ReadConfigurationInto(path, sections, defs): | |||
| 1369 | 1369 | ||
| 1370 | 1370 | ||
| 1371 | 1371 | def BuildOptions(): | |
| 1372 | - result = optparse.OptionParser() | ||
| 1373 | - result.add_option("-m", "--mode", help="The test modes in which to run (comma-separated)", | ||
| 1372 | + result = argparse.ArgumentParser() | ||
| 1373 | + result.add_argument("-m", "--mode", help="The test modes in which to run (comma-separated)", | ||
| 1374 | 1374 | default='release') | |
| 1375 | - result.add_option("-v", "--verbose", help="Verbose output", | ||
| 1375 | + result.add_argument("-v", "--verbose", help="Verbose output", | ||
| 1376 | 1376 | default=False, action="store_true") | |
| 1377 | - result.add_option('--logfile', dest='logfile', | ||
| 1377 | + result.add_argument('--logfile', dest='logfile', | ||
| 1378 | 1378 | help='write test output to file. NOTE: this only applies the tap progress indicator') | |
| 1379 | - result.add_option("-p", "--progress", | ||
| 1379 | + result.add_argument("-p", "--progress", | ||
| 1380 | 1380 | help="The style of progress indicator (%s)" % ", ".join(PROGRESS_INDICATORS.keys()), | |
| 1381 | 1381 | choices=list(PROGRESS_INDICATORS.keys()), default="mono") | |
| 1382 | - result.add_option("--report", help="Print a summary of the tests to be run", | ||
| 1382 | + result.add_argument("--report", help="Print a summary of the tests to be run", | ||
| 1383 | 1383 | default=False, action="store_true") | |
| 1384 | - result.add_option("-s", "--suite", help="A test suite", | ||
| 1384 | + result.add_argument("-s", "--suite", help="A test suite", | ||
| 1385 | 1385 | default=[], action="append") | |
| 1386 | - result.add_option("-t", "--timeout", help="Timeout in seconds", | ||
| 1387 | - default=120, type="int") | ||
| 1388 | - result.add_option("--arch", help='The architecture to run tests for', | ||
| 1386 | + result.add_argument("-t", "--timeout", help="Timeout in seconds", | ||
| 1387 | + default=120, type=int) | ||
| 1388 | + result.add_argument("--arch", help='The architecture to run tests for', | ||
| 1389 | 1389 | default='none') | |
| 1390 | - result.add_option("--snapshot", help="Run the tests with snapshot turned on", | ||
| 1390 | + result.add_argument("--snapshot", help="Run the tests with snapshot turned on", | ||
| 1391 | 1391 | default=False, action="store_true") | |
| 1392 | - result.add_option("--special-command", default=None) | ||
| 1393 | - result.add_option("--node-args", dest="node_args", help="Args to pass through to Node", | ||
| 1392 | + result.add_argument("--special-command", default=None) | ||
| 1393 | + result.add_argument("--node-args", dest="node_args", help="Args to pass through to Node", | ||
| 1394 | 1394 | default=[], action="append") | |
| 1395 | - result.add_option("--expect-fail", dest="expect_fail", | ||
| 1395 | + result.add_argument("--expect-fail", dest="expect_fail", | ||
| 1396 | 1396 | help="Expect test cases to fail", default=False, action="store_true") | |
| 1397 | - result.add_option("--valgrind", help="Run tests through valgrind", | ||
| 1397 | + result.add_argument("--valgrind", help="Run tests through valgrind", | ||
| 1398 | 1398 | default=False, action="store_true") | |
| 1399 | - result.add_option("--worker", help="Run parallel tests inside a worker context", | ||
| 1399 | + result.add_argument("--worker", help="Run parallel tests inside a worker context", | ||
| 1400 | 1400 | default=False, action="store_true") | |
| 1401 | - result.add_option("--check-deopts", help="Check tests for permanent deoptimizations", | ||
| 1401 | + result.add_argument("--check-deopts", help="Check tests for permanent deoptimizations", | ||
| 1402 | 1402 | default=False, action="store_true") | |
| 1403 | - result.add_option("--cat", help="Print the source of the tests", | ||
| 1403 | + result.add_argument("--cat", help="Print the source of the tests", | ||
| 1404 | 1404 | default=False, action="store_true") | |
| 1405 | - result.add_option("--flaky-tests", | ||
| 1405 | + result.add_argument("--flaky-tests", | ||
| 1406 | 1406 | help="Regard tests marked as flaky (run|skip|dontcare|keep_retrying)", | |
| 1407 | 1407 | default="run") | |
| 1408 | - result.add_option("--measure-flakiness", | ||
| 1408 | + result.add_argument("--measure-flakiness", | ||
| 1409 | 1409 | help="When a test fails, re-run it x number of times", | |
| 1410 | - default=0, type="int") | ||
| 1411 | - result.add_option("--skip-tests", | ||
| 1410 | + default=0, type=int) | ||
| 1411 | + result.add_argument("--skip-tests", | ||
| 1412 | 1412 | help="Tests that should not be executed (comma-separated)", | |
| 1413 | 1413 | default="") | |
| 1414 | - result.add_option("--warn-unused", help="Report unused rules", | ||
| 1414 | + result.add_argument("--warn-unused", help="Report unused rules", | ||
| 1415 | 1415 | default=False, action="store_true") | |
| 1416 | - result.add_option("-j", help="The number of parallel tasks to run, 0=use number of cores", | ||
| 1417 | - default=0, type="int") | ||
| 1418 | - result.add_option("-J", help="For legacy compatibility, has no effect", | ||
| 1416 | + result.add_argument("-j", help="The number of parallel tasks to run, 0=use number of cores", | ||
| 1417 | + default=0, type=int) | ||
| 1418 | + result.add_argument("-J", help="For legacy compatibility, has no effect", | ||
| 1419 | 1419 | default=False, action="store_true") | |
| 1420 | - result.add_option("--time", help="Print timing information after running", | ||
| 1420 | + result.add_argument("--time", help="Print timing information after running", | ||
| 1421 | 1421 | default=False, action="store_true") | |
| 1422 | - result.add_option("--suppress-dialogs", help="Suppress Windows dialogs for crashing tests", | ||
| 1422 | + result.add_argument("--suppress-dialogs", help="Suppress Windows dialogs for crashing tests", | ||
| 1423 | 1423 | dest="suppress_dialogs", default=True, action="store_true") | |
| 1424 | - result.add_option("--no-suppress-dialogs", help="Display Windows dialogs for crashing tests", | ||
| 1424 | + result.add_argument("--no-suppress-dialogs", help="Display Windows dialogs for crashing tests", | ||
| 1425 | 1425 | dest="suppress_dialogs", action="store_false") | |
| 1426 | - result.add_option("--shell", help="Path to node executable", default=None) | ||
| 1427 | - result.add_option("--store-unexpected-output", | ||
| 1426 | + result.add_argument("--shell", help="Path to node executable", default=None) | ||
| 1427 | + result.add_argument("--store-unexpected-output", | ||
| 1428 | 1428 | help="Store the temporary JS files from tests that fails", | |
| 1429 | 1429 | dest="store_unexpected_output", default=True, action="store_true") | |
| 1430 | - result.add_option("--no-store-unexpected-output", | ||
| 1430 | + result.add_argument("--no-store-unexpected-output", | ||
| 1431 | 1431 | help="Deletes the temporary JS files from tests that fails", | |
| 1432 | 1432 | dest="store_unexpected_output", action="store_false") | |
| 1433 | - result.add_option("-r", "--run", | ||
| 1433 | + result.add_argument("-r", "--run", | ||
| 1434 | 1434 | help="Divide the tests in m groups (interleaved) and run tests from group n (--run=n,m with n < m)", | |
| 1435 | 1435 | default="") | |
| 1436 | - result.add_option('--temp-dir', | ||
| 1436 | + result.add_argument('--temp-dir', | ||
| 1437 | 1437 | help='Optional path to change directory used for tests', default=False) | |
| 1438 | - result.add_option('--test-root', | ||
| 1438 | + result.add_argument('--test-root', | ||
| 1439 | 1439 | help='Optional path to change test directory', dest='test_root', default=None) | |
| 1440 | - result.add_option('--repeat', | ||
| 1440 | + result.add_argument('--repeat', | ||
| 1441 | 1441 | help='Number of times to repeat given tests', | |
| 1442 | - default=1, type="int") | ||
| 1443 | - result.add_option('--abort-on-timeout', | ||
| 1442 | + default=1, type=int) | ||
| 1443 | + result.add_argument('--abort-on-timeout', | ||
| 1444 | 1444 | help='Send SIGABRT instead of SIGTERM to kill processes that time out', | |
| 1445 | 1445 | default=False, action="store_true", dest="abort_on_timeout") | |
| 1446 | - result.add_option("--type", | ||
| 1446 | + result.add_argument("--type", | ||
| 1447 | 1447 | help="Type of build (simple, fips, coverage)", | |
| 1448 | 1448 | default=None) | |
| 1449 | - result.add_option("--error-reporter", | ||
| 1449 | + result.add_argument("--error-reporter", | ||
| 1450 | 1450 | help="use error reporter", | |
| 1451 | 1451 | default=True, action="store_true") | |
| 1452 | 1452 | return result | |
@@ -1625,7 +1625,7 @@ def get_pointer_compression_state(vm, context): | |||
| 1625 | 1625 | ||
| 1626 | 1626 | def Main(): | |
| 1627 | 1627 | parser = BuildOptions() | |
| 1628 | - (options, args) = parser.parse_args() | ||
| 1628 | + (options, args) = parser.parse_known_args() | ||
| 1629 | 1629 | if not ProcessOptions(options): | |
| 1630 | 1630 | parser.print_help() | |
| 1631 | 1631 | return 1 | |
| Back | FazBrowse Home | New Git URL |
0 commit comments