Modified: trunk/Tools/ChangeLog (120237 => 120238)
--- trunk/Tools/ChangeLog 2012-06-13 19:45:39 UTC (rev 120237)
+++ trunk/Tools/ChangeLog 2012-06-13 19:46:08 UTC (rev 120238)
@@ -1,5 +1,20 @@
2012-06-13 Dirk Pranke <[email protected]>
+ webkitpy: rework the TestExpectations style checker in preparation for the cascade
+ https://bugs.webkit.org/show_bug.cgi?id=88945
+
+ Reviewed by Ojan Vafai.
+
+ This patch changes the style checker to call the
+ TestExpectations parser directly and be oblivious as to what the
+ port's actual expectations are.
+
+ * Scripts/webkitpy/style/checkers/test_expectations.py:
+ (TestExpectationsChecker.__init__):
+ (TestExpectationsChecker.check_test_expectations):
+
+2012-06-13 Dirk Pranke <[email protected]>
+
nrwt: restructure the port classes to handle multiple expectations files
https://bugs.webkit.org/show_bug.cgi?id=88944
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/test_expectations.py (120237 => 120238)
--- trunk/Tools/Scripts/webkitpy/style/checkers/test_expectations.py 2012-06-13 19:45:39 UTC (rev 120237)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/test_expectations.py 2012-06-13 19:46:08 UTC (rev 120238)
@@ -35,7 +35,7 @@
from common import TabChecker
from webkitpy.common.host import Host
-from webkitpy.layout_tests.models import test_expectations
+from webkitpy.layout_tests.models.test_expectations import TestExpectationParser
from webkitpy.layout_tests.port.base import DummyOptions
@@ -61,7 +61,6 @@
self._handle_style_error = handle_style_error
self._handle_style_error.turn_off_line_filtering()
self._tab_checker = TabChecker(file_path, handle_style_error)
- self._output_regex = re.compile('.*(TestExpectations|test_expectations.txt):(?P<line>\d+)\s*(?P<message>.+)')
# FIXME: host should be a required parameter, not an optional one.
host = host or Host()
@@ -77,33 +76,18 @@
pass
def check_test_expectations(self, expectations_str, tests=None, overrides=None):
- err = None
- expectations = None
- # FIXME: We need to rework how we lint strings so that we can do it independently of what a
- # port's existing expectations are. Linting should probably just call the parser directly.
- # For now we override the port hooks. This will also need to be reworked when expectations
- # can cascade arbitrarily, rather than just have expectations and overrides.
- orig_expectations = self._port_obj.test_expectations
- orig_overrides = self._port_obj.test_expectations_overrides
- try:
- self._port_obj.test_expectations = lambda: expectations_str
- self._port_obj.test_expectations_overrides = lambda: overrides
- expectations = test_expectations.TestExpectations(self._port_obj, tests, True)
- except test_expectations.ParseError, error:
- err = error
- finally:
- self._port_obj.text_expectations = orig_expectations
- self._port_obj.text_expectations_overrides = orig_overrides
+ # FIXME: we should pass in the filenames here if possible, and ensure
+ # that this works with with cascading expectations files and remove the overrides param.
+ parser = TestExpectationParser(self._port_obj, tests, False)
+ expectations = parser.parse('expectations', expectations_str)
+ if overrides:
+ expectations += parser.parse('overrides', overrides)
- if err:
- level = 5
- for warning in err.warnings:
- matched = self._output_regex.match(warning)
- if matched:
- lineno, message = matched.group('line', 'message')
- self._handle_style_error(int(lineno), 'test/expectations', level, message)
+ level = 5
+ for expectation_line in expectations:
+ for warning in expectation_line.warnings:
+ self._handle_style_error(expectation_line.line_number, 'test/expectations', level, warning)
-
def check_tabs(self, lines):
self._tab_checker.check(lines)