Title: [126184] trunk/Tools
Revision
126184
Author
[email protected]
Date
2012-08-21 14:03:26 -0700 (Tue, 21 Aug 2012)

Log Message

TestExpectationsParser doesn't warn about test files that don't exist.
https://bugs.webkit.org/show_bug.cgi?id=94632

Reviewed by Dirk Pranke.

Exit early and warn when the test file doesn't exist as well when a test directory doesn't exist.

* Scripts/webkitpy/layout_tests/models/test_expectations.py:
(TestExpectationParser._parse_line):
(TestExpectationParser._check_test_exists):
* Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py:
(test_parse_warning):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (126183 => 126184)


--- trunk/Tools/ChangeLog	2012-08-21 20:35:28 UTC (rev 126183)
+++ trunk/Tools/ChangeLog	2012-08-21 21:03:26 UTC (rev 126184)
@@ -1,3 +1,18 @@
+2012-08-21  Ryosuke Niwa  <[email protected]>
+
+        TestExpectationsParser doesn't warn about test files that don't exist.
+        https://bugs.webkit.org/show_bug.cgi?id=94632
+
+        Reviewed by Dirk Pranke.
+
+        Exit early and warn when the test file doesn't exist as well when a test directory doesn't exist.
+
+        * Scripts/webkitpy/layout_tests/models/test_expectations.py:
+        (TestExpectationParser._parse_line):
+        (TestExpectationParser._check_test_exists):
+        * Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py:
+        (test_parse_warning):
+
 2012-08-20  Ryosuke Niwa  <[email protected]>
 
         Move free functions in test_expectations to TestExpectations class

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py (126183 => 126184)


--- trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py	2012-08-21 20:35:28 UTC (rev 126183)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py	2012-08-21 21:03:26 UTC (rev 126184)
@@ -188,10 +188,10 @@
         if not expectation_line.name:
             return
 
-        expectation_line.is_file = self._port.test_isfile(expectation_line.name)
-        if not expectation_line.is_file and self._check_path_does_not_exist(expectation_line):
+        if not self._check_test_exists(expectation_line):
             return
 
+        expectation_line.is_file = self._port.test_isfile(expectation_line.name)
         if expectation_line.is_file:
             expectation_line.path = expectation_line.name
         else:
@@ -245,18 +245,17 @@
             result.add(expectation)
         expectation_line.parsed_expectations = result
 
-    def _check_path_does_not_exist(self, expectation_line):
+    def _check_test_exists(self, expectation_line):
         # WebKit's way of skipping tests is to add a -disabled suffix.
         # So we should consider the path existing if the path or the
         # -disabled version exists.
-        if (not self._port.test_exists(expectation_line.name)
-            and not self._port.test_exists(expectation_line.name + '-disabled')):
+        if not self._port.test_exists(expectation_line.name) and not self._port.test_exists(expectation_line.name + '-disabled'):
             # Log a warning here since you hit this case any
             # time you update TestExpectations without syncing
             # the LayoutTests directory
             expectation_line.warnings.append('Path does not exist.')
-            return True
-        return False
+            return False
+        return True
 
     def _collect_matching_tests(self, expectation_line):
         """Convert the test specification to an absolute, normalized

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py (126183 => 126184)


--- trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py	2012-08-21 20:35:28 UTC (rev 126183)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py	2012-08-21 21:03:26 UTC (rev 126184)
@@ -187,13 +187,19 @@
 
     def test_parse_warning(self):
         try:
-            self.parse_exp("""FOO : failures/expected/text.html = TEXT
-SKIP : failures/expected/image.html""", is_lint_mode=True)
+            filesystem = self._port.host.filesystem
+            filesystem.write_text_file(filesystem.join(self._port.layout_tests_dir(), 'disabled-test.html-disabled'), 'content')
+            self.get_test('disabled-test.html-disabled'),
+            self.parse_exp("FOO : failures/expected/text.html = TEXT\n"
+                "SKIP : failures/expected/image.html\n"
+                "BUGRNIWA : non-existent-test.html = TEXT\n"
+                "BUGRNIWA : disabled-test.html-disabled = IMAGE", 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"
-                        "expectations:2 Missing expectations SKIP : failures/expected/image.html")
+                        "expectations:2 Missing expectations SKIP : failures/expected/image.html\n"
+                        "expectations:3 Path does not exist. non-existent-test.html")
             self.assertEqual(str(e), warnings)
 
         try:
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to