2010-12-24 Dirk Pranke <dpranke@chromium.org>
authordpranke@chromium.org <dpranke@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 Dec 2010 12:12:30 +0000 (12:12 +0000)
committerdpranke@chromium.org <dpranke@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 Dec 2010 12:12:30 +0000 (12:12 +0000)
        Reviewed by Kenneth Russell.

        Modify new-run-webkit-tests to shut up and exit when all the threads
        are wedged so that test runs complete faster and we don't end up
        w/ enormous log files.

        https://bugs.webkit.org/show_bug.cgi?id=51572

        * Scripts/webkitpy/layout_tests/layout_package/message_broker.py:
        * Scripts/webkitpy/layout_tests/layout_package/message_broker_unittest.py:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74632 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/webkitpy/layout_tests/layout_package/message_broker.py
Tools/Scripts/webkitpy/layout_tests/layout_package/message_broker_unittest.py

index 0369dd73f0a21cd50bfff1f4d8a9ed0fd629ac6d..3d2c8cc47c96d7bfee465620e2f3ef8e14efe913 100644 (file)
@@ -1,3 +1,16 @@
+2010-12-24  Dirk Pranke  <dpranke@chromium.org>
+
+        Reviewed by Kenneth Russell.
+
+        Modify new-run-webkit-tests to shut up and exit when all the threads
+        are wedged so that test runs complete faster and we don't end up
+        w/ enormous log files.
+
+        https://bugs.webkit.org/show_bug.cgi?id=51572
+
+        * Scripts/webkitpy/layout_tests/layout_package/message_broker.py:
+        * Scripts/webkitpy/layout_tests/layout_package/message_broker_unittest.py:
+
 2010-12-24  Eric Seidel  <eric@webkit.org>
 
         Reviewed by David Levin.
index e0ca8db1d8aa5504a06e18465e4572bf62fee1d5..7f62e3985d264eb3224929ded7f3fcc7a9e21059 100644 (file)
@@ -137,6 +137,7 @@ class MultiThreadedBroker(WorkerMessageBroker):
 
     def run_message_loop(self):
         threads = self._threads()
+        wedged_threads = set()
 
         # Loop through all the threads waiting for them to finish.
         some_thread_is_alive = True
@@ -153,17 +154,24 @@ class MultiThreadedBroker(WorkerMessageBroker):
                     raise exception_info[0], exception_info[1], exception_info[2]
 
                 if thread.isAlive():
+                    if thread in wedged_threads:
+                        continue
+
                     some_thread_is_alive = True
                     next_timeout = thread.next_timeout()
                     if next_timeout and t > next_timeout:
                         log_wedged_worker(thread.getName(), thread.id())
                         thread.clear_next_timeout()
+                        wedged_threads.add(thread)
 
             self._test_runner.update()
 
             if some_thread_is_alive:
                 time.sleep(0.01)
 
+        if wedged_threads:
+            _log.warning("All remaining threads are wedged, bailing out.")
+
     def cancel_workers(self):
         threads = self._threads()
         for thread in threads:
index 6f04fd35518a04ebd6919ff8a97613cf4c5be1f4..b3941a369b37388d184ec2bca2291bcfbd6af632 100644 (file)
@@ -84,7 +84,6 @@ class TestThread(threading.Thread):
 
     def next_timeout(self):
         if self._timeout:
-            self._timeout_queue.put('done')
             return time.time() - 10
         return time.time()
 
@@ -144,8 +143,6 @@ class MultiThreadedBrokerTest(unittest.TestCase):
     def test_exception(self):
         self.assertRaises(ValueError, self.run_one_thread, 'Exception')
 
-
-class Test(unittest.TestCase):
     def test_find_thread_stack_found(self):
         id, stack = sys._current_frames().items()[0]
         found_stack = message_broker._find_thread_stack(id)
@@ -169,9 +166,19 @@ class Test(unittest.TestCase):
         child_thread.start()
         msg = starting_queue.get()
 
-        message_broker.log_wedged_worker(child_thread.getName(),
-                                         child_thread.id())
-        stopping_queue.put('')
+        # FIXME: this is an ugly hack to make the broker aware of the thread.
+        port = None
+        options = mocktool.MockOptions(child_processes='1')
+        runner = self.MockTestRunner()
+        broker = message_broker.MultiThreadedBroker(port, options)
+        worker = message_broker._WorkerState('worker-0')
+        worker.thread = child_thread
+        broker._test_runner = runner
+        broker._workers['worker-0'] = worker
+
+        stopping_queue.put('Timeout')
+        broker.run_message_loop()
+        child_thread._timeout_queue.put('done')
         child_thread.join(timeout=1.0)
 
         self.assertFalse(astream.empty())