Changeset 100231 in webkit
- Timestamp:
- Nov 14, 2011, 6:33:51 PM (15 years ago)
- Location:
- trunk/Tools
- Files:
-
- 3 edited
-
ChangeLog (modified) (1 diff)
-
Scripts/webkitpy/style/checkers/test_expectations.py (modified) (3 diffs)
-
Scripts/webkitpy/style/checkers/test_expectations_unittest.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r100226 r100231 1 2011-11-14 Eric Seidel <eric@webkit.org> 2 3 check-webkit-style broken by r99773: "Could not determine the port" 4 https://bugs.webkit.org/show_bug.cgi?id=72275 5 6 Reviewed by Adam Barth. 7 8 The TestExpectationsChecker was using a generic try/except block 9 which caught all exceptions, so we didn't notice that failing 10 to pass a Host to PortFactory was causing an exception in port instantiation. 11 I've factored out the "lookup the port" logic into a separate function 12 which I've now unittested. This should fix the bug and prevent 13 others like it from occuring the the future. 14 15 * Scripts/webkitpy/style/checkers/test_expectations.py: 16 * Scripts/webkitpy/style/checkers/test_expectations_unittest.py: 17 1 18 2011-11-14 Julien Chaffraix <jchaffraix@webkit.org> 2 19 -
trunk/Tools/Scripts/webkitpy/style/checkers/test_expectations.py
r99271 r100231 35 35 36 36 from common import TabChecker 37 from webkitpy. layout_tests.port.factory import PortFactory37 from webkitpy.common.host import Host 38 38 from webkitpy.layout_tests.models import test_expectations 39 39 … … 53 53 categories = set(['test/expectations']) 54 54 55 def _determine_port_from_exepectations_path(self, host, expectations_path): 56 try: 57 # I believe what this is trying to do is "when the port name is chromium, 58 # get the chromium-port for this platform". Unclear why that's needed?? 59 port_name = expectations_path.split(host.filesystem.sep)[-2] 60 if port_name == "chromium": 61 return host.port_factory.get(options=ChromiumOptions()) 62 # Passing port_name=None to the factory would just return the current port, which isn't what we want, I don't think. 63 if not port_name: 64 return None 65 return host.port_factory.get(port_name) 66 except Exception, e: 67 _log.warn("Exception while getting port for path %s" % expectations_path) 68 return None 69 55 70 def __init__(self, file_path, handle_style_error): 56 71 self._file_path = file_path … … 60 75 self._output_regex = re.compile('Line:(?P<line>\d+)\s*(?P<message>.+)') 61 76 62 # FIXME: This should get the PortFactory from a Host object! 63 port_factory = PortFactory() 77 # FIXME: A host should be passed to the constructor instead! 78 host = Host() 79 host._initialize_scm() 64 80 65 81 # Determining the port of this expectations. 66 try: 67 port_name = self._file_path.split(os.sep)[-2] 68 if port_name == "chromium": 69 self._port_obj = port_factory.get(options=ChromiumOptions()) 70 else: 71 self._port_obj = port_factory.get(port_name) 72 except: 73 # Using 'test' port when we couldn't determine the port for this 74 # expectations. 82 self._port_obj = self._determine_port_from_exepectations_path(host, file_path) 83 # Using 'test' port when we couldn't determine the port for this 84 # expectations. 85 if not self._port_obj: 75 86 _log.warn("Could not determine the port for %s. " 76 87 "Using 'test' port, but platform-specific expectations " 77 88 "will fail the check." % self._file_path) 78 self._port_obj = port_factory.get('test') 79 # Suppress error messages of test_expectations module since they will be 80 # reported later. 89 self._port_obj = host.port_factory.get('test') 90 # Suppress error messages of test_expectations module since they will be reported later. 81 91 log = logging.getLogger("webkitpy.layout_tests.layout_package.test_expectations") 82 92 log.setLevel(logging.CRITICAL) -
trunk/Tools/Scripts/webkitpy/style/checkers/test_expectations_unittest.py
r99233 r100231 33 33 34 34 from test_expectations import TestExpectationsChecker 35 from webkitpy. layout_tests import port35 from webkitpy.common.host_mock import MockHost 36 36 37 37 … … 64 64 self._test_file = 'passes/text.html' 65 65 66 def process_expectations(self, expectations, overrides=None): 67 self._checker = TestExpectationsChecker() 66 def _expect_port_for_expectations_path(self, expected_port_or_port_class, expectations_path): 67 host = MockHost() 68 checker = TestExpectationsChecker(expectations_path, ErrorCollector()) 69 port = checker._determine_port_from_exepectations_path(host, expectations_path) 70 if port: 71 self.assertEquals(port.__class__.__name__, expected_port_or_port_class) 72 else: 73 self.assertEquals(port, expected_port_or_port_class) 74 75 def test_determine_port_from_exepectations_path(self): 76 self._expect_port_for_expectations_path(None, "/") 77 self._expect_port_for_expectations_path("ChromiumMacPort", "/mock-checkout/LayoutTests/chromium-mac/test_expectations.txt") 68 78 69 79 def assert_lines_lint(self, lines, expected):
Note:
See TracChangeset
for help on using the changeset viewer.