NRWT should handle duplicated expectations
authorkkristof@inf.u-szeged.hu <kkristof@inf.u-szeged.hu@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 5 Dec 2011 09:28:10 +0000 (09:28 +0000)
committerkkristof@inf.u-szeged.hu <kkristof@inf.u-szeged.hu@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 5 Dec 2011 09:28:10 +0000 (09:28 +0000)
https://bugs.webkit.org/show_bug.cgi?id=69750

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@101979 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/webkit.py
Tools/Scripts/webkitpy/layout_tests/port/webkit_unittest.py

index be7c12c8cdee44c42d5ef5e53ef6e8fb17a2fd16..a17fe0ccb7b871c72ee4173b0e95c50eec124e7e 100644 (file)
@@ -1,3 +1,24 @@
+2011-12-05  Krist√≥f Koszty√≥  <kkristof@inf.u-szeged.hu>
+
+        NRWT should handle duplicated expectations
+        https://bugs.webkit.org/show_bug.cgi?id=69750
+
+        Reviewed by Dirk Pranke.
+
+        * Scripts/webkitpy/layout_tests/models/test_expectations.py:
+        (TestExpectations.__init__):
+        (TestExpectations._report_errors):
+        (TestExpectations._add_expectations):
+        * Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py:
+        (test_add_skipped_tests):
+        * Scripts/webkitpy/layout_tests/port/base.py:
+        (Port.skipped_tests):
+        * Scripts/webkitpy/layout_tests/port/webkit.py:
+        (WebKitPort.test_expectations):
+        (WebKitPort.skipped_tests):
+        * Scripts/webkitpy/layout_tests/port/webkit_unittest.py:
+        (test_test_expectations):
+
 2011-12-04  Eric Seidel  <eric@webkit.org>
 
         After success with Mac, Win and Gtk, turning on parallel testing
index 53b3d77e40985a65387a78931f8763abc2ba752c..129a26ce077b8c52f48a6cbe107bee733e583edb 100644 (file)
@@ -697,9 +697,11 @@ class TestExpectations(object):
         self._parser = TestExpectationParser(port, tests, is_lint_mode)
         self._port = port
         self._test_configuration_converter = TestConfigurationConverter(port.all_test_configurations(), port.configuration_specifier_macros())
+        self._skipped_tests_warnings = []
 
         self._expectations = TestExpectationParser.tokenize_list(expectations)
         self._add_expectations(self._expectations, overrides_allowed=False)
+        self._add_skipped_tests(port.skipped_tests())
 
         if overrides:
             overrides_expectations = TestExpectationParser.tokenize_list(overrides)
@@ -783,6 +785,9 @@ class TestExpectations(object):
             for warning in expectation.warnings:
                 warnings.append("Line:%s %s %s" % (expectation.line_number, warning, expectation.name if expectation.expectations else expectation.original_string))
 
+        for warning in self._skipped_tests_warnings:
+            warnings.append(warning)
+
         if len(errors) or len(warnings):
             webkit_base_path = self._port.webkit_base()
             test_expectation_path = self._port.path_to_test_expectations_file()
@@ -826,3 +831,15 @@ class TestExpectations(object):
             self._parser.parse(expectation_line)
             if self._test_config in expectation_line.matching_configurations:
                 self._model.add_expectation_line(expectation_line, overrides_allowed)
+
+    def _add_skipped_tests(self, tests_to_skip):
+        if not tests_to_skip:
+            return
+        for index, test in enumerate(self._expectations, start=1):
+            if test.name and test.name in tests_to_skip:
+                self._skipped_tests_warnings.append('The %s test from test_expectations.txt in line %d is also in Skipped!' %
+                            (test.name, index))
+        skipped_tests = '\n'.join(map(lambda test_path: 'BUG_SKIPPED SKIP : %s = FAIL' % test_path, tests_to_skip))
+        for test in TestExpectationParser.tokenize_list(skipped_tests):
+            self._parser.parse(test)
+            self._model.add_expectation_line(test, overrides_allowed=True)
index 1a64f21c56449c815a6235747f5a7bbe6ad9efc9..78da7403ed04b279018752ddcf2f1aa087829a01 100644 (file)
@@ -256,6 +256,13 @@ BUG_OVERRIDE : failures/expected/text.html = CRASH
                                                      'failures/expected/text.html') in
                          self._exp.get_tests_with_result_type(SKIP))
 
+    def test_add_skipped_tests(self):
+        port = MockHost().port_factory.get('qt')
+        port._filesystem.files[port._filesystem.join(port.layout_tests_dir(), 'platform/qt/Skipped')] = 'failures/expected/text.html'
+        port._filesystem.files[port._filesystem.join(port.layout_tests_dir(), 'failures/expected/text.html')] = 'foo'
+        self.assertRaises(ParseError, TestExpectations, port, 'failures/expected/text.html\n', 'BUGX : failures/expected/text.html = text\n', None, True)
+
+
 class ExpectationSyntaxTests(Base):
     def test_missing_expectation(self):
         # This is missing the expectation.
