W3C Importer: Error importing svgz file |
|||||
Issue descriptionThe css-ui-3/ test suite includes a svgz (gzipped SVG) file: https://github.com/w3c/csswg-test/blob/master/css-ui-3/support/cursors/woolly-64.svgz The problem is that when you run the script to import the test suite you get the following error: # err> imported/csswg-test/css-ui-3/support/cursors/woolly-64.svgz # err> Traceback (most recent call last): # err> File "/home/igalia/mrego/chromium/src/third_party/WebKit/Tools/Scripts/import-w3c-tests", line 35, in <module> # err> sys.exit(test_importer.main(sys.argv[1:], sys.stdout, sys.stderr)) # err> File "/home/igalia/mrego/chromium/src/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_importer.py", line 99, in main # err> test_importer.do_import() # err> File "/home/igalia/mrego/chromium/src/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_importer.py", line 168, in do_import # err> self.import_tests() # err> File "/home/igalia/mrego/chromium/src/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_importer.py", line 345, in import_tests # err> copied_file = self.copy_file(file_to_copy, dest_dir) # err> File "/home/igalia/mrego/chromium/src/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_importer.py", line 415, in copy_file # err> host=self.host) # err> File "/home/igalia/mrego/chromium/src/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_converter.py", line 63, in convert_for_webkit # err> converter.feed(contents.decode('utf-16')) # err> File "/usr/lib/python2.7/encodings/utf_16.py", line 16, in decode # err> return codecs.utf_16_decode(input, errors, True) # err> UnicodeDecodeError: 'utf16' codec can't decode bytes in position 34-35: illegal encoding Maybe it's not needed that the script decodes() this kind of files: https://cs.chromium.org/chromium/src/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_converter.py?l=39
,
Nov 29 2016
qyearsley@, I guess the script could have a whitelist of filename patterns to attempt converting?
,
Nov 30 2016
BTW, I've skipped that file and test in the CL importing css-ui-3 test suite: https://codereview.chromium.org/2539753002/ Once this is fixed we could unskip the file and associated test at: LayoutTests/W3CImportExpectations
,
Dec 1 2016
Issue 670251 has been merged into this issue.
,
Dec 1 2016
@kojii, if you prefer we can land: https://codereview.chromium.org/2536163002/ While this is not properly fixed, using a whilteliste like @foolip proposed. What do you think?
,
Dec 1 2016
,
Dec 1 2016
Re #2: I think that's a good idea -- we're hoping that converting is something that we can stop doing as soon as possible ( bug 663773 ), and there are already a bunch of rules about what files to skip. Although we can skip particular instances of a file type in W3CImportExpectations, other similar cases might appear later, so for now, adding a whitelist of file types to try converting sounds reasonable. Actually, there already is a whitelist of filetypes to import: in test_importer.py, there is: # Only HTML, XML, or CSS should be converted. mimetype = mimetypes.guess_type(source_path) if 'is_jstest' not in file_to_copy and ( 'html' in str(mimetype[0]) or 'xml' in str(mimetype[0]) or 'css' in str(mimetype[0])): ... convert ... The problem is that mimetypes.guess_type('foo.svgz') returns ('image/svg+xml). In reality, right now we only need to convert a few .html and .xht files, and everything else we can skip. Uploaded https://codereview.chromium.org/2542963002 to fix the whitelist so that it won't include svgz files.
,
Dec 2 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/5de62df3ed22e2354fa705b0ac7a819fc66d8767 commit 5de62df3ed22e2354fa705b0ac7a819fc66d8767 Author: qyearsley <qyearsley@chromium.org> Date: Fri Dec 02 22:46:04 2016 W3C Importer: Consolidate and simplify logic for deciding what not to convert. In this CL: - Move existing logic related to what files to skip from import_tests() and convert_for_webkit() into one method called should_try_to_convert(). - Change rule so that before trying to convert the mimetype must appear to be text/html, text/css, or application/xhtml+xml. Note that this could be changed to skip .css files too now, since no .css files are currently being converted on import. BUG= 669452 Review-Url: https://codereview.chromium.org/2542963002 Cr-Commit-Position: refs/heads/master@{#436063} [modify] https://crrev.com/5de62df3ed22e2354fa705b0ac7a819fc66d8767/third_party/WebKit/LayoutTests/W3CImportExpectations [modify] https://crrev.com/5de62df3ed22e2354fa705b0ac7a819fc66d8767/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_converter.py [modify] https://crrev.com/5de62df3ed22e2354fa705b0ac7a819fc66d8767/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_importer.py [modify] https://crrev.com/5de62df3ed22e2354fa705b0ac7a819fc66d8767/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_importer_unittest.py
,
Dec 5 2016
|
|||||
►
Sign in to add a comment |
|||||
Comment 1 by r...@igalia.com
, Nov 29 2016