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

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

Issue 1939843002: Replace webkitpy standalone builders functions with instantiable class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved builders out of port, updated comment Created 4 years, 7 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 26 matching lines...) Expand all
37 import traceback 37 import traceback
38 import urllib 38 import urllib
39 import urllib2 39 import urllib2
40 40
41 from webkitpy.common.checkout.baselineoptimizer import BaselineOptimizer 41 from webkitpy.common.checkout.baselineoptimizer import BaselineOptimizer
42 from webkitpy.common.memoized import memoized 42 from webkitpy.common.memoized import memoized
43 from webkitpy.common.system.executive import ScriptError 43 from webkitpy.common.system.executive import ScriptError
44 from webkitpy.layout_tests.controllers.test_result_writer import TestResultWrite r 44 from webkitpy.layout_tests.controllers.test_result_writer import TestResultWrite r
45 from webkitpy.layout_tests.models import test_failures 45 from webkitpy.layout_tests.models import test_failures
46 from webkitpy.layout_tests.models.test_expectations import TestExpectations, BAS ELINE_SUFFIX_LIST, SKIP 46 from webkitpy.layout_tests.models.test_expectations import TestExpectations, BAS ELINE_SUFFIX_LIST, SKIP
47 from webkitpy.layout_tests.port import builders
48 from webkitpy.layout_tests.port import factory 47 from webkitpy.layout_tests.port import factory
48 from webkitpy.layout_tests.builders import Builders
49 from webkitpy.tool.multicommandtool import AbstractDeclarativeCommand 49 from webkitpy.tool.multicommandtool import AbstractDeclarativeCommand
50 50
51 51
52 _log = logging.getLogger(__name__) 52 _log = logging.getLogger(__name__)
53 53
54 54
55 # FIXME: Should TestResultWriter know how to compute this string? 55 # FIXME: Should TestResultWriter know how to compute this string?
56 def _baseline_name(fs, test_name, suffix): 56 def _baseline_name(fs, test_name, suffix):
57 return fs.splitext(test_name)[0] + TestResultWriter.FILENAME_SUFFIX_EXPECTED + "." + suffix 57 return fs.splitext(test_name)[0] + TestResultWriter.FILENAME_SUFFIX_EXPECTED + "." + suffix
58 58
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 def __init__(self): 96 def __init__(self):
97 super(BaseInternalRebaselineCommand, self).__init__(options=[ 97 super(BaseInternalRebaselineCommand, self).__init__(options=[
98 self.results_directory_option, 98 self.results_directory_option,
99 self.suffixes_option, 99 self.suffixes_option,
100 optparse.make_option("--builder", help="Builder to pull new baseline s from"), 100 optparse.make_option("--builder", help="Builder to pull new baseline s from"),
101 optparse.make_option("--test", help="Test to rebaseline"), 101 optparse.make_option("--test", help="Test to rebaseline"),
102 ]) 102 ])
103 103
104 def _baseline_directory(self, builder_name): 104 def _baseline_directory(self, builder_name):
105 port = self._tool.port_factory.get_from_builder_name(builder_name) 105 port = self._tool.port_factory.get_from_builder_name(builder_name)
106 override_dir = builders.rebaseline_override_dir(builder_name) 106 override_dir = self._tool.builders.rebaseline_override_dir(builder_name)
107 if override_dir: 107 if override_dir:
108 return self._tool.filesystem.join(port.layout_tests_dir(), 'platform ', override_dir) 108 return self._tool.filesystem.join(port.layout_tests_dir(), 'platform ', override_dir)
109 return port.baseline_version_dir() 109 return port.baseline_version_dir()
110 110
111 def _test_root(self, test_name): 111 def _test_root(self, test_name):
112 return self._tool.filesystem.splitext(test_name)[0] 112 return self._tool.filesystem.splitext(test_name)[0]
113 113
114 def _file_name_for_actual_result(self, test_name, suffix): 114 def _file_name_for_actual_result(self, test_name, suffix):
115 return "%s-actual.%s" % (self._test_root(test_name), suffix) 115 return "%s-actual.%s" % (self._test_root(test_name), suffix)
116 116
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 builder_results = builder.latest_layout_test_results() 338 builder_results = builder.latest_layout_test_results()
339 if builder_results: 339 if builder_results:
340 self._builder_data[builder_name] = builder_results 340 self._builder_data[builder_name] = builder_results
341 else: 341 else:
342 raise Exception("No result for builder %s." % builder_name) 342 raise Exception("No result for builder %s." % builder_name)
343 return self._builder_data 343 return self._builder_data
344 344
345 # The release builders cycle much faster than the debug ones and cover all t he platforms. 345 # The release builders cycle much faster than the debug ones and cover all t he platforms.
346 def _release_builders(self): 346 def _release_builders(self):
347 release_builders = [] 347 release_builders = []
348 for builder_name in builders.all_builder_names(): 348 for builder_name in self._tool.builders.all_builder_names():
349 if builder_name.find('ASAN') != -1: 349 if builder_name.find('ASAN') != -1:
350 continue 350 continue
351 port = self._tool.port_factory.get_from_builder_name(builder_name) 351 port = self._tool.port_factory.get_from_builder_name(builder_name)
352 if port.test_configuration().build_type == 'release': 352 if port.test_configuration().build_type == 'release':
353 release_builders.append(builder_name) 353 release_builders.append(builder_name)
354 return release_builders 354 return release_builders
355 355
356 def _run_webkit_patch(self, args, verbose): 356 def _run_webkit_patch(self, args, verbose):
357 try: 357 try:
358 verbose_args = ['--verbose'] if verbose else [] 358 verbose_args = ['--verbose'] if verbose else []
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 def _tests_to_rebaseline(self, port): 593 def _tests_to_rebaseline(self, port):
594 tests_to_rebaseline = {} 594 tests_to_rebaseline = {}
595 for path, value in port.expectations_dict().items(): 595 for path, value in port.expectations_dict().items():
596 expectations = TestExpectations(port, include_overrides=False, expec tations_dict={path: value}) 596 expectations = TestExpectations(port, include_overrides=False, expec tations_dict={path: value})
597 for test in expectations.get_rebaselining_failures(): 597 for test in expectations.get_rebaselining_failures():
598 suffixes = TestExpectations.suffixes_for_expectations(expectatio ns.get_expectations(test)) 598 suffixes = TestExpectations.suffixes_for_expectations(expectatio ns.get_expectations(test))
599 tests_to_rebaseline[test] = suffixes or BASELINE_SUFFIX_LIST 599 tests_to_rebaseline[test] = suffixes or BASELINE_SUFFIX_LIST
600 return tests_to_rebaseline 600 return tests_to_rebaseline
601 601
602 def _add_tests_to_rebaseline_for_port(self, port_name): 602 def _add_tests_to_rebaseline_for_port(self, port_name):
603 builder_name = builders.builder_name_for_port_name(port_name) 603 builder_name = self._tool.builders.builder_name_for_port_name(port_name)
604 if not builder_name: 604 if not builder_name:
605 return 605 return
606 tests = self._tests_to_rebaseline(self._tool.port_factory.get(port_name) ).items() 606 tests = self._tests_to_rebaseline(self._tool.port_factory.get(port_name) ).items()
607 607
608 if tests: 608 if tests:
609 _log.info("Retrieving results for %s from %s." % (port_name, builder _name)) 609 _log.info("Retrieving results for %s from %s." % (port_name, builder _name))
610 610
611 for test_name, suffixes in tests: 611 for test_name, suffixes in tests:
612 _log.info(" %s (%s)" % (test_name, ','.join(suffixes))) 612 _log.info(" %s (%s)" % (test_name, ','.join(suffixes)))
613 if test_name not in self._test_prefix_list: 613 if test_name not in self._test_prefix_list:
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 %s 799 %s
800 800
801 %sTBR=%s 801 %sTBR=%s
802 """ % (revision, self.link_to_patch(commit), bug_string, author) 802 """ % (revision, self.link_to_patch(commit), bug_string, author)
803 803
804 def get_test_prefix_list(self, tests): 804 def get_test_prefix_list(self, tests):
805 test_prefix_list = {} 805 test_prefix_list = {}
806 lines_to_remove = {} 806 lines_to_remove = {}
807 807
808 for builder_name in self._release_builders(): 808 for builder_name in self._release_builders():
809 port_name = builders.port_name_for_builder_name(builder_name) 809 port_name = self._tool.builders.port_name_for_builder_name(builder_n ame)
810 port = self._tool.port_factory.get(port_name) 810 port = self._tool.port_factory.get(port_name)
811 expectations = TestExpectations(port, include_overrides=True) 811 expectations = TestExpectations(port, include_overrides=True)
812 for test in expectations.get_needs_rebaseline_failures(): 812 for test in expectations.get_needs_rebaseline_failures():
813 if test not in tests: 813 if test not in tests:
814 continue 814 continue
815 815
816 if test not in test_prefix_list: 816 if test not in test_prefix_list:
817 lines_to_remove[test] = [] 817 lines_to_remove[test] = []
818 test_prefix_list[test] = {} 818 test_prefix_list[test] = {}
819 lines_to_remove[test].append(builder_name) 819 lines_to_remove[test].append(builder_name)
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 self._tool.scm().checkout_branch(old_branch_name_or_ref) 1020 self._tool.scm().checkout_branch(old_branch_name_or_ref)
1021 else: 1021 else:
1022 self._log_queue.put(self.QUIT_LOG) 1022 self._log_queue.put(self.QUIT_LOG)
1023 log_thread.join() 1023 log_thread.join()
1024 1024
1025 def execute(self, options, args, tool): 1025 def execute(self, options, args, tool):
1026 self._verbose = options.verbose 1026 self._verbose = options.verbose
1027 while True: 1027 while True:
1028 self._do_one_rebaseline() 1028 self._do_one_rebaseline()
1029 time.sleep(self.SLEEP_TIME_IN_SECONDS) 1029 time.sleep(self.SLEEP_TIME_IN_SECONDS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698