Title: [239303] trunk/Tools
- Revision
- 239303
- Author
- jbed...@apple.com
- Date
- 2018-12-17 16:12:06 -0800 (Mon, 17 Dec 2018)
Log Message
webkitpy: Handle case where stdout and stderr don't accept unicode
https://bugs.webkit.org/show_bug.cgi?id=192775
<rdar://problem/46497303>
Reviewed by Stephanie Lewis.
* Scripts/webkitpy/layout_tests/views/metered_stream.py:
(MeteredStream.write): If unicode cannot be written to the stream, replace unicode
characters with '?'.
* Scripts/webkitpy/layout_tests/views/metered_stream_unittest.py:
(RegularTest.test_stream_with_encoding):
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (239302 => 239303)
--- trunk/Tools/ChangeLog 2018-12-17 23:58:35 UTC (rev 239302)
+++ trunk/Tools/ChangeLog 2018-12-18 00:12:06 UTC (rev 239303)
@@ -1,3 +1,17 @@
+2018-12-17 Jonathan Bedard <jbed...@apple.com>
+
+ webkitpy: Handle case where stdout and stderr don't accept unicode
+ https://bugs.webkit.org/show_bug.cgi?id=192775
+ <rdar://problem/46497303>
+
+ Reviewed by Stephanie Lewis.
+
+ * Scripts/webkitpy/layout_tests/views/metered_stream.py:
+ (MeteredStream.write): If unicode cannot be written to the stream, replace unicode
+ characters with '?'.
+ * Scripts/webkitpy/layout_tests/views/metered_stream_unittest.py:
+ (RegularTest.test_stream_with_encoding):
+
2018-12-17 Daniel Bates <daba...@apple.com>
Support concatenating StringView with other string types
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/views/metered_stream.py (239302 => 239303)
--- trunk/Tools/Scripts/webkitpy/layout_tests/views/metered_stream.py 2018-12-17 23:58:35 UTC (rev 239302)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/views/metered_stream.py 2018-12-18 00:12:06 UTC (rev 239303)
@@ -107,7 +107,16 @@
if not self._isatty or self._verbose:
txt = self._ensure_newline(txt)
- self._stream.write(timestamp_string + txt)
+ try:
+ self._stream.write(timestamp_string + txt)
+ except UnicodeEncodeError:
+ output = ''
+ for c in timestamp_string + txt:
+ try:
+ output += '{}'.format(c)
+ except UnicodeEncodeError:
+ output += '?'
+ self._stream.write(output)
def writeln(self, txt, now=None, pid=None):
self.write(self._ensure_newline(txt), now, pid)
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/views/metered_stream_unittest.py (239302 => 239303)
--- trunk/Tools/Scripts/webkitpy/layout_tests/views/metered_stream_unittest.py 2018-12-17 23:58:35 UTC (rev 239302)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/views/metered_stream_unittest.py 2018-12-18 00:12:06 UTC (rev 239303)
@@ -117,7 +117,25 @@
self.logger.info('‘example’')
self.assertEqual(self.buflist[-1][-14:], '‘example’\n')
+ def test_stream_with_encoding(self):
+ class AsciiStream(StringIO.StringIO):
+ def write(self, s):
+ return StringIO.StringIO.write(self, '{}'.format(s))
+ stream = AsciiStream()
+
+ logger = logging.getLogger(__name__)
+ logger.setLevel(logging.DEBUG)
+ logger.propagate = False
+
+ try:
+ meter = MeteredStream(stream, self.verbose, logger, self.time_fn, 8675, print_timestamps=self.print_timestamps)
+ self.logger.info(u'\u2713')
+ self.assertEqual(stream.buflist[-1][-2:], '?\n')
+ finally:
+ meter.cleanup()
+
+
class TtyTest(RegularTest):
verbose = False
isatty = True
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes