Title: [114960] trunk/Tools
Revision
114960
Author
dpra...@chromium.org
Date
2012-04-23 16:13:13 -0700 (Mon, 23 Apr 2012)

Log Message

run-perf-tests fail intermittently with an exception
https://bugs.webkit.org/show_bug.cgi?id=83532

Reviewed by Ryosuke Niwa.

This bulletproofs port.get_option('child_processes')
against the case where the option wasn't set.

* Scripts/webkitpy/layout_tests/port/mac.py:
(MacPort._get_crash_log):
* Scripts/webkitpy/layout_tests/port/mac_unittest.py:
(test_get_crash_log):
(test_get_crash_log.fake_time_cb):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (114959 => 114960)


--- trunk/Tools/ChangeLog	2012-04-23 23:07:45 UTC (rev 114959)
+++ trunk/Tools/ChangeLog	2012-04-23 23:13:13 UTC (rev 114960)
@@ -1,3 +1,19 @@
+2012-04-23  Dirk Pranke  <dpra...@chromium.org>
+
+        run-perf-tests fail intermittently with an exception
+        https://bugs.webkit.org/show_bug.cgi?id=83532
+
+        Reviewed by Ryosuke Niwa.
+
+        This bulletproofs port.get_option('child_processes')
+        against the case where the option wasn't set.
+
+        * Scripts/webkitpy/layout_tests/port/mac.py:
+        (MacPort._get_crash_log):
+        * Scripts/webkitpy/layout_tests/port/mac_unittest.py:
+        (test_get_crash_log):
+        (test_get_crash_log.fake_time_cb):
+
 2012-04-23  Balazs Kelemen  <kbal...@webkit.org>
 
         [Qt] Add desktop zooming support for QQuickWebView

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


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/mac.py	2012-04-23 23:07:45 UTC (rev 114959)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/mac.py	2012-04-23 23:13:13 UTC (rev 114960)
@@ -175,22 +175,24 @@
     def release_http_lock(self):
         pass
 
-    def _get_crash_log(self, name, pid, stdout, stderr, newer_than):
+    def _get_crash_log(self, name, pid, stdout, stderr, newer_than, time_fn=None, sleep_fn=None):
         # Note that we do slow-spin here and wait, since it appears the time
         # ReportCrash takes to actually write and flush the file varies when there are
         # lots of simultaneous crashes going on.
         # FIXME: Should most of this be moved into CrashLogs()?
+        time_fn = time_fn or time.time
+        sleep_fn = sleep_fn or time.sleep
         crash_log = ''
         crash_logs = CrashLogs(self._filesystem)
-        now = time.time()
+        now = time_fn()
         # 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'))
+        deadline = now + 5 * int(self.get_option('child_processes', 1))
         while not crash_log and now <= deadline:
             crash_log = crash_logs.find_newest_log(name, pid, include_errors=True, newer_than=newer_than)
             if not crash_log or not [line for line in crash_log.splitlines() if not line.startswith('ERROR')]:
-                time.sleep(0.1)
-                now = time.time()
+                sleep_fn(0.1)
+                now = time_fn()
         if not crash_log:
             crash_log = 'no crash log found for %s:%d' % (name, pid)
             _log.warning(crash_log)

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/mac_unittest.py (114959 => 114960)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/mac_unittest.py	2012-04-23 23:07:45 UTC (rev 114959)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/mac_unittest.py	2012-04-23 23:13:13 UTC (rev 114960)
@@ -190,8 +190,13 @@
         self.assertEqual(child_processes, 1)
 
     def test_get_crash_log(self):
-        # Mac crash logs are tested elsewhere
-        pass
+        # Mac crash logs are tested elsewhere, so here we just make sure we don't crash.
+        def fake_time_cb():
+            times = [0, 20, 40]
+            return lambda: times.pop(0)
+        port = self.make_port(port_name='mac-snowleopard')
+        port._get_crash_log('DumpRenderTree', 1234, '', '', 0,
+            time_fn=fake_time_cb(), sleep_fn=lambda delay: None)
 
     def test_helper_starts(self):
         host = MockSystemHost(MockExecutive())
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to