TestExpectationsParser doesn't warn about test files that don't exist.
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 21 Aug 2012 21:03:26 +0000 (21:03 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 21 Aug 2012 21:03:26 +0000 (21:03 +0000)
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):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@126184 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 0efc436..4565cda 100644 (file)
@@ -1,3 +1,18 @@
+2012-08-21  Ryosuke Niwa  <rniwa@webkit.org>
+
+        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  <rniwa@webkit.org>
 
         Move free functions in test_expectations to TestExpectations class
index aa946fd..6b94939 100644 (file)
@@ -188,10 +188,10 @@ class TestExpectationParser(object):
         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 @@ class TestExpectationParser(object):
             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
index a95bdb4..5abb213 100644 (file)
@@ -187,13 +187,19 @@ BUGX WONTFIX : failures/expected = IMAGE
 
     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: