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 collections | 9 import collections |
10 import logging | 10 import logging |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 help='Execute the given command with retries, but only print the result ' | 446 help='Execute the given command with retries, but only print the result ' |
447 'for the "most successful" round.') | 447 'for the "most successful" round.') |
448 option_parser.add_option( | 448 option_parser.add_option( |
449 '--steps', | 449 '--steps', |
450 help='JSON file containing the list of commands to run.') | 450 help='JSON file containing the list of commands to run.') |
451 option_parser.add_option( | 451 option_parser.add_option( |
452 '--flaky-steps', | 452 '--flaky-steps', |
453 help=('A JSON file containing steps that are flaky ' | 453 help=('A JSON file containing steps that are flaky ' |
454 'and will have its exit code ignored.')) | 454 'and will have its exit code ignored.')) |
455 option_parser.add_option( | 455 option_parser.add_option( |
| 456 '--output-json-list', |
| 457 help='Write a simple list of names from --steps into the given file.') |
| 458 option_parser.add_option( |
456 '--print-step', | 459 '--print-step', |
457 help='The name of a previously executed perf step to print.') | 460 help='The name of a previously executed perf step to print.') |
458 option_parser.add_option( | 461 option_parser.add_option( |
459 '--no-timeout', action='store_true', | 462 '--no-timeout', action='store_true', |
460 help=('Do not impose a timeout. Each perf step is responsible for ' | 463 help=('Do not impose a timeout. Each perf step is responsible for ' |
461 'implementing the timeout logic.')) | 464 'implementing the timeout logic.')) |
462 option_parser.add_option( | 465 option_parser.add_option( |
463 '-f', '--test-filter', | 466 '-f', '--test-filter', |
464 help=('Test filter (will match against the names listed in --steps).')) | 467 help=('Test filter (will match against the names listed in --steps).')) |
465 option_parser.add_option( | 468 option_parser.add_option( |
(...skipping 16 matching lines...) Expand all Loading... |
482 """ | 485 """ |
483 # Only one of steps, print_step or single_step must be provided. | 486 # Only one of steps, print_step or single_step must be provided. |
484 count = len(filter(None, | 487 count = len(filter(None, |
485 [options.steps, options.print_step, options.single_step])) | 488 [options.steps, options.print_step, options.single_step])) |
486 if count != 1: | 489 if count != 1: |
487 error_func('Please specify one of: --steps, --print-step, --single-step.') | 490 error_func('Please specify one of: --steps, --print-step, --single-step.') |
488 single_step = None | 491 single_step = None |
489 if options.single_step: | 492 if options.single_step: |
490 single_step = ' '.join(args[2:]) | 493 single_step = ' '.join(args[2:]) |
491 return perf_test_options.PerfOptions( | 494 return perf_test_options.PerfOptions( |
492 options.steps, options.flaky_steps, options.print_step, | 495 options.steps, options.flaky_steps, options.output_json_list, |
493 options.no_timeout, options.test_filter, options.dry_run, | 496 options.print_step, options.no_timeout, options.test_filter, |
494 single_step) | 497 options.dry_run, single_step) |
495 | 498 |
496 | 499 |
497 def _RunGTests(options, devices): | 500 def _RunGTests(options, devices): |
498 """Subcommand of RunTestsCommands which runs gtests.""" | 501 """Subcommand of RunTestsCommands which runs gtests.""" |
499 ProcessGTestOptions(options) | 502 ProcessGTestOptions(options) |
500 | 503 |
501 exit_code = 0 | 504 exit_code = 0 |
502 for suite_name in options.suite_name: | 505 for suite_name in options.suite_name: |
503 # TODO(gkanwar): Move this into ProcessGTestOptions once we require -s for | 506 # TODO(gkanwar): Move this into ProcessGTestOptions once we require -s for |
504 # the gtest command. | 507 # the gtest command. |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 results=results, | 632 results=results, |
630 test_type='Monkey', | 633 test_type='Monkey', |
631 test_package='Monkey') | 634 test_package='Monkey') |
632 | 635 |
633 return exit_code | 636 return exit_code |
634 | 637 |
635 | 638 |
636 def _RunPerfTests(options, args, error_func): | 639 def _RunPerfTests(options, args, error_func): |
637 """Subcommand of RunTestsCommands which runs perf tests.""" | 640 """Subcommand of RunTestsCommands which runs perf tests.""" |
638 perf_options = ProcessPerfTestOptions(options, args, error_func) | 641 perf_options = ProcessPerfTestOptions(options, args, error_func) |
| 642 |
| 643 # Just save a simple json with a list of test names. |
| 644 if perf_options.output_json_list: |
| 645 return perf_test_runner.OutputJsonList( |
| 646 perf_options.steps, perf_options.output_json_list) |
| 647 |
639 # Just print the results from a single previously executed step. | 648 # Just print the results from a single previously executed step. |
640 if perf_options.print_step: | 649 if perf_options.print_step: |
641 return perf_test_runner.PrintTestOutput(perf_options.print_step) | 650 return perf_test_runner.PrintTestOutput(perf_options.print_step) |
642 | 651 |
643 runner_factory, tests, devices = perf_setup.Setup(perf_options) | 652 runner_factory, tests, devices = perf_setup.Setup(perf_options) |
644 | 653 |
645 # shard=False means that each device will get the full list of tests | 654 # shard=False means that each device will get the full list of tests |
646 # and then each one will decide their own affinity. | 655 # and then each one will decide their own affinity. |
647 # shard=True means each device will pop the next test available from a queue, | 656 # shard=True means each device will pop the next test available from a queue, |
648 # which increases throughput but have no affinity. | 657 # which increases throughput but have no affinity. |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 | 818 |
810 def main(): | 819 def main(): |
811 signal.signal(signal.SIGUSR1, DumpThreadStacks) | 820 signal.signal(signal.SIGUSR1, DumpThreadStacks) |
812 option_parser = command_option_parser.CommandOptionParser( | 821 option_parser = command_option_parser.CommandOptionParser( |
813 commands_dict=VALID_COMMANDS) | 822 commands_dict=VALID_COMMANDS) |
814 return command_option_parser.ParseAndExecute(option_parser) | 823 return command_option_parser.ParseAndExecute(option_parser) |
815 | 824 |
816 | 825 |
817 if __name__ == '__main__': | 826 if __name__ == '__main__': |
818 sys.exit(main()) | 827 sys.exit(main()) |
OLD | NEW |