Changeset 246434 in webkit


Ignore:
Timestamp:
Jun 14, 2019 8:53:55 AM (5 years ago)
Author:
youenn@apple.com
Message:

import-w3c-tests should respect WEBKIT_OUTPUTDIR
https://bugs.webkit.org/show_bug.cgi?id=198682
<rdar://problem/51536931>

Reviewed by Jonathan Bedard.

Check for WEBKIT_OUTPUTDIR environment variable to compute the w3c-tests folder.
Made some refactoring to also teach WPTPaths users about WEBKIT_OUTPUTDIR.

  • Scripts/webkitpy/common/webkit_finder.py:

(WebKitFinder.path_from_webkit_outputdir):

  • Scripts/webkitpy/w3c/common.py:

(WPTPaths):
(WPTPaths.checkout_directory):
(WPTPaths.wpt_checkout_path):

  • Scripts/webkitpy/w3c/test_importer.py:

(TestImporter.init):

  • Scripts/webkitpy/w3c/test_importer_unittest.py:

(test_checkout_directory):

Location:
trunk/Tools
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r246429 r246434  
     12019-06-14  Youenn Fablet  <youenn@apple.com>
     2
     3        import-w3c-tests should respect WEBKIT_OUTPUTDIR
     4        https://bugs.webkit.org/show_bug.cgi?id=198682
     5        <rdar://problem/51536931>
     6
     7        Reviewed by Jonathan Bedard.
     8
     9        Check for WEBKIT_OUTPUTDIR environment variable to compute the w3c-tests folder.
     10        Made some refactoring to also teach WPTPaths users about WEBKIT_OUTPUTDIR.
     11
     12        * Scripts/webkitpy/common/webkit_finder.py:
     13        (WebKitFinder.path_from_webkit_outputdir):
     14        * Scripts/webkitpy/w3c/common.py:
     15        (WPTPaths):
     16        (WPTPaths.checkout_directory):
     17        (WPTPaths.wpt_checkout_path):
     18        * Scripts/webkitpy/w3c/test_importer.py:
     19        (TestImporter.__init__):
     20        * Scripts/webkitpy/w3c/test_importer_unittest.py:
     21        (test_checkout_directory):
     22
    1232019-06-13  Antoine Quint  <graouts@apple.com>
    224
  • trunk/Tools/Scripts/webkitpy/common/webkit_finder.py

    r138491 r246434  
    2727# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2828
     29import os
     30
    2931
    3032class WebKitFinder(object):
     
    5355        return self._filesystem.join(self.webkit_base(), *comps)
    5456
     57    def path_from_webkit_outputdir(self, *comps):
     58        base_path = os.environ['WEBKIT_OUTPUTDIR'] if 'WEBKIT_OUTPUTDIR' in os.environ else self.path_from_webkit_base('WebKitBuild')
     59        return self._filesystem.join(base_path, *comps)
     60
    5561    def path_to_script(self, script_name):
    5662        """Returns the relative path to the script from the top of the WebKit tree."""
  • trunk/Tools/Scripts/webkitpy/w3c/common.py

    r232746 r246434  
    102102
    103103class WPTPaths:
    104     CHECKOUT_DIRECTORY = ["WebKitBuild", "w3c-tests"]
     104    CHECKOUT_DIRECTORY = ["w3c-tests"]
    105105    WPT_CHECKOUT_PATH = CHECKOUT_DIRECTORY + ["web-platform-tests"]
    106106
    107107    @staticmethod
    108108    def checkout_directory(finder):
    109         return finder.path_from_webkit_base(*WPTPaths.CHECKOUT_DIRECTORY)
     109        return finder.path_from_webkit_outputdir(*WPTPaths.CHECKOUT_DIRECTORY)
    110110
    111111    @staticmethod
    112112    def wpt_checkout_path(finder):
    113         return finder.path_from_webkit_base(*WPTPaths.WPT_CHECKOUT_PATH)
     113        return finder.path_from_webkit_outputdir(*WPTPaths.WPT_CHECKOUT_PATH)
  • trunk/Tools/Scripts/webkitpy/w3c/test_importer.py

    r245287 r246434  
    8080from webkitpy.common.system.filesystem import FileSystem
    8181from webkitpy.common.webkit_finder import WebKitFinder
    82 from webkitpy.w3c.common import WPT_GH_URL
     82from webkitpy.w3c.common import WPT_GH_URL, WPTPaths
    8383from webkitpy.w3c.test_parser import TestParser
    8484from webkitpy.w3c.test_converter import convert_for_webkit
     
    170170        self.layout_tests_path = webkit_finder.path_from_webkit_base('LayoutTests')
    171171        self.layout_tests_w3c_path = self.filesystem.join(self.layout_tests_path, self.tests_w3c_relative_path)
    172         self.tests_download_path = webkit_finder.path_from_webkit_base('WebKitBuild', 'w3c-tests')
     172        self.tests_download_path = WPTPaths.checkout_directory(webkit_finder)
    173173
    174174        self._test_downloader = None
  • trunk/Tools/Scripts/webkitpy/w3c/test_importer_unittest.py

    r245287 r246434  
    2626# SUCH DAMAGE.
    2727
     28import os
    2829import unittest
    2930
     
    210211        self.assertFalse(fs.exists('/mock-checkout/LayoutTests/w3c/web-platform-tests/dir-to-skip/test-to-skip.html'))
    211212
     213    def test_checkout_directory(self):
     214        FAKE_FILES = {
     215            '/mock-checkout/WebKitBuild2/w3c-tests/web-platform-tests/existing-test.html': '',
     216            '/mock-checkout/WebKitBuild2/w3c-tests/csswg-tests/test.html': '1',
     217        }
     218
     219        FAKE_FILES.update(FAKE_REPOSITORY)
     220
     221        os.environ['WEBKIT_OUTPUTDIR'] = '/mock-checkout/WebKitBuild2'
     222        try:
     223            fs = self.import_downloaded_tests(['--no-fetch', '--import-all', '-d', 'w3c'], FAKE_FILES)
     224        finally:
     225            del os.environ['WEBKIT_OUTPUTDIR']
     226
     227        self.assertTrue(fs.exists('/mock-checkout/LayoutTests/w3c/web-platform-tests/existing-test.html'))
     228
    212229    def test_clean_directory_option(self):
    213230        FAKE_FILES = {
Note: See TracChangeset for help on using the changeset viewer.