Changeset 119017 in webkit
- Timestamp:
- May 30, 2012, 6:51:26 PM (13 years ago)
- Location:
- trunk/Tools
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r119011 r119017 1 2012-05-30 Stephanie Lewis <slewis@apple.com> 2 3 https://bugs.webkit.org/show_bug.cgi?id=87714 4 Mac crash logs can take a really long time to be written out. 5 6 Reviewed by Dirk Pranke. 7 8 Make a second pass looking for crash logs after the tests have completed running. 9 10 * Scripts/webkitpy/layout_tests/controllers/manager.py: 11 (use_trac_links_in_results_html): 12 (Manager.run): 13 * Scripts/webkitpy/layout_tests/port/base.py: 14 (Port.repository_paths): 15 (Port.look_for_new_crash_logs): 16 * Scripts/webkitpy/layout_tests/port/mac.py: 17 (MacPort.look_for_new_crash_logs): 18 * Scripts/webkitpy/layout_tests/port/mac_unittest.py: 19 (test_get_crash_log): 20 (test_look_for_new_crash_logs): 21 (test_look_for_new_crash_logs.fake_time_cb): 22 1 23 2012-05-30 Kevin Ollivier <kevino@theolliviers.com> 2 24 -
trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py
r118421 r119017 47 47 from webkitpy.layout_tests.controllers import manager_worker_broker 48 48 from webkitpy.layout_tests.controllers import worker 49 from webkitpy.layout_tests.controllers.test_result_writer import TestResultWriter 49 50 from webkitpy.layout_tests.layout_package import json_layout_results_generator 50 51 from webkitpy.layout_tests.layout_package import json_results_generator … … 106 107 # Use existence of builder_name as a proxy for knowing we're on a bot. 107 108 return port_obj.get_option("builder_name") 109 108 110 109 111 # FIXME: This should be on the Manager class (since that's the only caller) … … 910 912 end_time = time.time() 911 913 914 # Some crash logs can take a long time to be written out so look 915 # for new logs after the test run finishes. 916 self._look_for_new_crash_logs(result_summary, start_time) 917 self._look_for_new_crash_logs(retry_summary, start_time) 912 918 self._clean_up_run() 913 919 … … 970 976 _log.debug("cleaning up port") 971 977 self._port.clean_up_test_run() 978 979 def _look_for_new_crash_logs(self, result_summary, start_time): 980 """Since crash logs can take a long time to be written out if the system is 981 under stress do a second pass at the end of the test run. 982 983 result_summary: the results of the test run 984 start_time: time the tests started at. We're looking for crash 985 logs after that time. 986 """ 987 crashed_processes = [] 988 for test, result in result_summary.unexpected_results.iteritems(): 989 if (result.type != test_expectations.CRASH): 990 continue 991 for failure in result.failures: 992 if not isinstance(failure, test_failures.FailureCrash): 993 continue 994 crashed_processes.append([test, failure.process_name, failure.pid]) 995 996 crash_logs = self._port.look_for_new_crash_logs(crashed_processes, start_time) 997 if crash_logs: 998 for test, crash_log in crash_logs.iteritems(): 999 writer = TestResultWriter(self._port._filesystem, self._port, self._port.results_directory(), test) 1000 writer.write_crash_log(crash_log) 972 1001 973 1002 def update_summary(self, result_summary): -
trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager_unittest.py
r118547 r119017 33 33 import StringIO 34 34 import sys 35 import time 35 36 import unittest 36 37 … … 327 328 self.assertTrue(manager.needs_servers()) 328 329 330 def test_look_for_new_crash_logs(self): 331 def get_manager_with_tests(test_names): 332 host = MockHost() 333 port = host.port_factory.get('test-mac-leopard') 334 manager = Manager(port, options=MockOptions(test_list=None, http=True), printer=Mock()) 335 manager.collect_tests(test_names) 336 return manager 337 host = MockHost() 338 port = host.port_factory.get('test-mac-leopard') 339 tests = ['failures/expected/crash.html'] 340 expectations = test_expectations.TestExpectations(port, tests) 341 rs = result_summary.ResultSummary(expectations, tests) 342 manager = get_manager_with_tests(tests) 343 manager._look_for_new_crash_logs(rs, time.time()) 344 329 345 330 346 class NaturalCompareTest(unittest.TestCase): -
trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py
r118884 r119017 908 908 return [('webkit', self.layout_tests_dir())] 909 909 910 911 910 _WDIFF_DEL = '##WDIFF_DEL##' 912 911 _WDIFF_ADD = '##WDIFF_ADD##' … … 1086 1085 '\n'.join(('STDERR: ' + l) for l in stderr_lines)) 1087 1086 1087 def look_for_new_crash_logs(self, crashed_processes, start_time): 1088 pass 1089 1088 1090 def sample_process(self, name, pid): 1089 1091 pass -
trunk/Tools/Scripts/webkitpy/layout_tests/port/mac.py
r118621 r119017 42 42 _log = logging.getLogger(__name__) 43 43 44 44 45 class MacPort(ApplePort): 45 46 port_name = "mac" … … 178 179 pass 179 180 180 def _get_crash_log(self, name, pid, stdout, stderr, newer_than, time_fn=None, sleep_fn=None ):181 def _get_crash_log(self, name, pid, stdout, stderr, newer_than, time_fn=None, sleep_fn=None, wait_for_log=True): 181 182 # Note that we do slow-spin here and wait, since it appears the time 182 183 # ReportCrash takes to actually write and flush the file varies when there are … … 193 194 while not crash_log and now <= deadline: 194 195 crash_log = crash_logs.find_newest_log(name, pid, include_errors=True, newer_than=newer_than) 196 if not wait_for_log: 197 break 195 198 if not crash_log or not [line for line in crash_log.splitlines() if not line.startswith('ERROR')]: 196 199 sleep_fn(0.1) 197 200 now = time_fn() 201 198 202 if not crash_log: 199 crash_log = 'no crash log found for %s:%d' % (name, pid) 200 _log.warning(crash_log) 203 return None 201 204 return crash_log 205 206 def look_for_new_crash_logs(self, crashed_processes, start_time): 207 """Since crash logs can take a long time to be written out if the system is 208 under stress do a second pass at the end of the test run. 209 210 crashes: test_name -> pid, process_name tuple of crashed process 211 start_time: time the tests started at. We're looking for crash 212 logs after that time. 213 """ 214 crash_logs = {} 215 for (test_name, process_name, pid) in crashed_processes: 216 # Passing None for output. This is a second pass after the test finished so 217 # if the output had any loggine we would have already collected it. 218 crash_log = self._get_crash_log(process_name, pid, None, None, start_time, wait_for_log=False) 219 if not crash_log: 220 continue 221 crash_logs[test_name] = crash_log 222 return crash_logs 202 223 203 224 def sample_process(self, name, pid): -
trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit.py
r118979 r119017 574 574 self.error_from_test += self._server_process.pop_all_buffered_stderr() 575 575 576 crash_log = ''576 crash_log = None 577 577 if self.has_crashed(): 578 578 crash_log = self._port._get_crash_log(self._crashed_process_name, self._crashed_pid, text, self.error_from_test, 579 579 newer_than=start_time) 580 581 # If we don't find a crash log use a placeholder error message instead. 582 if not crash_log: 583 crash_log = 'no crash log found for %s:%d.' % (self._crashed_process_name, self._crashed_pid) 580 584 581 585 timeout = self._server_process.timed_out
Note:
See TracChangeset
for help on using the changeset viewer.