Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1277)

Side by Side Diff: build/android/test_runner.py

Issue 66373004: Android: allow a --single-step for test_runner.py perf. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nits Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « build/android/pylib/perf/test_runner.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 options.throttle, 427 options.throttle,
428 options.seed, 428 options.seed,
429 options.extra_args) 429 options.extra_args)
430 430
431 431
432 def AddPerfTestOptions(option_parser): 432 def AddPerfTestOptions(option_parser):
433 """Adds perf test options to |option_parser|.""" 433 """Adds perf test options to |option_parser|."""
434 434
435 option_parser.usage = '%prog perf [options]' 435 option_parser.usage = '%prog perf [options]'
436 option_parser.commands_dict = {} 436 option_parser.commands_dict = {}
437 option_parser.example = ('%prog perf --steps perf_steps.json') 437 option_parser.example = ('%prog perf '
438 '[--single-step command] or '
439 '[--steps perf_steps.json] or '
440 '[--print-step step]')
438 441
439 option_parser.add_option( 442 option_parser.add_option(
443 '--single-step',
444 help='Execute the given command with retries, but only print the result '
445 'for the "most successful" round.')
446 option_parser.add_option(
440 '--steps', 447 '--steps',
441 help='JSON file containing the list of perf steps to run.') 448 help='JSON file containing the list of commands to run.')
442 option_parser.add_option( 449 option_parser.add_option(
443 '--flaky-steps', 450 '--flaky-steps',
444 help=('A JSON file containing steps that are flaky ' 451 help=('A JSON file containing steps that are flaky '
445 'and will have its exit code ignored.')) 452 'and will have its exit code ignored.'))
446 option_parser.add_option( 453 option_parser.add_option(
447 '--print-step', 454 '--print-step',
448 help='The name of a previously executed perf step to print.') 455 help='The name of a previously executed perf step to print.')
449 option_parser.add_option( 456 option_parser.add_option(
450 '--no-timeout', action='store_true', 457 '--no-timeout', action='store_true',
451 help=('Do not impose a timeout. Each perf step is responsible for ' 458 help=('Do not impose a timeout. Each perf step is responsible for '
(...skipping 12 matching lines...) Expand all
464 """Processes all perf test options. 471 """Processes all perf test options.
465 472
466 Args: 473 Args:
467 options: optparse.Options object. 474 options: optparse.Options object.
468 error_func: Function to call with the error message in case of an error. 475 error_func: Function to call with the error message in case of an error.
469 476
470 Returns: 477 Returns:
471 A PerfOptions named tuple which contains all options relevant to 478 A PerfOptions named tuple which contains all options relevant to
472 perf tests. 479 perf tests.
473 """ 480 """
474 if not options.steps and not options.print_step: 481 # Only one of steps, print_step or single_step must be provided.
475 error_func('Please specify --steps or --print-step') 482 count = len(filter(None,
483 [options.steps, options.print_step, options.single_step]))
484 if count != 1:
485 error_func('Please specify one of: --steps, --print-step, --single-step.')
476 return perf_test_options.PerfOptions( 486 return perf_test_options.PerfOptions(
477 options.steps, options.flaky_steps, options.print_step, 487 options.steps, options.flaky_steps, options.print_step,
478 options.no_timeout, options.test_filter, options.dry_run) 488 options.no_timeout, options.test_filter, options.dry_run,
489 options.single_step)
479 490
480 491
481 def _RunGTests(options, error_func, devices): 492 def _RunGTests(options, error_func, devices):
482 """Subcommand of RunTestsCommands which runs gtests.""" 493 """Subcommand of RunTestsCommands which runs gtests."""
483 ProcessGTestOptions(options) 494 ProcessGTestOptions(options)
484 495
485 exit_code = 0 496 exit_code = 0
486 for suite_name in options.suite_name: 497 for suite_name in options.suite_name:
487 # TODO(gkanwar): Move this into ProcessGTestOptions once we require -s for 498 # TODO(gkanwar): Move this into ProcessGTestOptions once we require -s for
488 # the gtest command. 499 # the gtest command.
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 runner_factory, tests = perf_setup.Setup(perf_options) 637 runner_factory, tests = perf_setup.Setup(perf_options)
627 638
628 results, _ = test_dispatcher.RunTests( 639 results, _ = test_dispatcher.RunTests(
629 tests, runner_factory, devices, shard=True, test_timeout=None, 640 tests, runner_factory, devices, shard=True, test_timeout=None,
630 num_retries=options.num_retries) 641 num_retries=options.num_retries)
631 642
632 report_results.LogFull( 643 report_results.LogFull(
633 results=results, 644 results=results,
634 test_type='Perf', 645 test_type='Perf',
635 test_package='Perf') 646 test_package='Perf')
647
648 if perf_options.single_step:
649 return perf_test_runner.PrintTestOutput('single_step')
650
636 # Always return 0 on the sharding stage. Individual tests exit_code 651 # Always return 0 on the sharding stage. Individual tests exit_code
637 # will be returned on the print_step stage. 652 # will be returned on the print_step stage.
638 return 0 653 return 0
639 654
640 655
641 def _GetAttachedDevices(test_device=None): 656 def _GetAttachedDevices(test_device=None):
642 """Get all attached devices. 657 """Get all attached devices.
643 658
644 Args: 659 Args:
645 test_device: Name of a specific device to use. 660 test_device: Name of a specific device to use.
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 782
768 783
769 def main(argv): 784 def main(argv):
770 option_parser = command_option_parser.CommandOptionParser( 785 option_parser = command_option_parser.CommandOptionParser(
771 commands_dict=VALID_COMMANDS) 786 commands_dict=VALID_COMMANDS)
772 return command_option_parser.ParseAndExecute(option_parser) 787 return command_option_parser.ParseAndExecute(option_parser)
773 788
774 789
775 if __name__ == '__main__': 790 if __name__ == '__main__':
776 sys.exit(main(sys.argv)) 791 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « build/android/pylib/perf/test_runner.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698