WebKit Bugzilla
Attachment 340996 Details for
Bug 185876
: Do not convert testharness paths in import-w3c-tests
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-185876-20180522142703.patch (text/plain), 12.73 KB, created by
Chris Nardi
on 2018-05-22 11:27:03 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Chris Nardi
Created:
2018-05-22 11:27:03 PDT
Size:
12.73 KB
patch
obsolete
>Subversion Revision: 232070 >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 2a3510adfec8d562bc66590860f3392bfcfaaf06..6e8ede4d25d83b3975af0654ddaba8f0b62875ad 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,27 @@ >+2018-05-22 Chris Nardi <cnardi@chromium.org> >+ >+ Do not convert testharness paths in import-w3c-tests >+ https://bugs.webkit.org/show_bug.cgi?id=185876 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Since the csswg-tests repo was merged into WPT, there is only one test repository now in >+ imported/w3c/resources/TestRepositories, which does not specify the option to convert >+ testharness paths from relative paths to explicit paths. Additionally, wptserve has been >+ used for some time, so run-webkit-tests should have no problem with relative paths to >+ the testharness paths. Thus, there is no reason to continue converting testharness paths, >+ so this patch removes all code related to that conversion. >+ >+ * Scripts/webkitpy/w3c/test_converter.py: >+ (convert_for_webkit): >+ (_W3CTestConverter.__init__): >+ (_W3CTestConverter.convert_attributes_if_needed): >+ * Scripts/webkitpy/w3c/test_converter_unittest.py: >+ (verify_test_harness_paths): >+ * Scripts/webkitpy/w3c/test_importer.py: >+ (TestImporter.find_importable_tests): >+ (TestImporter.import_tests): >+ > 2018-05-22 Ryan Haddad <ryanhaddad@apple.com> > > Unreviewed, rolling out r232052. >diff --git a/Tools/Scripts/webkitpy/w3c/test_converter.py b/Tools/Scripts/webkitpy/w3c/test_converter.py >index 6e2996e9013655c08615505d169b06b3126b65ed..1f66e6982dc7d402c032580d0da3188f13521a35 100644 >--- a/Tools/Scripts/webkitpy/w3c/test_converter.py >+++ b/Tools/Scripts/webkitpy/w3c/test_converter.py >@@ -38,12 +38,12 @@ from HTMLParser import HTMLParser > _log = logging.getLogger(__name__) > > >-def convert_for_webkit(new_path, filename, reference_support_info, host=Host(), convert_test_harness_links=True): >+def convert_for_webkit(new_path, filename, reference_support_info, host=Host()): > """ Converts a file's |contents| so it will function correctly in its |new_path| in Webkit. > > Returns the list of modified properties and the modified text if the file was modifed, None otherwise.""" > contents = host.filesystem.read_binary_file(filename) >- converter = _W3CTestConverter(new_path, filename, reference_support_info, host, convert_test_harness_links) >+ converter = _W3CTestConverter(new_path, filename, reference_support_info, host) > if filename.endswith('.css'): > return converter.add_webkit_prefix_to_unprefixed_properties_and_values(contents) > else: >@@ -53,7 +53,7 @@ def convert_for_webkit(new_path, filename, reference_support_info, host=Host(), > > > class _W3CTestConverter(HTMLParser): >- def __init__(self, new_path, filename, reference_support_info, host=Host(), convert_test_harness_links=True): >+ def __init__(self, new_path, filename, reference_support_info, host=Host()): > HTMLParser.__init__(self) > > self._host = host >@@ -68,17 +68,10 @@ class _W3CTestConverter(HTMLParser): > self.filename = filename > self.reference_support_info = reference_support_info > >- resources_path = self.path_from_webkit_root('LayoutTests', 'resources') >- resources_relpath = self._filesystem.relpath(resources_path, new_path) >- self.new_test_harness_path = resources_relpath >- self.convert_test_harness_links = convert_test_harness_links >- > # These settings might vary between WebKit and Blink > css_property_file = self.path_from_webkit_root('Source', 'WebCore', 'css', 'CSSProperties.json') > css_property_value_file = self.path_from_webkit_root('Source', 'WebCore', 'css', 'CSSValueKeywords.in') > >- self.test_harness_re = re.compile('/resources/testharness') >- > self.prefixed_properties = self.read_webkit_prefixed_css_property_list(css_property_file) > prop_regex = '([\s{]|^)(' + "|".join(prop.replace('-webkit-', '') for prop in self.prefixed_properties) + ')(\s+:|:)' > self.prop_re = re.compile(prop_regex) >@@ -192,14 +185,6 @@ class _W3CTestConverter(HTMLParser): > > def convert_attributes_if_needed(self, tag, attrs): > converted = self.get_starttag_text() >- if self.convert_test_harness_links and tag in ('script', 'link'): >- attr_name = 'src' >- if tag != 'script': >- attr_name = 'href' >- for attr in attrs: >- if attr[0] == attr_name: >- new_path = re.sub(self.test_harness_re, self.new_test_harness_path + '/testharness', attr[1]) >- converted = re.sub(re.escape(attr[1]), new_path, converted) > > for attr in attrs: > if attr[0] == 'style': >diff --git a/Tools/Scripts/webkitpy/w3c/test_converter_unittest.py b/Tools/Scripts/webkitpy/w3c/test_converter_unittest.py >index 112e76a4bc67d0edf3f4f41b807e9047e06517f7..12ba33b7b78b40f51f2bffa6ca90d911cf2da373 100644 >--- a/Tools/Scripts/webkitpy/w3c/test_converter_unittest.py >+++ b/Tools/Scripts/webkitpy/w3c/test_converter_unittest.py >@@ -107,7 +107,7 @@ CONTENT OF TEST > converted = converter.output() > > self.verify_conversion_happened(converted) >- self.verify_test_harness_paths(converter, converted[2], fake_dir_path, 1, 1) >+ self.verify_test_harness_paths(converted[2], 1, 1) > self.verify_prefixed_properties(converted, []) > self.verify_prefixed_property_values(converted, []) > >@@ -143,7 +143,7 @@ CONTENT OF TEST > oc.restore_output() > > self.verify_conversion_happened(converted) >- self.verify_test_harness_paths(converter, converted[2], fake_dir_path, 1, 1) >+ self.verify_test_harness_paths(converted[2], 1, 1) > self.verify_prefixed_properties(converted, test_content[0]) > self.verify_prefixed_property_values(converted, test_content[1]) > >@@ -181,7 +181,7 @@ CONTENT OF TEST > oc.restore_output() > > self.verify_conversion_happened(converted) >- self.verify_test_harness_paths(converter, converted[2], fake_dir_path, 1, 1) >+ self.verify_test_harness_paths(converted[2], 1, 1) > self.verify_prefixed_properties(converted, test_content[0]) > self.verify_prefixed_property_values(converted, test_content[1]) > >@@ -207,7 +207,7 @@ CONTENT OF TEST > oc.restore_output() > > self.verify_conversion_happened(converted) >- self.verify_test_harness_paths(converter, converted[2], fake_dir_path, 2, 1) >+ self.verify_test_harness_paths(converted[2], 2, 1) > > def test_convert_prefixed_properties(self): > """ Tests convert_prefixed_properties() file that has 20 properties requiring the -webkit- prefix: >@@ -324,21 +324,13 @@ CONTENT OF TEST > def verify_no_conversion_happened(self, converted, original): > self.assertEqual(converted[2], original, 'test should not have been converted') > >- def verify_test_harness_paths(self, converter, converted, test_path, num_src_paths, num_href_paths): >+ def verify_test_harness_paths(self, converted, num_src_paths, num_href_paths): > if isinstance(converted, basestring): > converted = BeautifulSoup(converted) > >- resources_dir = converter.path_from_webkit_root("LayoutTests", "resources") >- >- # Verify the original paths are gone, and the new paths are present. >- orig_path_pattern = re.compile('\"/resources/testharness') >- self.assertEquals(len(converted.findAll(src=orig_path_pattern)), 0, 'testharness src path was not converted') >- self.assertEquals(len(converted.findAll(href=orig_path_pattern)), 0, 'testharness href path was not converted') >- >- new_relpath = os.path.relpath(resources_dir, test_path) >- relpath_pattern = re.compile(new_relpath) >- self.assertEquals(len(converted.findAll(src=relpath_pattern)), num_src_paths, 'testharness src relative path not correct') >- self.assertEquals(len(converted.findAll(href=relpath_pattern)), num_href_paths, 'testharness href relative path not correct') >+ orig_path_pattern = re.compile('^/resources/testharness') >+ self.assertEquals(len(converted.findAll(src=orig_path_pattern)), num_src_paths, 'testharness src path should not have been converted') >+ self.assertEquals(len(converted.findAll(href=orig_path_pattern)), num_href_paths, 'testharness href path should not have been converted') > > def verify_prefixed_properties(self, converted, test_properties): > self.assertEqual(len(set(converted[0])), len(set(test_properties)), 'Incorrect number of properties converted') >diff --git a/Tools/Scripts/webkitpy/w3c/test_importer.py b/Tools/Scripts/webkitpy/w3c/test_importer.py >index 421e3634ffc840fea6acabbc1221c83c855bd8b6..9e958a8db2fbbdd5d2cf5ef0e8064c2ccee1a6fb 100644 >--- a/Tools/Scripts/webkitpy/w3c/test_importer.py >+++ b/Tools/Scripts/webkitpy/w3c/test_importer.py >@@ -50,14 +50,11 @@ > 2. LayoutTests/imported/w3c/resources/ImportExpectations list the test suites or tests to NOT import. > > - All files are converted to work in WebKit: >- 1. Paths to testharness.js files are modified to point to Webkit's copy of them in >- LayoutTests/resources, using the correct relative path from the new location. >- This is applied to CSS tests but not to WPT tests. >- 2. All CSS properties requiring the -webkit-vendor prefix are prefixed - this current >+ 1. All CSS properties requiring the -webkit-vendor prefix are prefixed - this current > list of what needs prefixes is read from Source/WebCore/CSS/CSSProperties.in >- 3. Each reftest has its own copy of its reference file following the naming conventions >+ 2. Each reftest has its own copy of its reference file following the naming conventions > new-run-webkit-tests expects >- 4. If a reference files lives outside the directory of the test that uses it, it is checked >+ 3. If a reference files lives outside the directory of the test that uses it, it is checked > for paths to support files as it will be imported into a different relative position to the > test file (in the same directory) > >@@ -122,8 +119,6 @@ To import a web-platform-tests suite from a specific folder, use 'import-w3c-tes > > parser.add_argument('-n', '--no-overwrite', dest='overwrite', action='store_false', default=True, > help='Flag to prevent duplicate test files from overwriting existing tests. By default, they will be overwritten') >- parser.add_argument('-l', '--no-links-conversion', dest='convert_test_harness_links', action='store_false', default=True, >- help='Do not change links (testharness js or css e.g.). This option only applies when providing a source directory, in which case by default, links are converted to point to WebKit testharness files. When tests are downloaded from W3C repository, links are converted for CSS tests and remain unchanged for WPT tests') > > parser.add_argument('-t', '--tip-of-tree', dest='use_tip_of_tree', action='store_true', default=False, > help='Import all tests using the latest repository revision') >@@ -351,14 +346,6 @@ class TestImporter(object): > self.import_list.append({'dirname': root, 'copy_list': copy_list, > 'reftests': reftests, 'jstests': jstests, 'total_tests': total_tests}) > >- def should_convert_test_harness_links(self, test): >- if self._importing_downloaded_tests: >- for test_repository in self.test_downloader().test_repositories: >- if test.startswith(test_repository['name']): >- return 'convert_test_harness_links' in test_repository['import_options'] >- return True >- return self.options.convert_test_harness_links >- > def write_html_files_for_templated_js_tests(self, orig_filepath, new_filepath): > content = '<!-- This file is required for WebKit test infrastructure to run the templated test -->' > if (orig_filepath.endswith('.worker.js')): >@@ -445,7 +432,7 @@ class TestImporter(object): > mimetype = mimetypes.guess_type(orig_filepath) > if should_rewrite_files and ('html' in str(mimetype[0]) or 'xml' in str(mimetype[0]) or 'css' in str(mimetype[0])): > try: >- converted_file = convert_for_webkit(new_path, filename=orig_filepath, reference_support_info=reference_support_info, host=self.host, convert_test_harness_links=self.should_convert_test_harness_links(subpath)) >+ converted_file = convert_for_webkit(new_path, filename=orig_filepath, reference_support_info=reference_support_info, host=self.host) > except: > _log.warn('Failed converting %s', orig_filepath) > failed_conversion_files.append(orig_filepath)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 185876
: 340996