Changeset 150800 in webkit


Ignore:
Timestamp:
May 28, 2013 6:34:19 AM (11 years ago)
Author:
zandobersek@gmail.com
Message:

[webkitpy] Explicitly specify the reference file extensions
https://bugs.webkit.org/show_bug.cgi?id=116333

Reviewed by Benjamin Poulain.

Explicitly specify the extensions that are valid for the reference files. This helps to differentiate
between valid reference files required by reftests and text baselines that have the same extension as
potential test files (specifically the current MHTML tests in the .mht files and the future .mht baselines
that were until this change recognized as reference files).

Covered by existing tests and the new test_is_reference_html_file test in webkitpy.port.base_unittest.

  • Scripts/webkitpy/port/base.py:

(Port.reference_files): Iterate through the _supported_reference_extensions set.
(Port): Rename the _supported_file_extensions set to _supported_test_extensions. Add the
_supported_reference_extensions set, containing the extensions allowed for reference files.
(Port.is_reference_html_file): Return False if the file's extension is not a supported reference file extension.
(Port._has_supported_extension): Use _supported_test_extensions.

  • Scripts/webkitpy/port/base_unittest.py:

(PortTest.test_is_reference_html_file): Add the unit test, testing various test cases around the
Port.is_reference_html_file method.

Location:
trunk/Tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r150726 r150800  
     12013-05-28  Zan Dobersek  <zdobersek@igalia.com>
     2
     3        [webkitpy] Explicitly specify the reference file extensions
     4        https://bugs.webkit.org/show_bug.cgi?id=116333
     5
     6        Reviewed by Benjamin Poulain.
     7
     8        Explicitly specify the extensions that are valid for the reference files. This helps to differentiate
     9        between valid reference files required by reftests and text baselines that have the same extension as
     10        potential test files (specifically the current MHTML tests in the .mht files and the future .mht baselines
     11        that were until this change recognized as reference files).
     12
     13        Covered by existing tests and the new test_is_reference_html_file test in webkitpy.port.base_unittest.
     14
     15        * Scripts/webkitpy/port/base.py:
     16        (Port.reference_files): Iterate through the _supported_reference_extensions set.
     17        (Port): Rename the _supported_file_extensions set to _supported_test_extensions. Add the
     18        _supported_reference_extensions set, containing the extensions allowed for reference files.
     19        (Port.is_reference_html_file): Return False if the file's extension is not a supported reference file extension.
     20        (Port._has_supported_extension): Use _supported_test_extensions.
     21        * Scripts/webkitpy/port/base_unittest.py:
     22        (PortTest.test_is_reference_html_file): Add the unit test, testing various test cases around the
     23        Port.is_reference_html_file method.
     24
    1252013-05-26  Ryosuke Niwa  <rniwa@webkit.org>
    226
  • trunk/Tools/Scripts/webkitpy/port/base.py

    r150670 r150800  
    572572            reftest_list = []
    573573            for expectation, prefix in (('==', ''), ('!=', '-mismatch')):
    574                 for extention in Port._supported_file_extensions:
     574                for extention in Port._supported_reference_extensions:
    575575                    path = self.expected_filename(test_name, prefix + extention)
    576576                    if self._filesystem.exists(path):
     
    607607
    608608    # When collecting test cases, we include any file with these extensions.
    609     _supported_file_extensions = set(['.html', '.shtml', '.xml', '.xhtml', '.pl',
    610                                       '.htm', '.php', '.svg', '.mht'])
     609    _supported_test_extensions = set(['.html', '.shtml', '.xml', '.xhtml', '.pl', '.htm', '.php', '.svg', '.mht'])
     610    _supported_reference_extensions = set(['.html', '.xml', '.xhtml', '.htm', '.svg'])
    611611
    612612    @staticmethod
     
    615615        if filename.startswith('ref-') or filename.startswith('notref-'):
    616616            return True
    617         filename_wihout_ext, unused = filesystem.splitext(filename)
     617        filename_wihout_ext, ext = filesystem.splitext(filename)
     618        if ext not in Port._supported_reference_extensions:
     619            return False
    618620        for suffix in ['-expected', '-expected-mismatch', '-ref', '-notref']:
    619621            if filename_wihout_ext.endswith(suffix):
     
    625627        """Return true if filename is one of the file extensions we want to run a test on."""
    626628        extension = filesystem.splitext(filename)[1]
    627         return extension in Port._supported_file_extensions
     629        return extension in Port._supported_test_extensions
    628630
    629631    @staticmethod
  • trunk/Tools/Scripts/webkitpy/port/base_unittest.py

    r148502 r150800  
    348348        self.assertFalse(Port._is_test_file(filesystem, '', 'notref-foo.xhr'))
    349349
     350    def test_is_reference_html_file(self):
     351        filesystem = MockFileSystem()
     352        self.assertTrue(Port.is_reference_html_file(filesystem, '', 'foo-expected.html'))
     353        self.assertTrue(Port.is_reference_html_file(filesystem, '', 'foo-expected-mismatch.xml'))
     354        self.assertTrue(Port.is_reference_html_file(filesystem, '', 'foo-ref.xhtml'))
     355        self.assertTrue(Port.is_reference_html_file(filesystem, '', 'foo-notref.svg'))
     356        self.assertFalse(Port.is_reference_html_file(filesystem, '', 'foo.html'))
     357        self.assertFalse(Port.is_reference_html_file(filesystem, '', 'foo-expected.txt'))
     358        self.assertFalse(Port.is_reference_html_file(filesystem, '', 'foo-expected.shtml'))
     359        self.assertFalse(Port.is_reference_html_file(filesystem, '', 'foo-expected.php'))
     360        self.assertFalse(Port.is_reference_html_file(filesystem, '', 'foo-expected.mht'))
     361
    350362    def test_parse_reftest_list(self):
    351363        port = self.make_port(with_tests=True)
Note: See TracChangeset for help on using the changeset viewer.