webkitpy: make warning about missing BUG identifiers per-port configurable
authordpranke@chromium.org <dpranke@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 27 Sep 2012 19:00:15 +0000 (19:00 +0000)
committerdpranke@chromium.org <dpranke@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 27 Sep 2012 19:00:15 +0000 (19:00 +0000)
https://bugs.webkit.org/show_bug.cgi?id=97751

Reviewed by Ojan Vafai.

Prior to this change linting TestExpectations files (checking their style)
would raise warnings if lines were missing a BUG modifier, even
though such a modifier is actually optional in the syntax. As we
migrate the entries over from the Skipped files, these warnings
will generate a lot of noise, and it's not yet clear that we
actually want to require the modifiers on all ports.

So, this change makes this per-port configurable so that they
will generate warnings in the Chromium TestExpectations and not
anywhere else.

* Scripts/webkitpy/layout_tests/models/test_expectations.py:
(TestExpectationParser._parse_modifiers):
* Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py:
(MiscTests.test_parse_warning):
(SemanticTests.test_missing_bugid):
* Scripts/webkitpy/layout_tests/port/base.py:
(Port.warn_if_bug_missing_in_test_expectations):
* Scripts/webkitpy/layout_tests/port/chromium.py:
(ChromiumPort.warn_if_bug_missing_in_test_expectations):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@129784 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py
Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py
Tools/Scripts/webkitpy/layout_tests/port/base.py
Tools/Scripts/webkitpy/layout_tests/port/chromium.py

index b939c16..88f14e9 100644 (file)
@@ -1,3 +1,31 @@
+2012-09-27  Dirk Pranke  <dpranke@chromium.org>
+
+        webkitpy: make warning about missing BUG identifiers per-port configurable
+        https://bugs.webkit.org/show_bug.cgi?id=97751
+
+        Reviewed by Ojan Vafai.
+
+        Prior to this change linting TestExpectations files (checking their style)
+        would raise warnings if lines were missing a BUG modifier, even
+        though such a modifier is actually optional in the syntax. As we
+        migrate the entries over from the Skipped files, these warnings
+        will generate a lot of noise, and it's not yet clear that we
+        actually want to require the modifiers on all ports.
+
+        So, this change makes this per-port configurable so that they
+        will generate warnings in the Chromium TestExpectations and not
+        anywhere else.
+
+        * Scripts/webkitpy/layout_tests/models/test_expectations.py:
+        (TestExpectationParser._parse_modifiers):
+        * Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py:
+        (MiscTests.test_parse_warning):
+        (SemanticTests.test_missing_bugid):
+        * Scripts/webkitpy/layout_tests/port/base.py:
+        (Port.warn_if_bug_missing_in_test_expectations):
+        * Scripts/webkitpy/layout_tests/port/chromium.py:
+        (ChromiumPort.warn_if_bug_missing_in_test_expectations):
+
 2012-09-27  Xianzhu Wang  <wangxianzhu@chromium.org>
 
         [Chromium-Android] Push more fonts for layout tests to match chromium-linux
index 42b518f..a6113fc 100644 (file)
@@ -155,7 +155,7 @@ class TestExpectationParser(object):
             else:
                 parsed_specifiers.add(modifier)
 
-        if not expectation_line.parsed_bug_modifiers and not has_wontfix and not has_bugid:
+        if not expectation_line.parsed_bug_modifiers and not has_wontfix and not has_bugid and self._port.warn_if_bug_missing_in_test_expectations():
             expectation_line.warnings.append(self.MISSING_BUG_WARNING)
 
         if self._allow_rebaseline_modifier and self.REBASELINE_MODIFIER in modifiers:
index c560607..514cad0 100644 (file)
@@ -179,8 +179,7 @@ class MiscTests(Base):
                 "Bug(rniwa) disabled-test.html-disabled [ ImageOnlyFailure ]", is_lint_mode=True)
             self.assertFalse(True, "ParseError wasn't raised")
         except ParseError, e:
-            warnings = ("expectations:1 Test lacks BUG modifier. failures/expected/text.html\n"
-                        "expectations:1 Unrecognized modifier 'foo' failures/expected/text.html\n"
+            warnings = ("expectations:1 Unrecognized modifier 'foo' failures/expected/text.html\n"
                         "expectations:2 Path does not exist. non-existent-test.html")
             self.assertEqual(str(e), warnings)
 
@@ -372,7 +371,9 @@ class SemanticTests(Base):
 
     def test_missing_bugid(self):
         self.parse_exp('failures/expected/text.html [ Failure ]')
-        self.assertTrue(self._exp.has_warnings())
+        self.assertFalse(self._exp.has_warnings())
+
+        self._port.warn_if_bug_missing_in_test_expectations = lambda: True
 
         self.parse_exp('failures/expected/text.html [ Failure ]')
         line = self._exp._model.get_expectation_line('failures/expected/text.html')
index cd57032..d161367 100755 (executable)
@@ -997,6 +997,9 @@ class Port(object):
         # some ports have Skipped files which are returned as part of test_expectations().
         return self._filesystem.exists(self.path_to_test_expectations_file())
 
+    def warn_if_bug_missing_in_test_expectations(self):
+        return False
+
     def expectations_dict(self):
         """Returns an OrderedDict of name -> expectations strings.
         The names are expected to be (but not required to be) paths in the filesystem.
index 9f80807..0a003e5 100755 (executable)
@@ -332,6 +332,9 @@ class ChromiumPort(Port):
         'win_layout_rel',
     ])
 
+    def warn_if_bug_missing_in_test_expectations(self):
+        return True
+
     def expectations_files(self):
         paths = [self.path_to_test_expectations_file()]
         skia_expectations_path = self.path_from_chromium_base('skia', 'skia_test_expectations.txt')