Changeset 101979 in webkit


Ignore:
Timestamp:
Dec 5, 2011, 1:28:10 AM (14 years ago)
Author:
kkristof@inf.u-szeged.hu
Message:

NRWT should handle duplicated expectations
https://bugs.webkit.org/show_bug.cgi?id=69750

Location:
trunk/Tools
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r101973 r101979  
     12011-12-05  Kristóf Kosztyó  <kkristof@inf.u-szeged.hu>
     2
     3        NRWT should handle duplicated expectations
     4        https://bugs.webkit.org/show_bug.cgi?id=69750
     5
     6        Reviewed by Dirk Pranke.
     7
     8        * Scripts/webkitpy/layout_tests/models/test_expectations.py:
     9        (TestExpectations.__init__):
     10        (TestExpectations._report_errors):
     11        (TestExpectations._add_expectations):
     12        * Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py:
     13        (test_add_skipped_tests):
     14        * Scripts/webkitpy/layout_tests/port/base.py:
     15        (Port.skipped_tests):
     16        * Scripts/webkitpy/layout_tests/port/webkit.py:
     17        (WebKitPort.test_expectations):
     18        (WebKitPort.skipped_tests):
     19        * Scripts/webkitpy/layout_tests/port/webkit_unittest.py:
     20        (test_test_expectations):
     21
    1222011-12-04  Eric Seidel  <eric@webkit.org>
    223
  • trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py

    r98666 r101979  
    698698        self._port = port
    699699        self._test_configuration_converter = TestConfigurationConverter(port.all_test_configurations(), port.configuration_specifier_macros())
     700        self._skipped_tests_warnings = []
    700701
    701702        self._expectations = TestExpectationParser.tokenize_list(expectations)
    702703        self._add_expectations(self._expectations, overrides_allowed=False)
     704        self._add_skipped_tests(port.skipped_tests())
    703705
    704706        if overrides:
     
    784786                warnings.append("Line:%s %s %s" % (expectation.line_number, warning, expectation.name if expectation.expectations else expectation.original_string))
    785787
     788        for warning in self._skipped_tests_warnings:
     789            warnings.append(warning)
     790
    786791        if len(errors) or len(warnings):
    787792            webkit_base_path = self._port.webkit_base()
     
    827832            if self._test_config in expectation_line.matching_configurations:
    828833                self._model.add_expectation_line(expectation_line, overrides_allowed)
     834
     835    def _add_skipped_tests(self, tests_to_skip):
     836        if not tests_to_skip:
     837            return
     838        for index, test in enumerate(self._expectations, start=1):
     839            if test.name and test.name in tests_to_skip:
     840                self._skipped_tests_warnings.append('The %s test from test_expectations.txt in line %d is also in Skipped!' %
     841                            (test.name, index))
     842        skipped_tests = '\n'.join(map(lambda test_path: 'BUG_SKIPPED SKIP : %s = FAIL' % test_path, tests_to_skip))
     843        for test in TestExpectationParser.tokenize_list(skipped_tests):
     844            self._parser.parse(test)
     845            self._model.add_expectation_line(test, overrides_allowed=True)
  • trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py

    r99233 r101979  
    257257                         self._exp.get_tests_with_result_type(SKIP))
    258258
     259    def test_add_skipped_tests(self):
     260        port = MockHost().port_factory.get('qt')
     261        port._filesystem.files[port._filesystem.join(port.layout_tests_dir(), 'platform/qt/Skipped')] = 'failures/expected/text.html'
     262        port._filesystem.files[port._filesystem.join(port.layout_tests_dir(), 'failures/expected/text.html')] = 'foo'
     263        self.assertRaises(ParseError, TestExpectations, port, 'failures/expected/text.html\n', 'BUGX : failures/expected/text.html = text\n', None, True)
     264
     265
    259266class ExpectationSyntaxTests(Base):
    260267    def test_missing_expectation(self):
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py

    r101845 r101979  
    610610        return []
    611611
     612    def skipped_tests(self):
     613        return []
     614
    612615    def skips_layout_test(self, test_name):
    613616        """Figures out if the givent test is being skipped or not.
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit.py

    r101739 r101979  
    361361    def test_expectations(self):
    362362        # This allows ports to use a combination of test_expectations.txt files and Skipped lists.
    363         expectations = self._skipped_list_as_expectations()
     363        expectations = ''
    364364        expectations_path = self.path_to_test_expectations_file()
    365365        if self._filesystem.exists(expectations_path):
    366366            _log.debug("Using test_expectations.txt: %s" % expectations_path)
    367             expectations = self._filesystem.read_text_file(expectations_path) + '\n' + expectations
     367            expectations = self._filesystem.read_text_file(expectations_path)
    368368        return expectations
    369 
    370     def _skipped_list_as_expectations(self):
    371         # Each Skipped file contains a list of files
    372         # or directories to be skipped during the test run. The total list
    373         # of tests to skipped is given by the contents of the generic
    374         # Skipped file found in platform/X plus a version-specific file
    375         # found in platform/X-version. Duplicate entries are allowed.
    376         # This routine reads those files and turns contents into the
    377         # format expected by test_expectations.
    378 
    379         tests_to_skip = self.skipped_layout_tests()
    380         skip_lines = map(lambda test_path: "BUG_SKIPPED SKIP : %s = FAIL" % test_path, tests_to_skip)
    381         return "\n".join(skip_lines)
    382369
    383370    def skipped_layout_tests(self):
     
    387374        tests_to_skip.update(self._skipped_tests_for_unsupported_features())
    388375        return tests_to_skip
     376
     377    def skipped_tests(self):
     378        return self.skipped_layout_tests()
    389379
    390380    def _build_path(self, *comps):
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit_unittest.py

    r101534 r101979  
    149149
    150150    def test_test_expectations(self):
    151         # Check that we read both the expectations file and anything in a
    152         # Skipped file, and that we include the feature and platform checks.
     151        # Check that we read the expectations file
    153152        files = {
    154153            '/mock-checkout/LayoutTests/platform/testwebkitport/test_expectations.txt': 'BUG_TESTEXPECTATIONS SKIP : fast/html/article-element.html = FAIL\n',
    155             '/mock-checkout/LayoutTests/platform/testwebkitport/Skipped': 'fast/html/keygen.html',
    156154        }
    157155        mock_fs = MockFileSystem(files)
    158156        port = TestWebKitPort(filesystem=mock_fs)
    159         self.assertEqual(port.test_expectations(),
    160         """BUG_TESTEXPECTATIONS SKIP : fast/html/article-element.html = FAIL\n
    161 BUG_SKIPPED SKIP : fast/html/keygen.html = FAIL
    162 BUG_SKIPPED SKIP : media = FAIL""")
    163         files = {
    164             '/mock-checkout/LayoutTests/platform/testwebkitport/test_expectations.txt': 'BUG_TESTEXPECTATIONS SKIP : fast/html/article-element.html = FAIL',
    165             '/mock-checkout/LayoutTests/platform/testwebkitport/Skipped': 'fast/html/keygen.html',
    166         }
    167         mock_fs = MockFileSystem(files)
    168         port = TestWebKitPort(filesystem=mock_fs)
    169         self.assertEqual(port.test_expectations(),
    170         """BUG_TESTEXPECTATIONS SKIP : fast/html/article-element.html = FAIL
    171 BUG_SKIPPED SKIP : fast/html/keygen.html = FAIL
    172 BUG_SKIPPED SKIP : media = FAIL""")
    173 
     157        self.assertEqual(port.test_expectations(), 'BUG_TESTEXPECTATIONS SKIP : fast/html/article-element.html = FAIL\n')
    174158
    175159    def test_build_driver(self):
Note: See TracChangeset for help on using the changeset viewer.