From a6a905ee632c10182b5853418a0afc27082940a0 Mon Sep 17 00:00:00 2001 From: "ojan@chromium.org" Date: Thu, 19 Jan 2012 23:01:24 +0000 Subject: [PATCH] check-webkit-style of the chromium test_expectations.txt file doesn't test all chromium ports https://bugs.webkit.org/show_bug.cgi?id=76510 Reviewed by Adam Barth. Unlike other style rules, if you get the syntax of the test_expectations.txt file wrong, the layout tests won't run. Also, this check is simple and only slows down committing if you actually modify one of the test_expectations.txt files. * Scripts/webkitpy/style/checkers/test_expectations.py: (TestExpectationsChecker.check_test_expectations): (TestExpectationsChecker.check): * Scripts/webkitpy/style/checkers/test_expectations_unittest.py: (TestExpectationsTestCase.test_check_covers_all_configurations): (TestExpectationsTestCase.test_check_covers_all_configurations.mock_check_test_expectations): (TestExpectationsTestCase): (assert_lines_lint): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@105452 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Tools/ChangeLog | 20 +++++++++++ .../webkitpy/style/checkers/test_expectations.py | 12 ++++--- .../style/checkers/test_expectations_unittest.py | 41 ++++++++++++++++++++++ 3 files changed, 68 insertions(+), 5 deletions(-) diff --git a/Tools/ChangeLog b/Tools/ChangeLog index a6792ef..1a2c5ce 100644 --- a/Tools/ChangeLog +++ b/Tools/ChangeLog @@ -1,3 +1,23 @@ +2012-01-18 Ojan Vafai + + check-webkit-style of the chromium test_expectations.txt file doesn't test all chromium ports + https://bugs.webkit.org/show_bug.cgi?id=76510 + + Reviewed by Adam Barth. + + Unlike other style rules, if you get the syntax of the test_expectations.txt + file wrong, the layout tests won't run. Also, this check is simple and only + slows down committing if you actually modify one of the test_expectations.txt files. + + * Scripts/webkitpy/style/checkers/test_expectations.py: + (TestExpectationsChecker.check_test_expectations): + (TestExpectationsChecker.check): + * Scripts/webkitpy/style/checkers/test_expectations_unittest.py: + (TestExpectationsTestCase.test_check_covers_all_configurations): + (TestExpectationsTestCase.test_check_covers_all_configurations.mock_check_test_expectations): + (TestExpectationsTestCase): + (assert_lines_lint): + 2012-01-19 Ryosuke Niwa Build fix. Revert an unintentional change to WebKitDriver in r105443. diff --git a/Tools/Scripts/webkitpy/style/checkers/test_expectations.py b/Tools/Scripts/webkitpy/style/checkers/test_expectations.py index 9d1941d..a141415 100644 --- a/Tools/Scripts/webkitpy/style/checkers/test_expectations.py +++ b/Tools/Scripts/webkitpy/style/checkers/test_expectations.py @@ -90,13 +90,13 @@ class TestExpectationsChecker(object): def _handle_error_message(self, lineno, message, confidence): pass - def check_test_expectations(self, expectations_str, tests=None, overrides=None): + def check_test_expectations(self, expectations_str, test_configuration, tests=None, overrides=None): err = None expectations = None try: expectations = test_expectations.TestExpectations( port=self._port_obj, expectations=expectations_str, tests=tests, - test_config=self._port_obj.test_configuration(), + test_config=test_configuration, is_lint_mode=True, overrides=overrides) except test_expectations.ParseError, error: err = error @@ -118,8 +118,10 @@ class TestExpectationsChecker(object): def check(self, lines): overrides = self._port_obj.test_expectations_overrides() expectations = '\n'.join(lines) - self.check_test_expectations(expectations_str=expectations, - tests=None, - overrides=overrides) + for test_configuration in self._port_obj.all_test_configurations(): + self.check_test_expectations(expectations_str=expectations, + test_configuration=test_configuration, + tests=None, + overrides=overrides) # Warn tabs in lines as well self.check_tabs(lines) diff --git a/Tools/Scripts/webkitpy/style/checkers/test_expectations_unittest.py b/Tools/Scripts/webkitpy/style/checkers/test_expectations_unittest.py index 92d1fe6..d7178b6 100644 --- a/Tools/Scripts/webkitpy/style/checkers/test_expectations_unittest.py +++ b/Tools/Scripts/webkitpy/style/checkers/test_expectations_unittest.py @@ -76,11 +76,52 @@ class TestExpectationsTestCase(unittest.TestCase): self._expect_port_for_expectations_path(None, "/") self._expect_port_for_expectations_path("ChromiumMacPort", "/mock-checkout/LayoutTests/chromium-mac/test_expectations.txt") + def test_check_covers_all_configurations(self): + checker = TestExpectationsChecker('test/test_expectations.txt', self._error_collector, host=MockHost()) + output = [] + + def mock_check_test_expectations(expectations_str, test_configuration, tests, overrides, output=output): + output.append(str(test_configuration)) + checker.check_test_expectations = mock_check_test_expectations + checker.check(lines="") + + expected_output = """ + + + + + + + + + + + + + + + + + + + + + + + + + + +""" + + self.assertEqual("\n".join(output), expected_output) + def assert_lines_lint(self, lines, expected): self._error_collector.reset_errors() checker = TestExpectationsChecker('test/test_expectations.txt', self._error_collector, host=MockHost()) checker.check_test_expectations(expectations_str='\n'.join(lines), + test_configuration=checker._port_obj.test_configuration(), tests=[self._test_file], overrides=None) checker.check_tabs(lines) -- 1.8.3.1