Title: [112594] trunk/Tools
Revision
112594
Author
[email protected]
Date
2012-03-29 15:53:28 -0700 (Thu, 29 Mar 2012)

Log Message

new-run-webkit-tests: crashes when it fails to decode a stack trace
https://bugs.webkit.org/show_bug.cgi?id=82673

Unreviewed, build fix.

We are assuming the stdout/stderr output from the driver is utf-8
encoded when we get stack traces; this may not be a valid
assumption generally, but if we do get strings that aren't valid
utf-8, we would crash. Now we will ignore any decoding errors.

* Scripts/webkitpy/layout_tests/port/base.py:
(Port._get_crash_log):
* Scripts/webkitpy/layout_tests/port/port_testcase.py:
(PortTestCase.test_get_crash_log):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (112593 => 112594)


--- trunk/Tools/ChangeLog	2012-03-29 22:50:34 UTC (rev 112593)
+++ trunk/Tools/ChangeLog	2012-03-29 22:53:28 UTC (rev 112594)
@@ -1,3 +1,20 @@
+2012-03-29  Dirk Pranke  <[email protected]>
+
+        new-run-webkit-tests: crashes when it fails to decode a stack trace
+        https://bugs.webkit.org/show_bug.cgi?id=82673
+
+        Unreviewed, build fix.
+
+        We are assuming the stdout/stderr output from the driver is utf-8
+        encoded when we get stack traces; this may not be a valid
+        assumption generally, but if we do get strings that aren't valid
+        utf-8, we would crash. Now we will ignore any decoding errors.
+
+        * Scripts/webkitpy/layout_tests/port/base.py:
+        (Port._get_crash_log):
+        * Scripts/webkitpy/layout_tests/port/port_testcase.py:
+        (PortTestCase.test_get_crash_log):
+
 2012-03-29  Simon Fraser  <[email protected]>
 
         Scripts fail to detect when a tool crashes

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py (112593 => 112594)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py	2012-03-29 22:50:34 UTC (rev 112593)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py	2012-03-29 22:53:28 UTC (rev 112594)
@@ -1054,8 +1054,8 @@
     def _get_crash_log(self, name, pid, stdout, stderr):
         name_str = name or '<unknown process name>'
         pid_str = str(pid or '<unknown>')
-        stdout_lines = (stdout or '<empty>').decode('utf8').splitlines()
-        stderr_lines = (stderr or '<empty>').decode('utf8').splitlines()
+        stdout_lines = (stdout or '<empty>').decode('utf8', 'replace').splitlines()
+        stderr_lines = (stderr or '<empty>').decode('utf8', 'replace').splitlines()
         return 'crash log for %s (pid %s):\n%s\n%s\n' % (name_str, pid_str,
             '\n'.join(('STDOUT: ' + l) for l in stdout_lines),
             '\n'.join(('STDERR: ' + l) for l in stderr_lines))

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py (112593 => 112594)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py	2012-03-29 22:50:34 UTC (rev 112593)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py	2012-03-29 22:53:28 UTC (rev 112594)
@@ -314,7 +314,19 @@
             'STDOUT: <empty>\n'
             'STDERR: <empty>\n'))
 
+        self.assertEquals(port._get_crash_log('foo', 1234, 'out bar\nout baz', 'err bar\nerr baz\n'),
+            ('crash log for foo (pid 1234):\n'
+             'STDOUT: out bar\n'
+             'STDOUT: out baz\n'
+             'STDERR: err bar\n'
+             'STDERR: err baz\n'))
 
+        self.assertEquals(port._get_crash_log('foo', 1234, 'foo\xa6bar', 'foo\xa6bar'),
+            (u'crash log for foo (pid 1234):\n'
+             u'STDOUT: foo\ufffdbar\n'
+             u'STDERR: foo\ufffdbar\n'))
+
+
 # FIXME: This class and main() should be merged into test-webkitpy.
 class EnhancedTestLoader(unittest.TestLoader):
     integration_tests = False
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to