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

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

Issue 2165983003: Revert of Refactor the buildbot module in webkitpy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 results_directory_option = optparse.make_option("--results-directory", help= "Local results directory to use.") 89 results_directory_option = optparse.make_option("--results-directory", help= "Local results directory to use.")
90 90
91 suffixes_option = optparse.make_option("--suffixes", default=','.join(BASELI NE_SUFFIX_LIST), action="store", 91 suffixes_option = optparse.make_option("--suffixes", default=','.join(BASELI NE_SUFFIX_LIST), action="store",
92 help="Comma-separated-list of file ty pes to rebaseline.") 92 help="Comma-separated-list of file ty pes to rebaseline.")
93 93
94 def __init__(self, options=None): 94 def __init__(self, options=None):
95 super(AbstractRebaseliningCommand, self).__init__(options=options) 95 super(AbstractRebaseliningCommand, self).__init__(options=options)
96 self._baseline_suffix_list = BASELINE_SUFFIX_LIST 96 self._baseline_suffix_list = BASELINE_SUFFIX_LIST
97 self._scm_changes = {'add': [], 'delete': [], 'remove-lines': []} 97 self._scm_changes = {'add': [], 'delete': [], 'remove-lines': []}
98 98
99 def _results_url(self, builder_name, build_number=None):
100 builder = self._tool.buildbot.builder_with_name(builder_name)
101 if build_number:
102 build = builder.build(build_number)
103 return build.results_url()
104 return builder.latest_layout_test_results_url()
105
99 def _add_to_scm_later(self, path): 106 def _add_to_scm_later(self, path):
100 self._scm_changes['add'].append(path) 107 self._scm_changes['add'].append(path)
101 108
102 def _delete_from_scm_later(self, path): 109 def _delete_from_scm_later(self, path):
103 self._scm_changes['delete'].append(path) 110 self._scm_changes['delete'].append(path)
104 111
105 def _print_scm_changes(self): 112 def _print_scm_changes(self):
106 print(json.dumps(self._scm_changes)) 113 print(json.dumps(self._scm_changes))
107 114
108 115
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 port = self._tool.port_factory.get_from_builder_name(options.builder) 245 port = self._tool.port_factory.get_from_builder_name(options.builder)
239 if port.reference_files(options.test): 246 if port.reference_files(options.test):
240 if 'png' in self._baseline_suffix_list: 247 if 'png' in self._baseline_suffix_list:
241 _log.warning("Cannot rebaseline image result for reftest: %s", o ptions.test) 248 _log.warning("Cannot rebaseline image result for reftest: %s", o ptions.test)
242 return 249 return
243 assert self._baseline_suffix_list == ['txt'] 250 assert self._baseline_suffix_list == ['txt']
244 251
245 if options.results_directory: 252 if options.results_directory:
246 results_url = 'file://' + options.results_directory 253 results_url = 'file://' + options.results_directory
247 else: 254 else:
248 results_url = self._tool.buildbot.results_url(options.builder, build _number=options.build_number) 255 results_url = self._results_url(options.builder, build_number=option s.build_number)
249 256
250 for suffix in self._baseline_suffix_list: 257 for suffix in self._baseline_suffix_list:
251 self._rebaseline_test(options.builder, options.test, suffix, results _url) 258 self._rebaseline_test(options.builder, options.test, suffix, results _url)
252 self._scm_changes['remove-lines'].append({'builder': options.builder, 't est': options.test}) 259 self._scm_changes['remove-lines'].append({'builder': options.builder, 't est': options.test})
253 260
254 def execute(self, options, args, tool): 261 def execute(self, options, args, tool):
255 self._rebaseline_test_and_update_expectations(options) 262 self._rebaseline_test_and_update_expectations(options)
256 self._print_scm_changes() 263 self._print_scm_changes()
257 264
258 265
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 @memoized 316 @memoized
310 def build_data(self): 317 def build_data(self):
311 """Returns a map of Build objects to LayoutTestResult objects. 318 """Returns a map of Build objects to LayoutTestResult objects.
312 319
313 The Build objects are the latest builds for the release builders, 320 The Build objects are the latest builds for the release builders,
314 and LayoutTestResult objects for results fetched from archived layout 321 and LayoutTestResult objects for results fetched from archived layout
315 test results. 322 test results.
316 """ 323 """
317 build_to_results = {} 324 build_to_results = {}
318 for builder_name in self._release_builders(): 325 for builder_name in self._release_builders():
319 builder_results = self._tool.buildbot.accumulated_results_url_base(b uilder_name) 326 builder = self._tool.buildbot.builder_with_name(builder_name)
327 builder_results = builder.latest_layout_test_results()
320 if builder_results: 328 if builder_results:
321 build_to_results[Build(builder_name)] = builder_results 329 build_to_results[Build(builder_name)] = builder_results
322 else: 330 else:
323 raise Exception("No result for builder %s." % builder_name) 331 raise Exception("No result for builder %s." % builder_name)
324 return build_to_results 332 return build_to_results
325 333
326 # The release builders cycle much faster than the debug ones and cover all t he platforms. 334 # The release builders cycle much faster than the debug ones and cover all t he platforms.
327 def _release_builders(self): 335 def _release_builders(self):
328 release_builders = [] 336 release_builders = []
329 for builder_name in self._tool.builders.all_continuous_builder_names(): 337 for builder_name in self._tool.builders.all_continuous_builder_names():
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 super(Rebaseline, self).__init__(options=[ 686 super(Rebaseline, self).__init__(options=[
679 self.no_optimize_option, 687 self.no_optimize_option,
680 # FIXME: should we support the platform options in addition to (or i nstead of) --builders? 688 # FIXME: should we support the platform options in addition to (or i nstead of) --builders?
681 self.suffixes_option, 689 self.suffixes_option,
682 self.results_directory_option, 690 self.results_directory_option,
683 optparse.make_option("--builders", default=None, action="append", 691 optparse.make_option("--builders", default=None, action="append",
684 help="Comma-separated-list of builders to pull new baselines from (can also be provided multiple times)."), 692 help="Comma-separated-list of builders to pull new baselines from (can also be provided multiple times)."),
685 ]) 693 ])
686 694
687 def _builders_to_pull_from(self): 695 def _builders_to_pull_from(self):
688 return self._tool.user.prompt_with_list( 696 chosen_names = self._tool.user.prompt_with_list(
689 "Which builder to pull results from:", self._release_builders(), can _choose_multiple=True) 697 "Which builder to pull results from:", self._release_builders(), can _choose_multiple=True)
698 return [self._builder_with_name(name) for name in chosen_names]
699
700 def _builder_with_name(self, name):
701 return self._tool.buildbot.builder_with_name(name)
690 702
691 def execute(self, options, args, tool): 703 def execute(self, options, args, tool):
692 if not args: 704 if not args:
693 _log.error("Must list tests to rebaseline.") 705 _log.error("Must list tests to rebaseline.")
694 return 706 return
695 707
696 if options.builders: 708 if options.builders:
697 builders_to_check = [] 709 builders_to_check = []
698 for builder_names in options.builders: 710 for builder_names in options.builders:
699 builders_to_check += builder_names.split(",") 711 builders_to_check += [self._builder_with_name(name) for name in builder_names.split(",")]
700 else: 712 else:
701 builders_to_check = self._builders_to_pull_from() 713 builders_to_check = self._builders_to_pull_from()
702 714
703 test_prefix_list = {} 715 test_prefix_list = {}
704 suffixes_to_update = options.suffixes.split(",") 716 suffixes_to_update = options.suffixes.split(",")
705 717
706 for builder in builders_to_check: 718 for builder in builders_to_check:
707 for test in args: 719 for test in args:
708 if test not in test_prefix_list: 720 if test not in test_prefix_list:
709 test_prefix_list[test] = {} 721 test_prefix_list[test] = {}
710 build = Build(builder) 722 build = Build(builder.name())
711 test_prefix_list[test][build] = suffixes_to_update 723 test_prefix_list[test][build] = suffixes_to_update
712 724
713 if options.verbose: 725 if options.verbose:
714 _log.debug("rebaseline-json: " + str(test_prefix_list)) 726 _log.debug("rebaseline-json: " + str(test_prefix_list))
715 727
716 self._rebaseline(options, test_prefix_list) 728 self._rebaseline(options, test_prefix_list)
717 729
718 730
719 class AutoRebaseline(AbstractParallelRebaselineCommand): 731 class AutoRebaseline(AbstractParallelRebaselineCommand):
720 name = "auto-rebaseline" 732 name = "auto-rebaseline"
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
975 issue_already_closed = tool.executive.run_command( 987 issue_already_closed = tool.executive.run_command(
976 ['git', 'config', 'branch.%s.rietveldissue' % rebaseline _branch_name], 988 ['git', 'config', 'branch.%s.rietveldissue' % rebaseline _branch_name],
977 return_exit_code=True) 989 return_exit_code=True)
978 if not issue_already_closed: 990 if not issue_already_closed:
979 self._run_git_cl_command(options, ['set_close']) 991 self._run_git_cl_command(options, ['set_close'])
980 992
981 tool.scm().ensure_cleanly_tracking_remote_master() 993 tool.scm().ensure_cleanly_tracking_remote_master()
982 if old_branch_name_or_ref: 994 if old_branch_name_or_ref:
983 tool.scm().checkout_branch(old_branch_name_or_ref) 995 tool.scm().checkout_branch(old_branch_name_or_ref)
984 tool.scm().delete_branch(rebaseline_branch_name) 996 tool.scm().delete_branch(rebaseline_branch_name)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698