Changeset 107124 in webkit
- Timestamp:
- Feb 8, 2012 1:02:53 PM (12 years ago)
- Location:
- trunk/Tools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r107113 r107124 1 2012-02-08 Dirk Pranke <dpranke@chromium.org> 2 3 check-webkit-style failing with "Path does not exist." 4 https://bugs.webkit.org/show_bug.cgi?id=77873 5 6 Reviewed by Ojan Vafai. 7 8 This change fixes the way the style checker determines which 9 Port class to use for a given test_expectations.txt path; the 10 previous version used a heuristic that didn't really work in the 11 first place. 12 13 * Scripts/webkitpy/style/checkers/test_expectations.py: 14 (TestExpectationsChecker._determine_port_from_expectations_path): 15 (TestExpectationsChecker.__init__): 16 * Scripts/webkitpy/style/checkers/test_expectations_unittest.py: 17 (TestExpectationsTestCase._expect_port_for_expectations_path): 18 (TestExpectationsTestCase.test_determine_port_from_expectations_path): 19 1 20 2012-02-08 Fehér Zsolt <feherzs@inf.u-szeged.hu> 2 21 -
trunk/Tools/Scripts/webkitpy/style/checkers/test_expectations.py
r106591 r107124 48 48 categories = set(['test/expectations']) 49 49 50 def _determine_port_from_exepectations_path(self, host, expectations_path): 51 try: 52 port_name = expectations_path.split(host.filesystem.sep)[-2] 53 if not port_name: 54 return None 55 56 # Pass a configuration to avoid calling default_configuration() when initializing the port (takes 0.5 seconds on a Mac Pro!). 57 return host.port_factory.get(port_name, options=DummyOptions(configuration="Release")) 58 except Exception, e: 59 _log.warn("Exception while getting port for path %s" % expectations_path) 60 return None 50 def _determine_port_from_expectations_path(self, host, expectations_path): 51 # Pass a configuration to avoid calling default_configuration() when initializing the port (takes 0.5 seconds on a Mac Pro!). 52 options = DummyOptions(configuration='Release') 53 for port_name in host.port_factory.all_port_names(): 54 port = host.port_factory.get(port_name, options=options) 55 if port.path_to_test_expectations_file().replace(port.path_from_webkit_base() + host.filesystem.sep, '') == expectations_path: 56 return port 57 return None 61 58 62 59 def __init__(self, file_path, handle_style_error, host=None): … … 71 68 host._initialize_scm() 72 69 73 # Determining the port of this expectations. 74 self._port_obj = self._determine_port_from_exepectations_path(host, file_path) 75 # Using 'test' port when we couldn't determine the port for this 76 # expectations. 77 if not self._port_obj: 78 _log.warn("Could not determine the port for %s. " 79 "Using 'test' port, but platform-specific expectations " 80 "will fail the check." % self._file_path) 81 self._port_obj = host.port_factory.get('test') 70 self._port_obj = self._determine_port_from_expectations_path(host, file_path) 71 82 72 # Suppress error messages of test_expectations module since they will be reported later. 83 73 log = logging.getLogger("webkitpy.layout_tests.layout_package.test_expectations") … … 113 103 overrides = self._port_obj.test_expectations_overrides() 114 104 expectations = '\n'.join(lines) 115 self.check_test_expectations(expectations_str=expectations, 116 tests=None, 117 overrides=overrides) 105 if self._port_obj: 106 self.check_test_expectations(expectations_str=expectations, 107 tests=None, 108 overrides=overrides) 109 else: 110 self._handle_style_error(1, 'test/expectations', 5, 111 'No port uses path %s for test_expectations' % self._file_path) 118 112 # Warn tabs in lines as well 119 113 self.check_tabs(lines) -
trunk/Tools/Scripts/webkitpy/style/checkers/test_expectations_unittest.py
r105948 r107124 64 64 self._test_file = 'passes/text.html' 65 65 66 def _expect_port_for_expectations_path(self, expected_port_ or_port_class, expectations_path):66 def _expect_port_for_expectations_path(self, expected_port_implementation, expectations_path): 67 67 host = MockHost() 68 68 checker = TestExpectationsChecker(expectations_path, ErrorCollector(), host=host) 69 port = checker._determine_port_from_ex epectations_path(host, expectations_path)69 port = checker._determine_port_from_expectations_path(host, expectations_path) 70 70 if port: 71 self.assert Equals(port.__class__.__name__, expected_port_or_port_class)71 self.assertTrue(port.name().startswith(expected_port_implementation)) 72 72 else: 73 self.assertEquals( port, expected_port_or_port_class)73 self.assertEquals(None, expected_port_implementation) 74 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") 75 def test_determine_port_from_expectations_path(self): 76 self._expect_port_for_expectations_path(None, '/') 77 self._expect_port_for_expectations_path(None, 'LayoutTests/chromium-mac/test_expectations.txt') 78 self._expect_port_for_expectations_path('chromium', 'LayoutTests/platform/chromium/test_expectations.txt') 79 self._expect_port_for_expectations_path(None, '/mock-checkout/LayoutTests/platform/win/test_expectations.txt') 80 self._expect_port_for_expectations_path('win', 'LayoutTests/platform/win/test_expectations.txt') 78 81 79 82 def assert_lines_lint(self, lines, should_pass, expected_output=None): 80 83 self._error_collector.reset_errors() 84 85 host = MockHost() 81 86 checker = TestExpectationsChecker('test/test_expectations.txt', 82 self._error_collector, host=MockHost()) 87 self._error_collector, host=host) 88 89 # We should have failed to find a valid port object for that path. 90 self.assertEquals(checker._port_obj, None) 91 92 # Now use a test port so we can check the lines. 93 checker._port_obj = host.port_factory.get('test-mac-leopard') 83 94 checker.check_test_expectations(expectations_str='\n'.join(lines), 84 95 tests=[self._test_file],
Note: See TracChangeset
for help on using the changeset viewer.