Tools/ChangeLog

 12015-03-20 Youenn Fablet <youenn.fablet@crf.canon.fr>
 2
 3 W3C test importer should generate the modules installed dynamically to run wpt tests
 4 https://bugs.webkit.org/show_bug.cgi?id=142738
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 The test importer can now generate the submodules description file based on information extracted from the corresponding git repository.
 9 The implementation is done within TestDownloader and it is activated for the WPT repository.
 10 LayoutTests/imported/w3c/resources/WPTModules is renamed as LayoutTests/imported/w3c/resources/web-platform-tests-modules.json for that reason.
 11
 12 * Scripts/webkitpy/layout_tests/servers/web_platform_test_server.py:
 13 (WebPlatformTestServer._install_modules): Updated to cope with path as array.
 14 * Scripts/webkitpy/w3c/test_downloader.py:
 15 (TestDownloader._git_submodules_status): Added so that it can be overriden for unit tests.
 16 (TestDownloader):
 17 (TestDownloader._git_submodules_description): Computes submodule description.
 18 (TestDownloader.generate_git_submodules_description): Write submodule description in a file.
 19 * Scripts/webkitpy/w3c/test_importer.py:
 20 (TestImporter.do_import): Added the possibility to post process the tests.
 21 (TestImporter):
 22 (TestImporter.process_test_repositories_import_options): Enable generating module description file.
 23 (TestImporter.should_convert_test_harness_links): Updated according new options format.
 24 * Scripts/webkitpy/w3c/test_importer_unittest.py:
 25 (TestImporterTest.import_downloaded_tests): Making use of TestDownloaderMock.
 26 (TestImporterTest.import_downloaded_tests.TestDownloaderMock): Added to override submodule status gathering.
 27 (TestImporterTest.import_downloaded_tests.TestDownloaderMock.__init__):
 28 (TestImporterTest.import_downloaded_tests.TestDownloaderMock._git_submodules_status):
 29 (TestImporterTest.test_submodules_generation): Added to check that modules description files works.
 30
1312015-03-18 Csaba Osztrogonác <ossy@webkit.org>
232
333 [EFL] Bump gstreamer version to 1.4.4

Tools/Scripts/webkitpy/layout_tests/servers/web_platform_test_server.py

@@class WebPlatformTestServer(http_server_base.HttpServerBase):
7979 self._doc_root_path = port_obj.path_from_webkit_base("LayoutTests", self._doc_root)
8080
8181 def _install_modules(self):
82  modules_file_path = self._filesystem.join(self._layout_root, "imported", "w3c", "resources", "WPTModules")
 82 modules_file_path = self._filesystem.join(self._layout_root, "imported", "w3c", "resources", "web-platform-tests-modules.json")
8383 if not self._filesystem.isfile(modules_file_path):
8484 _log.warning("Cannot read " + modules_file_path)
8585 return
8686 modules = json.loads(self._filesystem.read_text_file(modules_file_path))
8787 for module in modules:
88  AutoInstaller(target_dir=self._filesystem.join(self._doc_root, module["path"])).install(url=module["url"], url_subpath=module["url_subpath"], target_name=module["name"])
 88 AutoInstaller(target_dir=self._filesystem.join(self._doc_root, self._filesystem.sep.join(module["path"]))).install(url=module["url"], url_subpath=module["url_subpath"], target_name=module["name"])
8989
9090 def _copy_webkit_test_files(self):
9191 _log.debug('Copying WebKit resources files')

Tools/Scripts/webkitpy/w3c/test_downloader.py

@@class TestDownloader(object):
149149 if self._filesystem.isfile(destination_path):
150150 self._filesystem.remove(destination_path)
151151
 152 def _git_submodules_status(self, repository_directory):
 153 return self.git(repository_directory)._run_git(['submodule', 'status'])
 154
 155 def _git_submodules_description(self, test_repository):
 156 submodules = []
 157 repository_directory = self._filesystem.join(self.repository_directory, test_repository['name'])
 158 if self._filesystem.isfile(self._filesystem.join(repository_directory, '.gitmodules')):
 159 submodule = {}
 160 for line in self._filesystem.read_text_file(self._filesystem.join(repository_directory, '.gitmodules')).splitlines():
 161 line = line.strip()
 162 if line.startswith('path = '):
 163 submodule['path'] = line[7:]
 164 elif line.startswith('url = '):
 165 submodule['url'] = line[6:]
 166 if not submodule['url'].startswith('https://github.com/'):
 167 _log.warning('Submodule %s is not hosted on github' % submodule['path'])
 168 _log.warning('Please ensure that generated URL points to an archive of the module or manually edit its value after the import')
 169 submodules.append(submodule)
 170 submodule = {}
 171
 172 submodules_status = [line[1:].split(' ') for line in self._git_submodules_status(repository_directory).splitlines()]
 173 for submodule in submodules:
 174 for status in submodules_status:
 175 if submodule['path'] == status[1]:
 176 url = submodule['url'][:-4]
 177 version = status[0]
 178 repository_name = url.split('/').pop()
 179 submodule['url'] = url + '/archive/' + version + '.tar.gz'
 180 submodule['url_subpath'] = repository_name + '-' + version
 181 if '/' in submodule['path']:
 182 steps = submodule['path'].split('/')
 183 submodule['name'] = steps.pop()
 184 submodule['path'] = steps
 185 else:
 186 submodule['name'] = submodule['path']
 187 submodule['path'] = ['.']
 188 return submodules
 189
 190 def generate_git_submodules_description(self, test_repository, filepath):
 191 self._filesystem.write_text_file(filepath, json.dumps(self._git_submodules_description(test_repository), sort_keys=True, indent=4))
 192
