Title: [89899] trunk/Tools
Revision
89899
Author
[email protected]
Date
2011-06-28 00:30:19 -0700 (Tue, 28 Jun 2011)

Log Message

2011-06-27  Adam Barth  <[email protected]>

        Reviewed by Eric Seidel.

        NRWT should wait for ReportCrash
        https://bugs.webkit.org/show_bug.cgi?id=63495

        When a test crashes on Mac, ReportCrash confuses us into thinking the
        test times out.

        I'm not sure how to test this in a meaningful way in our current test
        harness...

        * Scripts/webkitpy/common/system/crashlogs.py:
        * Scripts/webkitpy/common/system/crashlogs_unittest.py:
        * Scripts/webkitpy/layout_tests/layout_package/test_result_writer.py:
        * Scripts/webkitpy/layout_tests/port/base.py:
        * Scripts/webkitpy/layout_tests/port/mac.py:
        * Scripts/webkitpy/layout_tests/port/server_process.py:
        * Scripts/webkitpy/tool/commands/queries.py:

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (89898 => 89899)


--- trunk/Tools/ChangeLog	2011-06-28 07:25:29 UTC (rev 89898)
+++ trunk/Tools/ChangeLog	2011-06-28 07:30:19 UTC (rev 89899)
@@ -1,3 +1,24 @@
+2011-06-27  Adam Barth  <[email protected]>
+
+        Reviewed by Eric Seidel.
+
+        NRWT should wait for ReportCrash
+        https://bugs.webkit.org/show_bug.cgi?id=63495
+
+        When a test crashes on Mac, ReportCrash confuses us into thinking the
+        test times out.
+
+        I'm not sure how to test this in a meaningful way in our current test
+        harness...
+
+        * Scripts/webkitpy/common/system/crashlogs.py:
+        * Scripts/webkitpy/common/system/crashlogs_unittest.py:
+        * Scripts/webkitpy/layout_tests/layout_package/test_result_writer.py:
+        * Scripts/webkitpy/layout_tests/port/base.py:
+        * Scripts/webkitpy/layout_tests/port/mac.py:
+        * Scripts/webkitpy/layout_tests/port/server_process.py:
+        * Scripts/webkitpy/tool/commands/queries.py:
+
 2011-06-27  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r89881.

Modified: trunk/Tools/Scripts/webkitpy/common/system/crashlogs.py (89898 => 89899)


--- trunk/Tools/Scripts/webkitpy/common/system/crashlogs.py	2011-06-28 07:25:29 UTC (rev 89898)
+++ trunk/Tools/Scripts/webkitpy/common/system/crashlogs.py	2011-06-28 07:30:19 UTC (rev 89899)
@@ -36,8 +36,7 @@
 
 
 class CrashLogs(object):
-    def __init__(self, executive, filesystem):
-        self._executive = executive
+    def __init__(self, filesystem):
         self._filesystem = filesystem
 
     def find_newest_log(self, process_name):
@@ -61,8 +60,4 @@
         logs = self._filesystem.files_under(log_directory, file_filter=is_crash_log)
         if not logs:
             return
-
-        # FIXME: We should wait for the CrashReporter to finish, but that causes tests to timeout.
-        if False:
-            self._executive.wait_newest(_is_crash_reporter)
         return self._filesystem.read_text_file(sorted(logs)[-1])

Modified: trunk/Tools/Scripts/webkitpy/common/system/crashlogs_unittest.py (89898 => 89899)


--- trunk/Tools/Scripts/webkitpy/common/system/crashlogs_unittest.py	2011-06-28 07:25:29 UTC (rev 89898)
+++ trunk/Tools/Scripts/webkitpy/common/system/crashlogs_unittest.py	2011-06-28 07:30:19 UTC (rev 89899)
@@ -37,6 +37,6 @@
         files = {}
         files['/Users/mock/Library/Logs/DiagnosticReports/TextMate_2011-06-13-150719_quadzen.crash'] = mock_crash_report
         filesystem = MockFileSystem(files)
-        crash_logs = CrashLogs(Mock(), filesystem)
+        crash_logs = CrashLogs(filesystem)
         log = crash_logs.find_newest_log("TextMate")
         self.assertTrue(log, mock_crash_report)

Modified: trunk/Tools/Scripts/webkitpy/common/system/executive.py (89898 => 89899)