index 48e8bdecfee5efd9ced6faf460448c844a6edf23..0541a4fe4ed0106766ef5a17bbff3094bf548fca 100755 (executable)
@@ -609,6 +609,9 @@ class Port(object):
     def skipped_layout_tests(self):
         return []
 
+    def skipped_tests(self):
+        return []
+
     def skips_layout_test(self, test_name):
         """Figures out if the givent test is being skipped or not.
 
index ce6bc29b7bcd6e7926c90c9e8e996a7dba51f714..58f549aaa76d8f91a91f1d997ade6b22b7294cb0 100644 (file)
@@ -360,26 +360,13 @@ class WebKitPort(Port):
 
     def test_expectations(self):
         # This allows ports to use a combination of test_expectations.txt files and Skipped lists.
-        expectations = self._skipped_list_as_expectations()
+        expectations = ''
         expectations_path = self.path_to_test_expectations_file()
         if self._filesystem.exists(expectations_path):
             _log.debug("Using test_expectations.txt: %s" % expectations_path)
-            expectations = self._filesystem.read_text_file(expectations_path) + '\n' + expectations
+            expectations = self._filesystem.read_text_file(expectations_path)
         return expectations
 
-    def _skipped_list_as_expectations(self):
-        # Each Skipped file contains a list of files
-        # or directories to be skipped during the test run. The total list
-        # of tests to skipped is given by the contents of the generic
-        # Skipped file found in platform/X plus a version-specific file
-        # found in platform/X-version. Duplicate entries are allowed.
-        # This routine reads those files and turns contents into the
-        # format expected by test_expectations.
-
-        tests_to_skip = self.skipped_layout_tests()
-        skip_lines = map(lambda test_path: "BUG_SKIPPED SKIP : %s = FAIL" % test_path, tests_to_skip)
-        return "\n".join(skip_lines)
-
     def skipped_layout_tests(self):
         # Use a set to allow duplicates
         tests_to_skip = set(self._expectations_from_skipped_files())
@@ -387,6 +374,9 @@ class WebKitPort(Port):
         tests_to_skip.update(self._skipped_tests_for_unsupported_features())
         return tests_to_skip
 
+    def skipped_tests(self):
+        return self.skipped_layout_tests()
+
     def _build_path(self, *comps):
         # --root is used for running with a pre-built root (like from a nightly zip).
         build_directory = self.get_option('root')
index 910559acc02a6b0c6d33d76790852cc3e81eb0c6..cc8ff8391864358087a2063b0ab7e97e52b7704f 100755 (executable)
@@ -148,29 +148,13 @@ class WebKitPortTest(port_testcase.PortTestCase):
         self.assertEqual(port._path_to_driver(), "/foo/DumpRenderTree")
 
     def test_test_expectations(self):
-        # Check that we read both the expectations file and anything in a
-        # Skipped file, and that we include the feature and platform checks.
+        # Check that we read the expectations file
         files = {
             '/mock-checkout/LayoutTests/platform/testwebkitport/test_expectations.txt': 'BUG_TESTEXPECTATIONS SKIP : fast/html/article-element.html = FAIL\n',
-            '/mock-checkout/LayoutTests/platform/testwebkitport/Skipped': 'fast/html/keygen.html',
         }
         mock_fs = MockFileSystem(files)
         port = TestWebKitPort(filesystem=mock_fs)
-        self.assertEqual(port.test_expectations(),
-        """BUG_TESTEXPECTATIONS SKIP : fast/html/article-element.html = FAIL\n
-BUG_SKIPPED SKIP : fast/html/keygen.html = FAIL
-BUG_SKIPPED SKIP : media = FAIL""")
-        files = {
-            '/mock-checkout/LayoutTests/platform/testwebkitport/test_expectations.txt': 'BUG_TESTEXPECTATIONS SKIP : fast/html/article-element.html = FAIL',
-            '/mock-checkout/LayoutTests/platform/testwebkitport/Skipped': 'fast/html/keygen.html',
-        }
-        mock_fs = MockFileSystem(files)
-        port = TestWebKitPort(filesystem=mock_fs)
-        self.assertEqual(port.test_expectations(),
-        """BUG_TESTEXPECTATIONS SKIP : fast/html/article-element.html = FAIL
-BUG_SKIPPED SKIP : fast/html/keygen.html = FAIL
-BUG_SKIPPED SKIP : media = FAIL""")
-
+        self.assertEqual(port.test_expectations(), 'BUG_TESTEXPECTATIONS SKIP : fast/html/article-element.html = FAIL\n')
 
     def test_build_driver(self):
         output = OutputCapture()