Chromium Code Reviews| Index: native_client_sdk/src/build_tools/test_projects.py |
| diff --git a/native_client_sdk/src/build_tools/test_projects.py b/native_client_sdk/src/build_tools/test_projects.py |
| index 703a33a41af93070891663ab6323895d916fb6ab..c0d76cca86a5a52e916a21e254422d6976811368 100755 |
| --- a/native_client_sdk/src/build_tools/test_projects.py |
| +++ b/native_client_sdk/src/build_tools/test_projects.py |
| @@ -3,7 +3,7 @@ |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| -import optparse |
| +import argparse |
| import os |
| import subprocess |
| import sys |
| @@ -309,25 +309,26 @@ def GetProjectTree(include): |
| def main(args): |
| - parser = optparse.OptionParser() |
| - parser.add_option('-c', '--config', |
| + parser = argparse.ArgumentParser(description=__doc__) |
| + parser.add_argument('-c', '--config', |
| help='Choose configuration to run (Debug or Release). Runs both ' |
| 'by default', action='append') |
| - parser.add_option('-x', '--experimental', |
| + parser.add_argument('-x', '--experimental', |
| help='Run experimental projects', action='store_true') |
| - parser.add_option('-t', '--toolchain', |
| + parser.add_argument('-t', '--toolchain', |
| help='Run using toolchain. Can be passed more than once.', |
| action='append', default=[]) |
| - parser.add_option('-d', '--dest', |
| + parser.add_argument('-d', '--dest', |
| help='Select which destinations (project types) are valid.', |
| action='append') |
| - parser.add_option('-b', '--build', |
| + parser.add_argument('-b', '--build', |
| help='Build each project before testing.', action='store_true') |
| - parser.add_option('--retry-times', |
| + parser.add_argument('--retry-times', |
| help='Number of types to retry on failure (Default: %default)', |
| - type='int', default=1) |
| + type='int', default=1) |
| + parser.add_argument('projects') |
|
binji
2014/11/13 23:57:02
nargs='*'
Sam Clegg
2014/11/30 17:55:11
Done.
|
| - options, args = parser.parse_args(args[1:]) |
| + options = parser.parse_args(args) |
| if not options.toolchain: |
| options.toolchain = ['newlib', 'glibc', 'pnacl', 'host'] |
| @@ -348,9 +349,9 @@ def main(args): |
| if options.dest: |
| include['DEST'] = options.dest |
| print 'Filter by type: ' + str(options.dest) |
| - if args: |
| - include['NAME'] = args |
| - print 'Filter by name: ' + str(args) |
| + if options.projects: |
| + include['NAME'] = options.projects |
| + print 'Filter by name: ' + str(options.projects) |
| if not options.config: |
| options.config = ALL_CONFIGS |
| @@ -365,7 +366,7 @@ def main(args): |
| if __name__ == '__main__': |
| script_name = os.path.basename(sys.argv[0]) |
| try: |
| - sys.exit(main(sys.argv)) |
| + sys.exit(main(sys.argv[1:])) |
| except parse_dsc.ValidationError as e: |
| buildbot_common.ErrorExit('%s: %s' % (script_name, e)) |
| except KeyboardInterrupt: |