--- trunk/Tools/Scripts/webkitpy/common/system/executive.py	2011-06-28 07:25:29 UTC (rev 89898)
+++ trunk/Tools/Scripts/webkitpy/common/system/executive.py	2011-06-28 07:30:19 UTC (rev 89899)
@@ -296,7 +296,8 @@
         running_pids = []
 
         if sys.platform in ("win32", "cygwin"):
-            raise NotImplemented()
+            # FIXME: running_pids isn't implemented on Windows yet...
+            return []
 
         ps_process = self.popen(['ps', '-eo', 'pid,comm'], stdout=self.PIPE, stderr=self.PIPE)
         stdout, _ = ps_process.communicate()

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/test_result_writer.py (89898 => 89899)


--- trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/test_result_writer.py	2011-06-28 07:25:29 UTC (rev 89898)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/test_result_writer.py	2011-06-28 07:30:19 UTC (rev 89899)
@@ -173,7 +173,7 @@
         filename = self.output_filename(self.FILENAME_SUFFIX_CRASH_LOG + ".txt")
         fs.maybe_make_directory(fs.dirname(filename))
         # FIXME: We shouldn't be grabbing private members of port.
-        crash_logs = CrashLogs(self._port._executive, fs)
+        crash_logs = CrashLogs(fs)
         log = crash_logs.find_newest_log(self._port.driver_name())
         # CrashLogs doesn't support every platform, so we fall back to
         # including the stderr output, which is admittedly somewhat redundant.

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


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py	2011-06-28 07:25:29 UTC (rev 89898)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py	2011-06-28 07:30:19 UTC (rev 89899)
@@ -288,6 +288,9 @@
                                     actual_filename)
         return ''.join(diff)
 
+    def is_crash_reporter(self, process_name):
+        return False
+
     def driver_name(self):
         """Returns the name of the actual binary that is performing the test,
         so that it can be referred to in log messages. In most cases this

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


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/mac.py	2011-06-28 07:25:29 UTC (rev 89898)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/mac.py	2011-06-28 07:30:19 UTC (rev 89899)
@@ -30,6 +30,7 @@
 
 import logging
 import platform
+import re
 
 from webkitpy.layout_tests.port.webkit import WebKitPort
 
@@ -99,6 +100,9 @@
         return self.path_from_webkit_base('LayoutTests', 'platform',
            'mac', 'test_expectations.txt')
 
+    def is_crash_reporter(self, process_name):
+        return re.search(r'ReportCrash', process_name)
+
     def _skipped_file_paths(self):
         # FIXME: This method will need to be made work for non-mac
         # platforms and moved into base.Port.

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/server_process.py (89898 => 89899)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/server_process.py	2011-06-28 07:25:29 UTC (rev 89898)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/server_process.py	2011-06-28 07:30:19 UTC (rev 89899)
@@ -159,6 +159,13 @@
                              'non-positive size: %d ' % size)
         return self._read(timeout, size)
 
+    def _check_for_crash(self):
+        # poll() is not threadsafe and can throw OSError due to:
+        # http://bugs.python.org/issue1731717
+        if self._proc.poll() != None:
+            self.crashed = True
+            self.handle_interrupt()
+
     def _read(self, timeout, size):
         """Internal routine that actually does the read."""
         index = -1
@@ -167,14 +174,15 @@
         select_fds = (out_fd, err_fd)
         deadline = time.time() + timeout
         while not self.timed_out and not self.crashed:
-            # poll() is not threadsafe and can throw OSError due to:
-            # http://bugs.python.org/issue1731717
-            if self._proc.poll() != None:
-                self.crashed = True
-                self.handle_interrupt()
+            self._check_for_crash()
 
             now = time.time()
             if now > deadline:
+                if self._executive.running_pids(self._port.is_crash_reporter):
+                    _log.warning('Waiting for crash reporter...')
+                    self._executive.wait_newest(self._port.is_crash_reporter)
+                    if not self.crashed:
+                        self._check_for_crash()
                 self.timed_out = True
 
             # Check to see if we have any output we can return.

Modified: trunk/Tools/Scripts/webkitpy/tool/commands/queries.py (89898 => 89899)


--- trunk/Tools/Scripts/webkitpy/tool/commands/queries.py	2011-06-28 07:25:29 UTC (rev 89898)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/queries.py	2011-06-28 07:30:19 UTC (rev 89899)
@@ -373,7 +373,7 @@
     argument_names = "PROCESS_NAME"
 
     def execute(self, options, args, tool):
-        crash_logs = CrashLogs(tool.executive, tool.filesystem)
+        crash_logs = CrashLogs(tool.filesystem)
         print crash_logs.find_newest_log(args[0])
 
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to