Title: [123895] trunk/Tools
Revision
123895
Author
[email protected]
Date
2012-07-27 11:23:18 -0700 (Fri, 27 Jul 2012)

Log Message

nrwt: print filtered stderr after a crash correctly
https://bugs.webkit.org/show_bug.cgi?id=92428

Reviewed by Adam Barth.

Some ports will run the stderr output from DRT/WTR through a
filter after a crash in order to print a more useful stack
trace; while that gets written to the crash log correctly, we
don't log it to the debug output properly. This change fixes
that and makes it clearer that we're logging stderr, not the
crash log.

* Scripts/webkitpy/layout_tests/controllers/single_test_runner.py:
(SingleTestRunner._handle_error):
* Scripts/webkitpy/layout_tests/port/base.py:
(Port._get_crash_log):
* Scripts/webkitpy/layout_tests/port/chromium.py:
(ChromiumPort._get_crash_log):
* Scripts/webkitpy/layout_tests/port/chromium_android_unittest.py:
(ChromiumAndroidPortTest.test_get_crash_log):
* Scripts/webkitpy/layout_tests/port/driver.py:
(Driver.run_test):
* Scripts/webkitpy/layout_tests/port/gtk.py:
* Scripts/webkitpy/layout_tests/port/gtk_unittest.py:
* Scripts/webkitpy/layout_tests/port/mac.py:
(MacPort._get_crash_log):
* Scripts/webkitpy/layout_tests/port/port_testcase.py:
(PortTestCase.test_get_crash_log):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (123894 => 123895)


--- trunk/Tools/ChangeLog	2012-07-27 18:22:23 UTC (rev 123894)
+++ trunk/Tools/ChangeLog	2012-07-27 18:23:18 UTC (rev 123895)
@@ -1,5 +1,36 @@
 2012-07-27  Dirk Pranke  <[email protected]>
 
+        nrwt: print filtered stderr after a crash correctly
+        https://bugs.webkit.org/show_bug.cgi?id=92428
+
+        Reviewed by Adam Barth.
+
+        Some ports will run the stderr output from DRT/WTR through a
+        filter after a crash in order to print a more useful stack
+        trace; while that gets written to the crash log correctly, we
+        don't log it to the debug output properly. This change fixes
+        that and makes it clearer that we're logging stderr, not the
+        crash log.
+
+        * Scripts/webkitpy/layout_tests/controllers/single_test_runner.py:
+        (SingleTestRunner._handle_error):
+        * Scripts/webkitpy/layout_tests/port/base.py:
+        (Port._get_crash_log):
+        * Scripts/webkitpy/layout_tests/port/chromium.py:
+        (ChromiumPort._get_crash_log):
+        * Scripts/webkitpy/layout_tests/port/chromium_android_unittest.py:
+        (ChromiumAndroidPortTest.test_get_crash_log):
+        * Scripts/webkitpy/layout_tests/port/driver.py:
+        (Driver.run_test):
+        * Scripts/webkitpy/layout_tests/port/gtk.py:
+        * Scripts/webkitpy/layout_tests/port/gtk_unittest.py:
+        * Scripts/webkitpy/layout_tests/port/mac.py:
+        (MacPort._get_crash_log):
+        * Scripts/webkitpy/layout_tests/port/port_testcase.py:
+        (PortTestCase.test_get_crash_log):
+
+2012-07-27  Dirk Pranke  <[email protected]>
+
         nrwt: move image diffing code to a separate module
         https://bugs.webkit.org/show_bug.cgi?id=92447
 

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/controllers/single_test_runner.py (123894 => 123895)


--- trunk/Tools/Scripts/webkitpy/layout_tests/controllers/single_test_runner.py	2012-07-27 18:22:23 UTC (rev 123894)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/controllers/single_test_runner.py	2012-07-27 18:23:18 UTC (rev 123895)
@@ -199,9 +199,9 @@
                                                        driver_output.crashed_process_name,
                                                        driver_output.crashed_pid))
             if driver_output.error:
-                _log.debug("%s %s crashed, stack trace:" % (self._worker_name, testname))
+                _log.debug("%s %s crashed, (stderr lines):" % (self._worker_name, testname))
             else:
-                _log.debug("%s %s crashed, no stack trace" % (self._worker_name, testname))
+                _log.debug("%s %s crashed, (no stderr)" % (self._worker_name, testname))
         elif driver_output.error:
             _log.debug("%s %s output stderr lines:" % (self._worker_name, testname))
         for line in driver_output.error.splitlines():

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


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py	2012-07-27 18:22:23 UTC (rev 123894)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py	2012-07-27 18:23:18 UTC (rev 123895)
@@ -1220,9 +1220,9 @@
         pid_str = str(pid or '<unknown>')
         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,
+        return (stderr, '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))
+            '\n'.join(('STDERR: ' + l) for l in stderr_lines)))
 
     def look_for_new_crash_logs(self, crashed_processes, start_time):
         pass

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium.py (123894 => 123895)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium.py	2012-07-27 18:22:23 UTC (rev 123894)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium.py	2012-07-27 18:23:18 UTC (rev 123895)
@@ -356,14 +356,13 @@
         return repos
 
     def _get_crash_log(self, name, pid, stdout, stderr, newer_than):
-        new_stderr = stderr
         if stderr and 'AddressSanitizer' in stderr:
             asan_filter_path = self.path_from_chromium_base('tools', 'valgrind', 'asan', 'asan_symbolize.py')
             if self._filesystem.exists(asan_filter_path):
                 output = self._executive.run_command([asan_filter_path], input=stderr)
-                new_stderr = self._executive.run_command(['c++filt'], input=output)
+                stderr = self._executive.run_command(['c++filt'], input=output)
 
