| 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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 '--test-apk', | 418 '--test-apk', |
| 425 required=True, | 419 required=True, |
| 426 help='Path or name of the apk containing the tests.') | 420 help='Path or name of the apk containing the tests.') |
| 427 parser.add_argument( | 421 parser.add_argument( |
| 428 '--test-jar', | 422 '--test-jar', |
| 429 help='Path of jar containing test java files.') | 423 help='Path of jar containing test java files.') |
| 430 parser.add_argument( | 424 parser.add_argument( |
| 431 '--timeout-scale', | 425 '--timeout-scale', |
| 432 type=float, | 426 type=float, |
| 433 help='Factor by which timeouts should be scaled.') | 427 help='Factor by which timeouts should be scaled.') |
| 434 parser.add_argument( | |
| 435 '-w', '--wait_debugger', | |
| 436 action='store_true', dest='wait_for_debugger', | |
| 437 help='Wait for debugger.') | |
| 438 | 428 |
| 439 # These arguments are suppressed from the help text because they should | 429 # These arguments are suppressed from the help text because they should |
| 440 # only ever be specified by an intermediate script. | 430 # only ever be specified by an intermediate script. |
| 441 parser.add_argument( | 431 parser.add_argument( |
| 442 '--apk-under-test-incremental-install-script', | 432 '--apk-under-test-incremental-install-script', |
| 443 help=argparse.SUPPRESS) | 433 help=argparse.SUPPRESS) |
| 444 parser.add_argument( | 434 parser.add_argument( |
| 445 '--test-apk-incremental-install-script', | 435 '--test-apk-incremental-install-script', |
| 446 type=os.path.realpath, | 436 type=os.path.realpath, |
| 447 help=argparse.SUPPRESS) | 437 help=argparse.SUPPRESS) |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 920 if e.is_infra_error: | 910 if e.is_infra_error: |
| 921 return constants.INFRA_EXIT_CODE | 911 return constants.INFRA_EXIT_CODE |
| 922 return constants.ERROR_EXIT_CODE | 912 return constants.ERROR_EXIT_CODE |
| 923 except: # pylint: disable=W0702 | 913 except: # pylint: disable=W0702 |
| 924 logging.exception('Unrecognized error occurred.') | 914 logging.exception('Unrecognized error occurred.') |
| 925 return constants.ERROR_EXIT_CODE | 915 return constants.ERROR_EXIT_CODE |
| 926 | 916 |
| 927 | 917 |
| 928 if __name__ == '__main__': | 918 if __name__ == '__main__': |
| 929 sys.exit(main()) | 919 sys.exit(main()) |
| OLD | NEW |