Changeset 77994 in webkit
- Timestamp:
- Feb 8, 2011 4:48:35 PM (13 years ago)
- Location:
- trunk/Tools
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r77992 r77994 1 2011-02-08 Dirk Pranke <dpranke@chromium.org> 2 3 Reviewed by Mihai Parparita. 4 5 new-run-webkit-tests: split out thread stack logging code into a sharable module 6 7 This patch splits out the code used to find and log thread 8 stacks from NRWT-specific packages to something generic and 9 shareable by other python modules. It will be shared in the near 10 future by the manager_worker_broker module, for example. 11 12 https://bugs.webkit.org/show_bug.cgi?id=53656 13 14 * Scripts/webkitpy/common/system/stack_utils.py: Added. 15 * Scripts/webkitpy/common/system/stack_utils_unittest.py: Added. 16 * Scripts/webkitpy/layout_tests/layout_package/message_broker.py: 17 * Scripts/webkitpy/layout_tests/layout_package/message_broker_unittest.py: 18 1 19 2011-02-08 Dirk Pranke <dpranke@chromium.org> 2 20 -
trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/message_broker.py
r77586 r77994 42 42 43 43 import logging 44 import sys45 44 import time 46 import traceback 45 46 from webkitpy.common.system import stack_utils 47 47 48 48 import dump_render_tree_thread … … 153 153 next_timeout = thread.next_timeout() 154 154 if next_timeout and t > next_timeout: 155 log_wedged_worker(thread.getName(), thread.id())155 stack_utils.log_thread_state(_log.error, thread.getName(), thread.id(), "is wedged") 156 156 thread.clear_next_timeout() 157 157 wedged_threads.add(thread) … … 177 177 for thread in threads: 178 178 thread.cancel() 179 180 181 def log_wedged_worker(name, id):182 """Log information about the given worker state."""183 stack = _find_thread_stack(id)184 assert(stack is not None)185 _log.error("")186 _log.error("%s (tid %d) is wedged" % (name, id))187 _log_stack(stack)188 _log.error("")189 190 191 def _find_thread_stack(id):192 """Returns a stack object that can be used to dump a stack trace for193 the given thread id (or None if the id is not found)."""194 for thread_id, stack in sys._current_frames().items():195 if thread_id == id:196 return stack197 return None198 199 200 def _log_stack(stack):201 """Log a stack trace to log.error()."""202 for filename, lineno, name, line in traceback.extract_stack(stack):203 _log.error('File: "%s", line %d, in %s' % (filename, lineno, name))204 if line:205 _log.error(' %s' % line.strip()) -
trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/message_broker_unittest.py
r77595 r77994 91 91 self._next_timeout = None 92 92 93 94 93 class TestHandler(logging.Handler): 95 94 def __init__(self, astream): … … 158 157 self.assertRaises(ValueError, self.run_one_thread, 'Exception') 159 158 160 def test_find_thread_stack_found(self):161 id, stack = sys._current_frames().items()[0]162 found_stack = message_broker._find_thread_stack(id)163 self.assertNotEqual(found_stack, None)164 165 def test_find_thread_stack_not_found(self):166 found_stack = message_broker._find_thread_stack(0)167 self.assertEqual(found_stack, None)168 169 159 170 160 if __name__ == '__main__':
Note: See TracChangeset
for help on using the changeset viewer.