152193 def download_tests(self, destination_directory, test_paths=[]):
153194 for test_repository in self.test_repositories:
154195 self.checkout_test_repository(test_repository['revision'], test_repository['url'], self._filesystem.join(self.repository_directory, test_repository['name']))

Tools/Scripts/webkitpy/w3c/test_importer.py

@@class TestImporter(object):
190190
191191 self.import_tests()
192192
 193 if self._importing_downloaded_tests:
 194 self.process_test_repositories_import_options()
 195
 196 def process_test_repositories_import_options(self):
 197 for test_repository in self._test_downloader.test_repositories:
 198 if 'generate_git_submodules_description' in test_repository['import_options']:
 199 self.filesystem.maybe_make_directory(self.filesystem.join(self.destination_directory, 'resources'))
 200 self._test_downloader.generate_git_submodules_description(test_repository, self.filesystem.join(self.destination_directory, 'resources', test_repository['name'] + '-modules.json'))
 201 # FIXME: Generate WPT .gitignore and main __init__.py
 202
193203 def test_downloader(self):
194204 if not self._test_downloader:
195205 download_options = TestDownloader.default_options()

@@class TestImporter(object):
281291 if self._importing_downloaded_tests:
282292 for test_repository in self.test_downloader().test_repositories:
283293 if test.startswith(test_repository['name']):
284  return test_repository['convert_test_harness_links']
 294 return 'convert_test_harness_links' in test_repository['import_options']
285295 return True
286296 return self.options.convert_test_harness_links
287297

Tools/Scripts/webkitpy/w3c/test_importer_unittest.py

@@from webkitpy.common.host_mock import MockHost
3434from webkitpy.common.system.filesystem_mock import MockFileSystem
3535from webkitpy.common.system.executive_mock import MockExecutive2, ScriptError
3636from webkitpy.common.system.outputcapture import OutputCapture
 37from webkitpy.w3c.test_downloader import TestDownloader
3738from webkitpy.w3c.test_importer import parse_args, TestImporter
3839
3940

@@class TestImporterTest(unittest.TestCase):
9293
9394 def import_downloaded_tests(self, args, files):
9495 # files are passed as parameter as we cannot clone/fetch/checkout a repo in mock system.
 96
 97 class TestDownloaderMock(TestDownloader):
 98 def __init__(self, repository_directory, host, options):
 99 TestDownloader.__init__(self, repository_directory, host, options)
 100
 101 def _git_submodules_status(self, repository_directory):
 102 return 'adb4d391a69877d4a1eaaf51d1725c99a5b8ed84 tools/resources'
 103
95104 host = MockHost()
96105 host.executive = MockExecutive2()
97106 host.filesystem = MockFileSystem(files=files)
98107
99108 options, args = parse_args(args)
100109 importer = TestImporter(host, None, options)
 110 importer._test_downloader = TestDownloaderMock(importer.tests_download_path, importer.host, importer.options)
101111 importer.do_import()
102112 return host.filesystem
103113

@@class TestImporterTest(unittest.TestCase):
116126 self.assertTrue('src="/resources/testharness.js"' in fs.read_text_file('/mock-checkout/LayoutTests/w3c/web-platform-tests/t/test.html'))
117127 self.assertTrue('src="../' in fs.read_text_file('/mock-checkout/LayoutTests/w3c/csswg-tests/t/test.html'))
118128
 129 def test_submodules_generation(self):
 130 FAKE_FILES = {
 131 '/mock-checkout/WebKitBuild/w3c-tests/csswg-tests/.gitmodules': '[submodule "tools/resources"]\n path = tools/resources\n url = https://github.com/w3c/testharness.js.git\n ignore = dirty\n',
 132 '/mock-checkout/WebKitBuild/w3c-tests/web-platform-tests/.gitmodules': '[submodule "tools/resources"]\n path = tools/resources\n url = https://github.com/w3c/testharness.js.git\n ignore = dirty\n',
 133 }
 134
 135 fs = self.import_downloaded_tests(['--no-fetch', '--import-all', '-d', 'w3c'], FAKE_FILES)
 136
 137 self.assertFalse(fs.exists('/mock-checkout/LayoutTests/w3c/resources/csswg-tests-modules.json'))
 138 self.assertTrue(fs.exists('/mock-checkout/LayoutTests/w3c/resources/web-platform-tests-modules.json'))
 139 self.assertTrue('https://github.com/w3c/testharness.js/archive/db4d391a69877d4a1eaaf51d1725c99a5b8ed84.tar.gz' in fs.read_text_file('/mock-checkout/LayoutTests/w3c/resources/web-platform-tests-modules.json'))
 140
 141
