Changeset 73259 in webkit
- Timestamp:
- Dec 3, 2010 3:27:50 AM (13 years ago)
- Location:
- trunk/WebKitTools
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKitTools/ChangeLog
r73256 r73259 1 2010-12-03 Sheriff Bot <webkit.review.bot@gmail.com> 2 3 Unreviewed, rolling out r73222. 4 http://trac.webkit.org/changeset/73222 5 https://bugs.webkit.org/show_bug.cgi?id=50449 6 7 r73211 seemed to break Chromium's "Webkit Win (dbg)(2)" bot. 8 (Requested by yutak on #webkit). 9 10 * Scripts/webkitpy/layout_tests/layout_package/dump_render_tree_thread.py: 11 * Scripts/webkitpy/layout_tests/layout_package/message_broker.py: 12 * Scripts/webkitpy/layout_tests/layout_package/message_broker_unittest.py: 13 * Scripts/webkitpy/layout_tests/port/base.py: 14 * Scripts/webkitpy/layout_tests/run_webkit_tests.py: 15 * Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py: 16 1 17 2010-12-03 Sheriff Bot <webkit.review.bot@gmail.com> 2 18 -
trunk/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/dump_render_tree_thread.py
r73256 r73259 99 99 100 100 class TestShellThread(WatchableThread): 101 def __init__(self, port, options, worker_number, 101 def __init__(self, port, options, worker_number, worker_name, 102 102 filename_list_queue, result_queue): 103 103 """Initialize all the local state for this DumpRenderTree thread. … … 107 107 options: command line options argument from optparse 108 108 worker_number: identifier for a particular worker thread. 109 worker_name: for logging. 109 110 filename_list_queue: A thread safe Queue class that contains lists 110 111 of tuples of (filename, uri) pairs. … … 116 117 self._options = options 117 118 self._worker_number = worker_number 118 self._name = 'worker/%d' % worker_number119 self._name = worker_name 119 120 self._filename_list_queue = filename_list_queue 120 121 self._result_queue = result_queue … … 183 184 def get_num_tests(self): 184 185 return self._num_tests 185 186 def name(self):187 return self._name188 186 189 187 def next_timeout(self): … … 336 334 class SingleTestThread(threading.Thread): 337 335 def run(self): 338 result = worker._run_single_test( test_input, driver)336 result = worker._run_single_test(driver, test_input) 339 337 340 338 thread = SingleTestThread() -
trunk/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/message_broker.py
r73255 r73259 27 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 28 29 """Module for handling messages and concurrency for run-webkit-tests.29 """Module for handling messages, threads, processes, and concurrency for run-webkit-tests. 30 30 31 31 Testing is accomplished by having a manager (TestRunner) gather all of the … … 55 55 worker_model = options.worker_model 56 56 if worker_model == 'inline': 57 return _InlineBroker(port, options)57 return InlineBroker(port, options) 58 58 if worker_model == 'threads': 59 return _MultiThreadedBroker(port, options)59 return MultiThreadedBroker(port, options) 60 60 raise ValueError('unsupported value for --worker-model: %s' % worker_model) 61 61 62 62 63 class _WorkerMessageBroker(object): 63 class _WorkerState(object): 64 def __init__(self, name): 65 self.name = name 66 self.thread = None 67 68 69 class WorkerMessageBroker(object): 64 70 def __init__(self, port, options): 65 71 self._port = port … … 67 73 self._num_workers = int(self._options.child_processes) 68 74 69 # This maps worker names to their TestShellThread objects. 70 self._threads = {} 75 # This maps worker names to their _WorkerState values. 76 self._workers = {} 77 78 def _threads(self): 79 return tuple([w.thread for w in self._workers.values()]) 71 80 72 81 def start_workers(self, test_runner): … … 78 87 self._test_runner = test_runner 79 88 for worker_number in xrange(self._num_workers): 80 thread = self.start_worker(worker_number) 81 self._threads[thread.name()] = thread 82 return self._threads.values() 89 worker = _WorkerState('worker-%d' % worker_number) 90 worker.thread = self._start_worker(worker_number, worker.name) 91 self._workers[worker.name] = worker 92 return self._threads() 83 93 84 def start_worker(self, worker_number): 85 # FIXME: Replace with something that isn't a thread. 86 # Note: Don't start() the thread! If we did, it would actually 87 # create another thread and start executing it, and we'd no longer 88 # be single-threaded. 89 return dump_render_tree_thread.TestShellThread(self._port, 90 self._options, worker_number, 91 self._test_runner._current_filename_queue, 92 self._test_runner._result_queue) 94 def _start_worker(self, worker_number, worker_name): 95 raise NotImplementedError 93 96 94 97 def run_message_loop(self): … … 105 108 106 109 107 class _InlineBroker(_WorkerMessageBroker): 110 class InlineBroker(WorkerMessageBroker): 111 def _start_worker(self, worker_number, worker_name): 112 # FIXME: Replace with something that isn't a thread. 113 thread = dump_render_tree_thread.TestShellThread(self._port, 114 self._options, worker_number, worker_name, 115 self._test_runner._current_filename_queue, 116 self._test_runner._result_queue) 117 # Note: Don't start() the thread! If we did, it would actually 118 # create another thread and start executing it, and we'd no longer 119 # be single-threaded. 120 return thread 121 108 122 def run_message_loop(self): 109 thread = self._threads .values()[0]123 thread = self._threads()[0] 110 124 thread.run_in_main_thread(self._test_runner, 111 125 self._test_runner._current_result_summary) … … 113 127 114 128 115 class _MultiThreadedBroker(_WorkerMessageBroker): 116 def start_worker(self, worker_number): 117 thread = _WorkerMessageBroker.start_worker(self, worker_number) 129 class MultiThreadedBroker(WorkerMessageBroker): 130 def _start_worker(self, worker_number, worker_name): 131 thread = dump_render_tree_thread.TestShellThread(self._port, 132 self._options, worker_number, worker_name, 133 self._test_runner._current_filename_queue, 134 self._test_runner._result_queue) 118 135 thread.start() 119 136 return thread 120 137 121 138 def run_message_loop(self): 139 threads = self._threads() 140 122 141 # Loop through all the threads waiting for them to finish. 123 142 some_thread_is_alive = True … … 125 144 some_thread_is_alive = False 126 145 t = time.time() 127 for thread in self._threads.values():146 for thread in threads: 128 147 exception_info = thread.exception_info() 129 148 if exception_info is not None: … … 138 157 next_timeout = thread.next_timeout() 139 158 if next_timeout and t > next_timeout: 140 log_wedged_worker(thread. name(), thread.id())159 log_wedged_worker(thread.getName(), thread.id()) 141 160 thread.clear_next_timeout() 142 161 … … 147 166 148 167 def cancel_workers(self): 149 for thread in self._threads.values(): 168 threads = self._threads() 169 for thread in threads: 150 170 thread.cancel() 151 171 -
trunk/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/message_broker_unittest.py
r73255 r73259 47 47 def __init__(self, started_queue, stopping_queue): 48 48 threading.Thread.__init__(self) 49 self._ id = None49 self._thread_id = None 50 50 self._started_queue = started_queue 51 51 self._stopping_queue = stopping_queue … … 55 55 56 56 def id(self): 57 return self._ id57 return self._thread_id 58 58 59 def name(self):60 return 'worker/0'59 def getName(self): 60 return "worker-0" 61 61 62 62 def run(self): … … 66 66 # FIXME: this is a separate routine to work around a bug 67 67 # in coverage: see http://bitbucket.org/ned/coveragepy/issue/85. 68 self._ id = thread.get_ident()68 self._thread_id = thread.get_ident() 69 69 try: 70 70 self._started_queue.put('') … … 118 118 starting_queue = Queue.Queue() 119 119 stopping_queue = Queue.Queue() 120 broker = message_broker. _MultiThreadedBroker(port, options)120 broker = message_broker.MultiThreadedBroker(port, options) 121 121 broker._test_runner = runner 122 122 child_thread = TestThread(starting_queue, stopping_queue) 123 name = child_thread.name()124 broker._ threads[name]= child_thread123 broker._workers['worker-0'] = message_broker._WorkerState('worker-0') 124 broker._workers['worker-0'].thread = child_thread 125 125 child_thread.start() 126 126 started_msg = starting_queue.get() … … 170 170 msg = starting_queue.get() 171 171 172 message_broker.log_wedged_worker(child_thread. name(),172 message_broker.log_wedged_worker(child_thread.getName(), 173 173 child_thread.id()) 174 174 stopping_queue.put('') -
trunk/WebKitTools/Scripts/webkitpy/layout_tests/port/base.py
r73222 r73259 128 128 return self._executive.cpu_count() 129 129 130 def default_worker_model(self):131 """Return the concurrency model the port should use."""132 return 'threads'133 134 130 def baseline_path(self): 135 131 """Return the absolute path to the directory to store new baselines -
trunk/WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests.py
r73255 r73259 604 604 threads = message_broker.start_workers(self) 605 605 else: 606 threads = []606 threads = {} 607 607 608 608 self._printer.print_update("Starting testing ...") … … 1339 1339 def _set_up_derived_options(port_obj, options): 1340 1340 """Sets the options values that depend on other options values.""" 1341 if options.worker_model is None: 1342 options.worker_model = port_obj.default_worker_model() 1341 1343 1342 if options.worker_model == 'inline': 1344 1343 if options.child_processes and int(options.child_processes) > 1: … … 1571 1570 help="Number of DumpRenderTrees to run in parallel."), 1572 1571 # FIXME: Display default number of child processes that will run. 1573 # FIXME: Display default threading model (will be port-specific).1574 1572 optparse.make_option("--worker-model", action="store", 1575 help=("controls worker model. Valid values are "1576 "'inline' and 'threads' .")),1573 default="threads", help=("controls worker model. Valid values are " 1574 "'inline' and 'threads' (default).")), 1577 1575 optparse.make_option("--experimental-fully-parallel", 1578 1576 action="store_true", default=False, -
trunk/WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py
r73255 r73259 48 48 from webkitpy.common.system import user 49 49 from webkitpy.layout_tests import port 50 from webkitpy.layout_tests.port import test51 50 from webkitpy.layout_tests import run_webkit_tests 52 51 from webkitpy.layout_tests.layout_package import dump_render_tree_thread … … 188 187 def test_batch_size(self): 189 188 batch_tests_run = get_tests_run(['--batch-size', '2']) 190 self.assertEquals(len(batch_tests_run), 9)191 189 for batch in batch_tests_run: 192 190 self.assertTrue(len(batch) <= 2, '%s had too many tests' % ', '.join(batch)) … … 300 298 def test_run_singly(self): 301 299 batch_tests_run = get_tests_run(['--run-singly']) 302 self.assertEqual(len(batch_tests_run), 14)303 300 for batch in batch_tests_run: 304 301 self.assertEquals(len(batch), 1, '%s had too many tests' % ', '.join(batch)) … … 395 392 self.assertRaises(ValueError, logging_run, 396 393 ['--worker-model', 'unknown']) 397 398 def test_worker_model__port_override(self):399 class OverridePort(test.TestPort):400 def default_worker_model(self):401 return 'INVALID'402 403 options, parsed_args = run_webkit_tests.parse_args(404 ['--print', 'nothing', '--platform', 'test', '--noshow-results'])405 port_obj = OverridePort(options=options)406 self.assertRaises(ValueError, run_webkit_tests.run, port_obj,407 options, parsed_args)408 409 394 410 395 MainTest = skip_if(MainTest, sys.platform == 'cygwin' and compare_version(sys, '2.6')[0] < 0, 'new-run-webkit-tests tests hang on Cygwin Python 2.5.2')
Note: See TracChangeset
for help on using the changeset viewer.