Changeset 119017 in webkit


Ignore:
Timestamp:
May 30, 2012, 6:51:26 PM (13 years ago)
Author:
Stephanie Lewis
Message:

https://bugs.webkit.org/show_bug.cgi?id=87714
Mac crash logs can take a really long time to be written out.

Reviewed by Dirk Pranke.

Make a second pass looking for crash logs after the tests have completed running.

  • Scripts/webkitpy/layout_tests/controllers/manager.py:

(use_trac_links_in_results_html):
(Manager.run):

  • Scripts/webkitpy/layout_tests/port/base.py:

(Port.repository_paths):
(Port.look_for_new_crash_logs):

  • Scripts/webkitpy/layout_tests/port/mac.py:

(MacPort.look_for_new_crash_logs):

  • Scripts/webkitpy/layout_tests/port/mac_unittest.py:

(test_get_crash_log):
(test_look_for_new_crash_logs):
(test_look_for_new_crash_logs.fake_time_cb):

Location:
trunk/Tools
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r119011 r119017  
     12012-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
    1232012-05-30  Kevin Ollivier  <kevino@theolliviers.com>
    224
  • trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py

    r118421 r119017  
    4747from webkitpy.layout_tests.controllers import manager_worker_broker
    4848from webkitpy.layout_tests.controllers import worker
     49from webkitpy.layout_tests.controllers.test_result_writer import TestResultWriter
    4950from webkitpy.layout_tests.layout_package import json_layout_results_generator
    5051from webkitpy.layout_tests.layout_package import json_results_generator
     
    106107    # Use existence of builder_name as a proxy for knowing we're on a bot.
    107108    return port_obj.get_option("builder_name")
     109
    108110
    109111# FIXME: This should be on the Manager class (since that's the only caller)
     
    910912        end_time = time.time()
    911913
     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)
    912918        self._clean_up_run()
    913919
     
    970976        _log.debug("cleaning up port")
    971977        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)
    9721001
    9731002    def update_summary(self, result_summary):
  • trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager_unittest.py

    r118547 r119017  
    3333import StringIO
    3434import sys
     35import time
    3536import unittest
    3637
     
    327328            self.assertTrue(manager.needs_servers())
    328329
     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
    329345
    330346class NaturalCompareTest(unittest.TestCase):
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py

    r118884 r119017  
    908908        return [('webkit', self.layout_tests_dir())]
    909909
    910 
    911910    _WDIFF_DEL = '##WDIFF_DEL##'
    912911    _WDIFF_ADD = '##WDIFF_ADD##'
     
    10861085            '\n'.join(('STDERR: ' + l) for l in stderr_lines))
    10871086
     1087    def look_for_new_crash_logs(self, crashed_processes, start_time):
     1088        pass
     1089
    10881090    def sample_process(self, name, pid):
    10891091        pass
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/mac.py

    r118621 r119017  
    4242_log = logging.getLogger(__name__)
    4343
     44
    4445class MacPort(ApplePort):
    4546    port_name = "mac"
     
    178179        pass
    179180
    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):
    181182        # Note that we do slow-spin here and wait, since it appears the time
    182183        # ReportCrash takes to actually write and flush the file varies when there are
     
    193194        while not crash_log and now <= deadline:
    194195            crash_log = crash_logs.find_newest_log(name, pid, include_errors=True, newer_than=newer_than)
     196            if not wait_for_log:
     197                break
    195198            if not crash_log or not [line for line in crash_log.splitlines() if not line.startswith('ERROR')]:
    196199                sleep_fn(0.1)
    197200                now = time_fn()
     201
    198202        if not crash_log:
    199             crash_log = 'no crash log found for %s:%d' % (name, pid)
    200             _log.warning(crash_log)
     203            return None
    201204        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
    202223
    203224    def sample_process(self, name, pid):
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit.py

    r118979 r119017  
    574574        self.error_from_test += self._server_process.pop_all_buffered_stderr()
    575575
    576         crash_log = ''
     576        crash_log = None
    577577        if self.has_crashed():
    578578            crash_log = self._port._get_crash_log(self._crashed_process_name, self._crashed_pid, text, self.error_from_test,
    579579                                                  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)
    580584
    581585        timeout = self._server_process.timed_out
Note: See TracChangeset for help on using the changeset viewer.