119142 # FIXME: Needs more tests.

LayoutTests/imported/w3c/ChangeLog

 12015-03-20 Youenn Fablet <youenn.fablet@crf.canon.fr>
 2
 3 W3C test importer should generate the modules installed dynamically to run wpt tests
 4 https://bugs.webkit.org/show_bug.cgi?id=142738
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Renamed WPTModules to web-platform-test-modules.json
 9 Updated TestRepositories to ask the importer to generate web-platform-test-modules.json at import time.
 10
 11 * resources/TestRepositories:
 12 * resources/WPTModules: Removed.
 13 * resources/web-platform-tests-modules.json: Added.
 14
1152015-03-13 Youenn Fablet <youenn.fablet@crf.canon.fr>
216
317 WebKit test infrastructure should automate the process of cloning W3C test suite and importing tests from it

LayoutTests/imported/w3c/resources/TestRepositories

1010 "paths_to_import": [
1111 "support"
1212 ],
13  "convert_test_harness_links": true
 13 "import_options": ["convert_test_harness_links"]
1414 },
1515 {
1616 "name": "web-platform-tests",

3030 "config.default.json",
3131 "serve.py"
3232 ],
33  "convert_test_harness_links": false
 33 "import_options": ["generate_git_submodules_description"]
3434 }
3535]

LayoutTests/imported/w3c/resources/WPTModules

1 [
2 {
3  "name": "html5lib",
4  "path": "tools",
5  "url": "https://github.com/html5lib/html5lib-python/archive/7cce65bbaa78411f98b8b37eeefc9db03c580097.tar.gz",
6  "url_subpath": "html5lib-python-7cce65bbaa78411f98b8b37eeefc9db03c580097"
7 },
8 {
9  "name": "pywebsocket",
10  "path": "tools",
11  "url": "https://github.com/w3c/pywebsocket/archive/8c285d9015121e8c1c40be852439fc03b4a18112.tar.gz",
12  "url_subpath": "pywebsocket-8c285d9015121e8c1c40be852439fc03b4a18112"
13 },
14 {
15  "name": "six",
16  "path": "tools",
17  "url": "https://github.com/jgraham/six/archive/3b6173c833d217ab0186c355804f5925cbcfca47.tar.gz",
18  "url_subpath": "six-3b6173c833d217ab0186c355804f5925cbcfca47"
19 },
20 {
21  "name": "wptserve",
22  "path": "tools",
23  "url": "https://github.com/w3c/wptserve/archive/91e764ffa0f587090341a26af457dfdc6762eb0d.tar.gz",
24  "url_subpath": "wptserve-91e764ffa0f587090341a26af457dfdc6762eb0d"
25 },
26 {
27  "name": "resources",
28  "path": ".",
29  "url": "https://github.com/w3c/testharness.js/archive/74ba13d2fbb19c6e7494960bd7724873e88c523c.tar.gz",
30  "url_subpath": "testharness.js-74ba13d2fbb19c6e7494960bd7724873e88c523c"
31 }
32 ]

LayoutTests/imported/w3c/resources/web-platform-tests-modules.json

 1[
 2 {
 3 "name": "resources",
 4 "path": [
 5 "."
 6 ],
 7 "url": "https://github.com/w3c/testharness.js/archive/2a1da264f6718db04c3925a9956b635426827aef.tar.gz",
 8 "url_subpath": "testharness.js-2a1da264f6718db04c3925a9956b635426827aef"
 9 },
 10 {
 11 "name": "wptserve",
 12 "path": [
 13 "tools"
 14 ],
 15 "url": "https://github.com/w3c/wptserve/archive/91e764ffa0f587090341a26af457dfdc6762eb0d.tar.gz",
 16 "url_subpath": "wptserve-91e764ffa0f587090341a26af457dfdc6762eb0d"
 17 },
 18 {
 19 "name": "pywebsocket",
 20 "path": [
 21 "tools"
 22 ],
 23 "url": "https://github.com/w3c/pywebsocket/archive/8c285d9015121e8c1c40be852439fc03b4a18112.tar.gz",
 24 "url_subpath": "pywebsocket-8c285d9015121e8c1c40be852439fc03b4a18112"
 25 },
 26 {
 27 "name": "html5lib",
 28 "path": [
 29 "tools"
 30 ],
 31 "url": "https://github.com/html5lib/html5lib-python/archive/7cce65bbaa78411f98b8b37eeefc9db03c580097.tar.gz",
 32 "url_subpath": "html5lib-python-7cce65bbaa78411f98b8b37eeefc9db03c580097"
 33 },
 34 {
 35 "name": "six",
 36 "path": [
 37 "tools"
 38 ],
 39 "url": "https://github.com/jgraham/six/archive/3b6173c833d217ab0186c355804f5925cbcfca47.tar.gz",
 40 "url_subpath": "six-3b6173c833d217ab0186c355804f5925cbcfca47"
 41 }
 42]