| 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 588 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 599   group.add_argument( | 599   group.add_argument( | 
| 600       '--no-timeout', action='store_true', | 600       '--no-timeout', action='store_true', | 
| 601       help=('Do not impose a timeout. Each perf step is responsible for ' | 601       help=('Do not impose a timeout. Each perf step is responsible for ' | 
| 602             'implementing the timeout logic.')) | 602             'implementing the timeout logic.')) | 
| 603   group.add_argument( | 603   group.add_argument( | 
| 604       '-f', '--test-filter', | 604       '-f', '--test-filter', | 
| 605       help=('Test filter (will match against the names listed in --steps).')) | 605       help=('Test filter (will match against the names listed in --steps).')) | 
| 606   group.add_argument( | 606   group.add_argument( | 
| 607       '--dry-run', action='store_true', | 607       '--dry-run', action='store_true', | 
| 608       help='Just print the steps without executing.') | 608       help='Just print the steps without executing.') | 
|  | 609   # Uses 0.1 degrees C because that's what Android does. | 
|  | 610   group.add_argument( | 
|  | 611       '--max-battery-temp', type=int, | 
|  | 612       help='Only start tests when the battery is at or below the given ' | 
|  | 613            'temperature (0.1 C)') | 
| 609   group.add_argument('single_step_command', nargs='*', action=SingleStepAction, | 614   group.add_argument('single_step_command', nargs='*', action=SingleStepAction, | 
| 610                      help='If --single-step is specified, the command to run.') | 615                      help='If --single-step is specified, the command to run.') | 
| 611   AddCommonOptions(parser) | 616   AddCommonOptions(parser) | 
| 612   AddDeviceOptions(parser) | 617   AddDeviceOptions(parser) | 
| 613 | 618 | 
| 614 | 619 | 
| 615 def ProcessPerfTestOptions(args): | 620 def ProcessPerfTestOptions(args): | 
| 616   """Processes all perf test options. | 621   """Processes all perf test options. | 
| 617 | 622 | 
| 618   Args: | 623   Args: | 
| 619     args: argparse.Namespace object. | 624     args: argparse.Namespace object. | 
| 620 | 625 | 
| 621   Returns: | 626   Returns: | 
| 622     A PerfOptions named tuple which contains all options relevant to | 627     A PerfOptions named tuple which contains all options relevant to | 
| 623     perf tests. | 628     perf tests. | 
| 624   """ | 629   """ | 
| 625   # TODO(jbudorick): Move single_step handling down into the perf tests. | 630   # TODO(jbudorick): Move single_step handling down into the perf tests. | 
| 626   if args.single_step: | 631   if args.single_step: | 
| 627     args.single_step = ' '.join(args.single_step_command) | 632     args.single_step = ' '.join(args.single_step_command) | 
| 628   # TODO(jbudorick): Get rid of PerfOptions. | 633   # TODO(jbudorick): Get rid of PerfOptions. | 
| 629   return perf_test_options.PerfOptions( | 634   return perf_test_options.PerfOptions( | 
| 630       args.steps, args.flaky_steps, args.output_json_list, | 635       args.steps, args.flaky_steps, args.output_json_list, | 
| 631       args.print_step, args.no_timeout, args.test_filter, | 636       args.print_step, args.no_timeout, args.test_filter, | 
| 632       args.dry_run, args.single_step, args.collect_chartjson_data, | 637       args.dry_run, args.single_step, args.collect_chartjson_data, | 
| 633       args.output_chartjson_data) | 638       args.output_chartjson_data, args.max_battery_temp) | 
| 634 | 639 | 
| 635 | 640 | 
| 636 def AddPythonTestOptions(parser): | 641 def AddPythonTestOptions(parser): | 
| 637   group = parser.add_argument_group('Python Test Options') | 642   group = parser.add_argument_group('Python Test Options') | 
| 638   group.add_argument( | 643   group.add_argument( | 
| 639       '-s', '--suite', dest='suite_name', metavar='SUITE_NAME', | 644       '-s', '--suite', dest='suite_name', metavar='SUITE_NAME', | 
| 640       choices=constants.PYTHON_UNIT_TEST_SUITES.keys(), | 645       choices=constants.PYTHON_UNIT_TEST_SUITES.keys(), | 
| 641       help='Name of the test suite to run.') | 646       help='Name of the test suite to run.') | 
| 642   AddCommonOptions(parser) | 647   AddCommonOptions(parser) | 
| 643 | 648 | 
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1047     if e.is_infra_error: | 1052     if e.is_infra_error: | 
| 1048       return constants.INFRA_EXIT_CODE | 1053       return constants.INFRA_EXIT_CODE | 
| 1049     return constants.ERROR_EXIT_CODE | 1054     return constants.ERROR_EXIT_CODE | 
| 1050   except: # pylint: disable=W0702 | 1055   except: # pylint: disable=W0702 | 
| 1051     logging.exception('Unrecognized error occurred.') | 1056     logging.exception('Unrecognized error occurred.') | 
| 1052     return constants.ERROR_EXIT_CODE | 1057     return constants.ERROR_EXIT_CODE | 
| 1053 | 1058 | 
| 1054 | 1059 | 
| 1055 if __name__ == '__main__': | 1060 if __name__ == '__main__': | 
| 1056   sys.exit(main()) | 1061   sys.exit(main()) | 
| OLD | NEW | 
|---|