Title: [111765] trunk/Tools
Revision
111765
Author
dpra...@chromium.org
Date
2012-03-22 14:24:28 -0700 (Thu, 22 Mar 2012)

Log Message

new-run-webkit-tests blames the wrong test for crashing
https://bugs.webkit.org/show_bug.cgi?id=81951

Reviewed by Adam Barth.

NRWT wasn't extracting the WebProcess pid correct; should've
used re.search instead of re.match :(. Add more tests!

* Scripts/webkitpy/layout_tests/port/mac.py:
(MacPort._get_crash_log):
* Scripts/webkitpy/layout_tests/port/webkit.py:
(WebKitDriver.has_crashed):
(WebKitDriver._check_for_driver_crash):
* Scripts/webkitpy/layout_tests/port/webkit_unittest.py:
(WebKitDriverTest.test_no_timeout):
(WebKitDriverTest):
(WebKitDriverTest.test_check_for_driver_crash):
(WebKitDriverTest.test_check_for_driver_crash.FakeServerProcess):
(WebKitDriverTest.test_check_for_driver_crash.FakeServerProcess.__init__):
(WebKitDriverTest.test_check_for_driver_crash.FakeServerProcess.pid):
(WebKitDriverTest.test_check_for_driver_crash.FakeServerProcess.name):
(WebKitDriverTest.test_check_for_driver_crash.FakeServerProcess.has_crashed):
(WebKitDriverTest.test_check_for_driver_crash.assert_crash):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (111764 => 111765)


--- trunk/Tools/ChangeLog	2012-03-22 21:19:08 UTC (rev 111764)
+++ trunk/Tools/ChangeLog	2012-03-22 21:24:28 UTC (rev 111765)
@@ -1,3 +1,29 @@
+2012-03-22  Dirk Pranke  <dpra...@chromium.org>
+
+        new-run-webkit-tests blames the wrong test for crashing
+        https://bugs.webkit.org/show_bug.cgi?id=81951
+
+        Reviewed by Adam Barth.
+
+        NRWT wasn't extracting the WebProcess pid correct; should've
+        used re.search instead of re.match :(. Add more tests!
+
+        * Scripts/webkitpy/layout_tests/port/mac.py:
+        (MacPort._get_crash_log):
+        * Scripts/webkitpy/layout_tests/port/webkit.py:
+        (WebKitDriver.has_crashed):
+        (WebKitDriver._check_for_driver_crash):
+        * Scripts/webkitpy/layout_tests/port/webkit_unittest.py:
+        (WebKitDriverTest.test_no_timeout):
+        (WebKitDriverTest):
+        (WebKitDriverTest.test_check_for_driver_crash):
+        (WebKitDriverTest.test_check_for_driver_crash.FakeServerProcess):
+        (WebKitDriverTest.test_check_for_driver_crash.FakeServerProcess.__init__):
+        (WebKitDriverTest.test_check_for_driver_crash.FakeServerProcess.pid):
+        (WebKitDriverTest.test_check_for_driver_crash.FakeServerProcess.name):
+        (WebKitDriverTest.test_check_for_driver_crash.FakeServerProcess.has_crashed):
+        (WebKitDriverTest.test_check_for_driver_crash.assert_crash):
+
 2012-03-22  Sudarsana Nagineni  <sudarsana.nagin...@linux.intel.com>
 
         [EFL] [DRT] Implement LayoutTestController::markerTextForListItem()

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


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/mac.py	2012-03-22 21:19:08 UTC (rev 111764)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/mac.py	2012-03-22 21:24:28 UTC (rev 111765)
@@ -166,6 +166,8 @@
         crash_log = ''
         crash_logs = CrashLogs(self._filesystem)
         now = time.time()
+        # FIXME: delete this after we're sure this code is working ...
+        _log.debug('looking for crash log for %s:%s' % (name, str(pid)))
         deadline = now + 5 * int(self.get_option('child_processes'))
         while not crash_log and now <= deadline:
             crash_log = crash_logs.find_newest_log(name, pid, include_errors=True)

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit.py (111764 => 111765)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit.py	2012-03-22 21:19:08 UTC (rev 111764)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit.py	2012-03-22 21:24:28 UTC (rev 111765)
@@ -497,6 +497,7 @@
             self._crashed_process_name = self._server_process.name()
             self._crashed_pid = self._server_process.pid()
             return True
+        return False
 
     def _check_for_driver_crash(self, error_line):
         if error_line == "#CRASHED\n":
@@ -507,11 +508,13 @@
         elif error_line.startswith("#CRASHED - WebProcess"):
             # WebKitTestRunner uses this to report that the WebProcess subprocess crashed.
             pid = None
-            m = re.match('pid (\d+)', error_line)
+            m = re.search('pid (\d+)', error_line)
             if m:
                 pid = int(m.group(1))
             self._crashed_process_name = 'WebProcess'
             self._crashed_pid = pid
+            # FIXME: delete this after we're sure this code is working :)
+            _log.debug('WebProcess crash, pid = %s, error_line = %s' % (str(pid), error_line))
             return True
         return self.has_crashed()
 

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit_unittest.py (111764 => 111765)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit_unittest.py	2012-03-22 21:19:08 UTC (rev 111764)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit_unittest.py	2012-03-22 21:24:28 UTC (rev 111765)
@@ -296,3 +296,48 @@
         port = TestWebKitPort()
         driver = WebKitDriver(port, 0, pixel_tests=True, no_timeout=True)
         self.assertEquals(driver.cmd_line(True, []), ['MOCK output of child process/DumpRenderTree', '--no-timeout', '--pixel-tests', '-'])
+
+    def test_check_for_driver_crash(self):
+        port = TestWebKitPort()
+        driver = WebKitDriver(port, 0, pixel_tests=True)
+
+        class FakeServerProcess(object):
+            def __init__(self, crashed):
+                self.crashed = crashed
+
+            def pid(self):
+                return 1234
+
+            def name(self):
+                return 'FakeServerProcess'
+
+            def has_crashed(self):
+                return self.crashed
+
+        def assert_crash(driver, error_line, crashed, name, pid):
+            self.assertEquals(driver._check_for_driver_crash(error_line), crashed)
+            self.assertEquals(driver._crashed_process_name, name)
+            self.assertEquals(driver._crashed_pid, pid)
+
+        driver._server_process = FakeServerProcess(False)
+        assert_crash(driver, '', False, None, None)
+
+        driver._crashed_process_name = None
+        driver._crashed_pid = None
+        driver._server_process = FakeServerProcess(False)
+        assert_crash(driver, '#CRASHED\n', True, 'FakeServerProcess', 1234)
+
+        driver._crashed_process_name = None
+        driver._crashed_pid = None
+        driver._server_process = FakeServerProcess(False)
+        assert_crash(driver, '#CRASHED - WebProcess\n', True, 'WebProcess', None)
+
+        driver._crashed_process_name = None
+        driver._crashed_pid = None
+        driver._server_process = FakeServerProcess(False)
+        assert_crash(driver, '#CRASHED - WebProcess (pid 8675)\n', True, 'WebProcess', 8675)
+
+        driver._crashed_process_name = None
+        driver._crashed_pid = None
+        driver._server_process = FakeServerProcess(True)
+        assert_crash(driver, '', True, 'FakeServerProcess', 1234)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to