| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright 2013 The Chromium Authors. All rights reserved. | 3 # Copyright 2013 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 """Runs all types of tests from one unified interface.""" | 7 """Runs all types of tests from one unified interface.""" |
| 8 | 8 |
| 9 import argparse | 9 import argparse |
| 10 import collections | 10 import collections |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 return parser | 77 return parser |
| 78 | 78 |
| 79 | 79 |
| 80 def AddCommandLineOptions(parser): | 80 def AddCommandLineOptions(parser): |
| 81 """Adds arguments to support passing command-line flags to the device.""" | 81 """Adds arguments to support passing command-line flags to the device.""" |
| 82 parser.add_argument( | 82 parser.add_argument( |
| 83 '--device-flags-file', | 83 '--device-flags-file', |
| 84 type=os.path.realpath, | 84 type=os.path.realpath, |
| 85 help='The relative filepath to a file containing ' | 85 help='The relative filepath to a file containing ' |
| 86 'command-line flags to set on the device') | 86 'command-line flags to set on the device') |
| 87 # TODO(jbudorick): This is deprecated. Remove once clients have switched | |
| 88 # to passing command-line flags directly. | |
| 89 parser.add_argument( | |
| 90 '-a', '--test-arguments', | |
| 91 dest='test_arguments', default='', | |
| 92 help=argparse.SUPPRESS) | |
| 93 parser.set_defaults(allow_unknown=True) | 87 parser.set_defaults(allow_unknown=True) |
| 94 parser.set_defaults(command_line_flags=None) | 88 parser.set_defaults(command_line_flags=None) |
| 95 | 89 |
| 96 | 90 |
| 97 def AddTracingOptions(parser): | 91 def AddTracingOptions(parser): |
| 98 # TODO(shenghuazhang): Move this into AddCommonOptions once it's supported | 92 # TODO(shenghuazhang): Move this into AddCommonOptions once it's supported |
| 99 # for all test types. | 93 # for all test types. |
| 100 parser.add_argument( | 94 parser.add_argument( |
| 101 '--trace-output', | 95 '--trace-output', |
| 102 metavar='FILENAME', type=os.path.realpath, | 96 metavar='FILENAME', type=os.path.realpath, |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 '--test-apk', | 414 '--test-apk', |
| 421 required=True, | 415 required=True, |
| 422 help='Path or name of the apk containing the tests.') | 416 help='Path or name of the apk containing the tests.') |
| 423 parser.add_argument( | 417 parser.add_argument( |
| 424 '--test-jar', | 418 '--test-jar', |
| 425 help='Path of jar containing test java files.') | 419 help='Path of jar containing test java files.') |
| 426 parser.add_argument( | 420 parser.add_argument( |
| 427 '--timeout-scale', | 421 '--timeout-scale', |
| 428 type=float, | 422 type=float, |
| 429 help='Factor by which timeouts should be scaled.') | 423 help='Factor by which timeouts should be scaled.') |
| 430 parser.add_argument( | |
| 431 '-w', '--wait_debugger', | |
| 432 action='store_true', dest='wait_for_debugger', | |
| 433 help='Wait for debugger.') | |
| 434 | 424 |
| 435 # These arguments are suppressed from the help text because they should | 425 # These arguments are suppressed from the help text because they should |
| 436 # only ever be specified by an intermediate script. | 426 # only ever be specified by an intermediate script. |
| 437 parser.add_argument( | 427 parser.add_argument( |
| 438 '--apk-under-test-incremental-install-script', | 428 '--apk-under-test-incremental-install-script', |
| 439 help=argparse.SUPPRESS) | 429 help=argparse.SUPPRESS) |
| 440 parser.add_argument( | 430 parser.add_argument( |
| 441 '--test-apk-incremental-install-script', | 431 '--test-apk-incremental-install-script', |
| 442 type=os.path.realpath, | 432 type=os.path.realpath, |
| 443 help=argparse.SUPPRESS) | 433 help=argparse.SUPPRESS) |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 916 if e.is_infra_error: | 906 if e.is_infra_error: |
| 917 return constants.INFRA_EXIT_CODE | 907 return constants.INFRA_EXIT_CODE |
| 918 return constants.ERROR_EXIT_CODE | 908 return constants.ERROR_EXIT_CODE |
| 919 except: # pylint: disable=W0702 | 909 except: # pylint: disable=W0702 |
| 920 logging.exception('Unrecognized error occurred.') | 910 logging.exception('Unrecognized error occurred.') |
| 921 return constants.ERROR_EXIT_CODE | 911 return constants.ERROR_EXIT_CODE |
| 922 | 912 |
| 923 | 913 |
| 924 if __name__ == '__main__': | 914 if __name__ == '__main__': |
| 925 sys.exit(main()) | 915 sys.exit(main()) |
| OLD | NEW |