summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Alex Light <allight@google.com> 2017-02-21 09:52:34 -0800
committer Alex Light <allight@google.com> 2017-02-21 10:31:25 -0800
commit7a1ccf86116c77e54c75d4b82e465890f7bbc5d4 (patch)
tree7c9a0323c1e15c881e74c343fc63a79647beb4c5
parentbc319b26f7c5d06dbf841fa4bfedccecc6157ccc (diff)
Move testrunner.py to argparse
Optparse has been deprecated. Test: ./test/testrunner/testrunner.py --help Test: ./test/testrunner/testrunner.py --host -j40 Change-Id: I3b93b79e4ed2975ea5d5612435e42174ca3e9ade
-rwxr-xr-xtest/testrunner/testrunner.py28
1 files changed, 14 insertions, 14 deletions
diff --git a/test/testrunner/testrunner.py b/test/testrunner/testrunner.py
index a91607e56b..319a58f1ff 100755
--- a/test/testrunner/testrunner.py
+++ b/test/testrunner/testrunner.py
@@ -44,10 +44,10 @@ For eg, for compiler type as optimizing, use --optimizing.
In the end, the script will print the failed and skipped tests if any.
"""
+import argparse
import fnmatch
import itertools
import json
-from optparse import OptionParser
import os
import re
import subprocess
@@ -722,24 +722,24 @@ def parse_option():
global gdb
global gdb_arg
- parser = OptionParser()
- parser.add_option('-t', '--test', dest='test', help='name of the test')
- parser.add_option('-j', type='int', dest='n_thread')
+ parser = argparse.ArgumentParser(description="Runs all or a subset of the ART test suite.")
+ parser.add_argument('-t', '--test', dest='test', help='name of the test')
+ parser.add_argument('-j', type=int, dest='n_thread')
for variant in TOTAL_VARIANTS_SET:
flag = '--' + variant
flag_dest = variant.replace('-', '_')
if variant == '32' or variant == '64':
flag_dest = 'n' + flag_dest
- parser.add_option(flag, action='store_true', dest=flag_dest)
- parser.add_option('--verbose', '-v', action='store_true', dest='verbose')
- parser.add_option('--dry-run', action='store_true', dest='dry_run')
- parser.add_option("--skip", action="append", dest="skips", default=[],
- help="Skip the given test in all circumstances.")
- parser.add_option('-b', '--build-dependencies', action='store_true', dest='build')
- parser.add_option('--gdb', action='store_true', dest='gdb')
- parser.add_option('--gdb-arg', dest='gdb_arg')
-
- options = parser.parse_args()[0]
+ parser.add_argument(flag, action='store_true', dest=flag_dest)
+ parser.add_argument('--verbose', '-v', action='store_true', dest='verbose')
+ parser.add_argument('--dry-run', action='store_true', dest='dry_run')
+ parser.add_argument("--skip", action="append", dest="skips", default=[],
+ help="Skip the given test in all circumstances.")
+ parser.add_argument('-b', '--build-dependencies', action='store_true', dest='build')
+ parser.add_argument('--gdb', action='store_true', dest='gdb')
+ parser.add_argument('--gdb-arg', dest='gdb_arg')
+
+ options = parser.parse_args()
test = ''
env.EXTRA_DISABLED_TESTS.update(set(options.skips))
if options.test: