NRWT: lint warnings don't show up by default
authordpranke@chromium.org <dpranke@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Nov 2012 04:14:34 +0000 (04:14 +0000)
committerdpranke@chromium.org <dpranke@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Nov 2012 04:14:34 +0000 (04:14 +0000)
https://bugs.webkit.org/show_bug.cgi?id=100914

Reviewed by Ryosuke Niwa.

NRWT wasn't printing any warnings if you had errors in your
TestExpectations files; this means you would only notice this
with --lint-test-files, which is probably bad. I'm not sure
when this requested, but perhaps when we changed the
warnings to not be fatal if you weren't linting the files.

Now they're still not fatal, but at least we print them.

Also fix one warning message where we were printing the test name twice.

* Scripts/webkitpy/layout_tests/models/test_expectations.py:
(TestExpectationsModel._already_seen_better_match):
(TestExpectations._report_warnings):
* Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py:
(MiscTests.test_parse_warnings_are_logged_if_not_in_lint_mode(self): Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@133121 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

index d7d94f2..e292fcb 100644 (file)
@@ -1,3 +1,26 @@
+2012-10-31  Dirk Pranke  <dpranke@chromium.org>
+
+        NRWT: lint warnings don't show up by default
+        https://bugs.webkit.org/show_bug.cgi?id=100914
+
+        Reviewed by Ryosuke Niwa.
+
+        NRWT wasn't printing any warnings if you had errors in your
+        TestExpectations files; this means you would only notice this
+        with --lint-test-files, which is probably bad. I'm not sure
+        when this requested, but perhaps when we changed the
+        warnings to not be fatal if you weren't linting the files.
+
+        Now they're still not fatal, but at least we print them.
+
+        Also fix one warning message where we were printing the test name twice.
+
+        * Scripts/webkitpy/layout_tests/models/test_expectations.py:
+        (TestExpectationsModel._already_seen_better_match):
+        (TestExpectations._report_warnings):
+        * Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py:
+        (MiscTests.test_parse_warnings_are_logged_if_not_in_lint_mode(self): Added.
+
 2012-10-31  Terry Anderson  <tdanderson@chromium.org>
 
         Missing stderr output when using run-webkit-tests
index 14321bb..e4d466a 100644 (file)
@@ -689,7 +689,7 @@ class TestExpectationsModel(object):
         # to be warnings and return False".
 
         if prev_expectation_line.matching_configurations == expectation_line.matching_configurations:
-            expectation_line.warnings.append('Duplicate or ambiguous entry for %s on lines %s:%d and %s:%d.' % (expectation_line.name,
+            expectation_line.warnings.append('Duplicate or ambiguous entry lines %s:%d and %s:%d.' % (
                 self._shorten_filename(prev_expectation_line.filename), prev_expectation_line.line_number,
                 self._shorten_filename(expectation_line.filename), expectation_line.line_number))
             return True
@@ -932,6 +932,10 @@ class TestExpectations(object):
             self._has_warnings = True
             if self._is_lint_mode:
                 raise ParseError(warnings)
+            _log.warning('--lint-test-files warnings:')
+            for warning in warnings:
+                _log.warning(warning)
+            _log.warning('')
 
     def _process_tests_without_expectations(self):
         if self._full_test_list:
index 8b40acb..d78ae3f 100644 (file)
@@ -184,6 +184,15 @@ class MiscTests(Base):
                         "expectations:2 Path does not exist. non-existent-test.html")
             self.assertEqual(str(e), warnings)
 
+    def test_parse_warnings_are_logged_if_not_in_lint_mode(self):
+        oc = OutputCapture()
+        try:
+            oc.capture_output()
+            self.parse_exp('-- this should be a syntax error', is_lint_mode=False)
+        finally:
+            _, _, logs = oc.restore_output()
+            self.assertNotEquals(logs, '')
+
     def test_error_on_different_platform(self):
         # parse_exp uses a Windows port. Assert errors on Mac show up in lint mode.
         self.assertRaises(ParseError, self.parse_exp,