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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py

Issue 2398733002: Make the AbstractParallelRebaselineCommand rebaseline function public/non-protected. (Closed)
Patch Set: Rebased Created 4 years, 2 months 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
OLDNEW
1 # Copyright (c) 2010 Google Inc. All rights reserved. 1 # Copyright (c) 2010 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 return {} 492 return {}
493 493
494 command_results = self._tool.executive.run_in_parallel(commands) 494 command_results = self._tool.executive.run_in_parallel(commands)
495 for _, _, stderr in command_results: 495 for _, _, stderr in command_results:
496 if stderr: 496 if stderr:
497 _log.error(stderr) 497 _log.error(stderr)
498 498
499 change_set = self._extract_scm_changes(command_results) 499 change_set = self._extract_scm_changes(command_results)
500 500
501 # TODO(qyearsley): Instead of updating the SCM state here, aggregate cha nges 501 # TODO(qyearsley): Instead of updating the SCM state here, aggregate cha nges
502 # and update once in _rebaseline. See http://crbug.com/639410. 502 # and update once in rebaseline. See http://crbug.com/639410.
503 if update_scm: 503 if update_scm:
504 if change_set.files_to_delete: 504 if change_set.files_to_delete:
505 self._tool.scm().delete_list(change_set.files_to_delete) 505 self._tool.scm().delete_list(change_set.files_to_delete)
506 if change_set.files_to_add: 506 if change_set.files_to_add:
507 self._tool.scm().add_list(change_set.files_to_add) 507 self._tool.scm().add_list(change_set.files_to_add)
508 508
509 return change_set.lines_to_remove 509 return change_set.lines_to_remove
510 510
511 def _rebaseline(self, options, test_prefix_list, update_scm=True): 511 def rebaseline(self, options, test_prefix_list, update_scm=True):
512 """Downloads new baselines in parallel, then updates expectations files 512 """Downloads new baselines in parallel, then updates expectations files
513 and optimizes baselines. 513 and optimizes baselines.
514 514
515 Args: 515 Args:
516 options: An object with the options passed to the current command. 516 options: An object with the options passed to the current command.
517 test_prefix_list: A map of test names to Build objects to file suffi xes 517 test_prefix_list: A map of test names to Build objects to file suffi xes
518 for new baselines. For example: 518 for new baselines. For example:
519 { 519 {
520 "some/test.html": {Build("builder-1", 412): ["txt"], Build(" builder-2", 100): ["txt"]}, 520 "some/test.html": {Build("builder-1", 412): ["txt"], Build(" builder-2", 100): ["txt"]},
521 "some/other.html": {Build("builder-1", 412): ["txt"]} 521 "some/other.html": {Build("builder-1", 412): ["txt"]}
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 help_text = "Rebaseline based off JSON passed to stdin. Intended to only be called from other scripts." 582 help_text = "Rebaseline based off JSON passed to stdin. Intended to only be called from other scripts."
583 583
584 def __init__(self,): 584 def __init__(self,):
585 super(RebaselineJson, self).__init__(options=[ 585 super(RebaselineJson, self).__init__(options=[
586 self.no_optimize_option, 586 self.no_optimize_option,
587 self.results_directory_option, 587 self.results_directory_option,
588 ]) 588 ])
589 589
590 def execute(self, options, args, tool): 590 def execute(self, options, args, tool):
591 self._tool = tool 591 self._tool = tool
592 self._rebaseline(options, json.loads(sys.stdin.read())) 592 self.rebaseline(options, json.loads(sys.stdin.read()))
593 593
594 594
595 class RebaselineExpectations(AbstractParallelRebaselineCommand): 595 class RebaselineExpectations(AbstractParallelRebaselineCommand):
596 name = "rebaseline-expectations" 596 name = "rebaseline-expectations"
597 help_text = "Rebaselines the tests indicated in TestExpectations." 597 help_text = "Rebaselines the tests indicated in TestExpectations."
598 show_in_main_help = True 598 show_in_main_help = True
599 599
600 def __init__(self): 600 def __init__(self):
601 super(RebaselineExpectations, self).__init__(options=[ 601 super(RebaselineExpectations, self).__init__(options=[
602 self.no_optimize_option, 602 self.no_optimize_option,
(...skipping 29 matching lines...) Expand all
632 self._tool = tool 632 self._tool = tool
633 options.results_directory = None 633 options.results_directory = None
634 self._test_prefix_list = {} 634 self._test_prefix_list = {}
635 port_names = tool.port_factory.all_port_names(options.platform) 635 port_names = tool.port_factory.all_port_names(options.platform)
636 for port_name in port_names: 636 for port_name in port_names:
637 self._add_tests_to_rebaseline(port_name) 637 self._add_tests_to_rebaseline(port_name)
638 if not self._test_prefix_list: 638 if not self._test_prefix_list:
639 _log.warning("Did not find any tests marked Rebaseline.") 639 _log.warning("Did not find any tests marked Rebaseline.")
640 return 640 return
641 641
642 self._rebaseline(options, self._test_prefix_list) 642 self.rebaseline(options, self._test_prefix_list)
643 643
644 644
645 class Rebaseline(AbstractParallelRebaselineCommand): 645 class Rebaseline(AbstractParallelRebaselineCommand):
646 name = "rebaseline" 646 name = "rebaseline"
647 help_text = "Rebaseline tests with results from the build bots." 647 help_text = "Rebaseline tests with results from the build bots."
648 show_in_main_help = True 648 show_in_main_help = True
649 argument_names = "[TEST_NAMES]" 649 argument_names = "[TEST_NAMES]"
650 650
651 def __init__(self): 651 def __init__(self):
652 super(Rebaseline, self).__init__(options=[ 652 super(Rebaseline, self).__init__(options=[
(...skipping 29 matching lines...) Expand all
682 for builder in builders_to_check: 682 for builder in builders_to_check:
683 for test in args: 683 for test in args:
684 if test not in test_prefix_list: 684 if test not in test_prefix_list:
685 test_prefix_list[test] = {} 685 test_prefix_list[test] = {}
686 build = Build(builder) 686 build = Build(builder)
687 test_prefix_list[test][build] = suffixes_to_update 687 test_prefix_list[test][build] = suffixes_to_update
688 688
689 if options.verbose: 689 if options.verbose:
690 _log.debug("rebaseline-json: " + str(test_prefix_list)) 690 _log.debug("rebaseline-json: " + str(test_prefix_list))
691 691
692 self._rebaseline(options, test_prefix_list) 692 self.rebaseline(options, test_prefix_list)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698