check-webkit-style of the chromium test_expectations.txt file doesn't test all chromi...
authorojan@chromium.org <ojan@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Jan 2012 23:01:24 +0000 (23:01 +0000)
committerojan@chromium.org <ojan@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Jan 2012 23:01:24 +0000 (23:01 +0000)
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
Tools/Scripts/webkitpy/style/checkers/test_expectations.py
Tools/Scripts/webkitpy/style/checkers/test_expectations_unittest.py

index a6792ef..1a2c5ce 100644 (file)
@@ -1,3 +1,23 @@
+2012-01-18  Ojan Vafai  <ojan@chromium.org>
+
+        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  <rniwa@webkit.org>
 
         Build fix. Revert an unintentional change to WebKitDriver in r105443.
index 9d1941d..a141415 100644 (file)
@@ -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)
index 92d1fe6..d7178b6 100644 (file)
@@ -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 = """<leopard, x86, debug, cpu>
+<leopard, x86, debug, gpu>
+<leopard, x86, release, cpu>
+<leopard, x86, release, gpu>
+<snowleopard, x86, debug, cpu>
+<snowleopard, x86, debug, gpu>
+<snowleopard, x86, release, cpu>
+<snowleopard, x86, release, gpu>
+<xp, x86, debug, cpu>
+<xp, x86, debug, gpu>
+<xp, x86, release, cpu>
+<xp, x86, release, gpu>
+<vista, x86, debug, cpu>
+<vista, x86, debug, gpu>
+<vista, x86, release, cpu>
+<vista, x86, release, gpu>
+<win7, x86, debug, cpu>
+<win7, x86, debug, gpu>
+<win7, x86, release, cpu>
+<win7, x86, release, gpu>
+<lucid, x86, debug, cpu>
+<lucid, x86, debug, gpu>
+<lucid, x86, release, cpu>
+<lucid, x86, release, gpu>
+<lucid, x86_64, debug, cpu>
+<lucid, x86_64, debug, gpu>
+<lucid, x86_64, release, cpu>
+<lucid, x86_64, release, gpu>"""
+
+        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)