-        return super(ChromiumPort, self)._get_crash_log(name, pid, stdout, new_stderr, newer_than)
+        return super(ChromiumPort, self)._get_crash_log(name, pid, stdout, stderr, newer_than)
 
     def virtual_test_suites(self):
         return [

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_android_unittest.py (123894 => 123895)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_android_unittest.py	2012-07-27 18:22:23 UTC (rev 123894)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_android_unittest.py	2012-07-27 18:23:18 UTC (rev 123895)
@@ -104,7 +104,13 @@
         port._executive = MockExecutive2(run_command_fn=ChromiumAndroidPortTest.mock_run_command_fn)
         ChromiumAndroidPortTest.mock_logcat = 'logcat contents\n'
         self.assertEquals(port._get_crash_log('foo', 1234, 'out bar\nout baz\n', 'err bar\nerr baz\n', newer_than=None),
-            (u'crash log for foo (pid 1234):\n'
+            ('err bar\n'
+             'err baz\n'
+             '********* Tombstone file:\n'
+             '-rw------- 1000 1000 45316 2012-04-27 16:33 tombstone_03\n'
+             '/data/tombstones/tombstone_03\n'
+             'mock_contents\n',
+             u'crash log for foo (pid 1234):\n'
              u'STDOUT: out bar\n'
              u'STDOUT: out baz\n'
              u'STDOUT: ********* Logcat:\n'
@@ -116,7 +122,11 @@
              u'STDERR: /data/tombstones/tombstone_03\n'
              u'STDERR: mock_contents\n'))
         self.assertEquals(port._get_crash_log(None, None, None, None, newer_than=None),
-            (u'crash log for <unknown process name> (pid <unknown>):\n'
+            ('********* Tombstone file:\n'
+             '-rw------- 1000 1000 45316 2012-04-27 16:33 tombstone_03\n'
+             '/data/tombstones/tombstone_03\n'
+             'mock_contents\n',
+             u'crash log for <unknown process name> (pid <unknown>):\n'
              u'STDOUT: ********* Logcat:\n'
              u'STDOUT: logcat contents\n'
              u'STDERR: ********* Tombstone file:\n'

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/driver.py (123894 => 123895)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/driver.py	2012-07-27 18:22:23 UTC (rev 123894)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/driver.py	2012-07-27 18:23:18 UTC (rev 123895)
@@ -166,8 +166,8 @@
 
         crash_log = None
         if self.has_crashed():
-            crash_log = self._port._get_crash_log(self._crashed_process_name, self._crashed_pid, text, self.error_from_test,
-                                                  newer_than=start_time)
+            self.error_from_test, crash_log = self._port._get_crash_log(self._crashed_process_name,
+                self._crashed_pid, text, self.error_from_test, newer_than=start_time)
 
             # If we don't find a crash log use a placeholder error message instead.
             if not crash_log:

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/gtk.py (123894 => 123895)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/gtk.py	2012-07-27 18:22:23 UTC (rev 123894)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/gtk.py	2012-07-27 18:23:18 UTC (rev 123895)
@@ -166,8 +166,8 @@
 
 """ % locals()
 
-        return """\
+        return (stderr, """\
 Crash log for %(name)s (pid %(pid_representation)s):
 
 %(crash_log)s
-%(errors_str)s""" % locals()
+%(errors_str)s""" % locals())

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/gtk_unittest.py (123894 => 123895)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/gtk_unittest.py	2012-07-27 18:22:23 UTC (rev 123894)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/gtk_unittest.py	2012-07-27 18:23:18 UTC (rev 123895)
@@ -75,8 +75,10 @@
 
         port = self.make_port()
         port._get_gdb_output = mock_empty_crash_log
-        log = port._get_crash_log("DumpRenderTree", 28529, "", "", newer_than=None)
+        stderr, log = port._get_crash_log("DumpRenderTree", 28529, "", "", newer_than=None)
+        self.assertEqual(stderr, "")
         self.assertLinesEqual(log, mock_empty_crash_log)
 
-        log = port._get_crash_log("DumpRenderTree", 28529, "", "", newer_than=0.0)
+        stderr, log = port._get_crash_log("DumpRenderTree", 28529, "", "", newer_than=0.0)
+        self.assertEqual(stderr, "")
         self.assertLinesEqual(log, mock_empty_crash_log)

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/mac.py (123894 => 123895)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/mac.py	2012-07-27 18:22:23 UTC (rev 123894)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/mac.py	2012-07-27 18:23:18 UTC (rev 123895)
@@ -220,8 +220,8 @@
                 now = time_fn()
 
         if not crash_log:
-            return None
-        return crash_log
+            return (stderr, None)
+        return (stderr, crash_log)
 
     def look_for_new_crash_logs(self, crashed_processes, start_time):
         """Since crash logs can take a long time to be written out if the system is

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


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py	2012-07-27 18:22:23 UTC (rev 123894)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py	2012-07-27 18:23:18 UTC (rev 123895)
@@ -337,24 +337,28 @@
     def test_get_crash_log(self):
         port = self.make_port()
         self.assertEquals(port._get_crash_log(None, None, None, None, newer_than=None),
-           ('crash log for <unknown process name> (pid <unknown>):\n'
+           (None,
+            'crash log for <unknown process name> (pid <unknown>):\n'
             'STDOUT: <empty>\n'
             'STDERR: <empty>\n'))
 
         self.assertEquals(port._get_crash_log('foo', 1234, 'out bar\nout baz', 'err bar\nerr baz\n', newer_than=None),
-            ('crash log for foo (pid 1234):\n'
+            ('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', newer_than=None),
-            (u'crash log for foo (pid 1234):\n'
+            ('foo\xa6bar',
+             u'crash log for foo (pid 1234):\n'
              u'STDOUT: foo\ufffdbar\n'
              u'STDERR: foo\ufffdbar\n'))
 
         self.assertEquals(port._get_crash_log('foo', 1234, 'foo\xa6bar', 'foo\xa6bar', newer_than=1.0),
-            (u'crash log for foo (pid 1234):\n'
+            ('foo\xa6bar',
+             u'crash log for foo (pid 1234):\n'
              u'STDOUT: foo\ufffdbar\n'
              u'STDERR: foo\ufffdbar\n'))
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to