Title: [285198] trunk/Tools
Revision
285198
Author
[email protected]
Date
2021-11-02 20:37:50 -0700 (Tue, 02 Nov 2021)

Log Message

UnicodeDecodeError in write_reftest copying a non-UTF8 expected result file
https://bugs.webkit.org/show_bug.cgi?id=232643

Reviewed by Alexey Proskuryakov.

* Scripts/webkitpy/layout_tests/controllers/test_result_writer.py:
(TestResultWriter.write_reftest):
If a reftest's -expected.html file is not valid UTF-8, and the test fails,
when we copy the expected file from the layout tests directory to the
test results directory, we attempt to parse it as UTF-8, resulting in
an exception being thrown.

Instead of needlessly reading in the file as a string and immediately
writing it back out, just copy the file...

I'm not sure there are any not-valid-UTF-8 *ref* tests in the tree, but
there is at least one not-valid-UTF-8 *text* test, which can be run
as a ref-test in some scenarios (see r285132), in which case this problem
occurs: fast/css/line-height-determined-by-primary-font.html.

Also, explicitly ensure the output directory exists before copying
to avoid regressing r122505. Previously this was done inside _write_text_file.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (285197 => 285198)


--- trunk/Tools/ChangeLog	2021-11-03 03:23:51 UTC (rev 285197)
+++ trunk/Tools/ChangeLog	2021-11-03 03:37:50 UTC (rev 285198)
@@ -1,3 +1,28 @@
+2021-11-02  Tim Horton  <[email protected]>
+
+        UnicodeDecodeError in write_reftest copying a non-UTF8 expected result file
+        https://bugs.webkit.org/show_bug.cgi?id=232643
+
+        Reviewed by Alexey Proskuryakov.
+
+        * Scripts/webkitpy/layout_tests/controllers/test_result_writer.py:
+        (TestResultWriter.write_reftest):
+        If a reftest's -expected.html file is not valid UTF-8, and the test fails,
+        when we copy the expected file from the layout tests directory to the
+        test results directory, we attempt to parse it as UTF-8, resulting in
+        an exception being thrown.
+
+        Instead of needlessly reading in the file as a string and immediately
+        writing it back out, just copy the file...
+
+        I'm not sure there are any not-valid-UTF-8 *ref* tests in the tree, but
+        there is at least one not-valid-UTF-8 *text* test, which can be run
+        as a ref-test in some scenarios (see r285132), in which case this problem
+        occurs: fast/css/line-height-determined-by-primary-font.html.
+
+        Also, explicitly ensure the output directory exists before copying
+        to avoid regressing r122505. Previously this was done inside _write_text_file.
+
 2021-11-02  Per Arne  <[email protected]>
 
         REGRESSION (r268421): TestWebKitAPI.WebKit.PreferenceChanges* tests are flaky failures

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/controllers/test_result_writer.py (285197 => 285198)


--- trunk/Tools/Scripts/webkitpy/layout_tests/controllers/test_result_writer.py	2021-11-03 03:23:51 UTC (rev 285197)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/controllers/test_result_writer.py	2021-11-03 03:37:50 UTC (rev 285198)
@@ -205,4 +205,5 @@
         fs = self._filesystem
         dst_dir = fs.dirname(fs.join(self._root_output_dir, self._test_name))
         dst_filepath = fs.join(dst_dir, fs.basename(src_filepath))
-        self._write_text_file(dst_filepath, fs.read_text_file(src_filepath))
+        self._make_output_directory()
+        fs.copyfile(src_filepath, dst_filepath)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to