Changeset 119030 in webkit


Ignore:
Timestamp:
May 30, 2012 8:05:34 PM (12 years ago)
Author:
Stephanie Lewis
Message:

https://bugs.webkit.org/show_bug.cgi?id=87803
Layout tests often fail trying to stat nonexistent logs

Reviewed by Dirk Pranke.

CrashReporter removes logs using a heuristic to conserve space. Wrap a
try/catch block around accessing the logs as a precaution.

  • Scripts/webkitpy/common/system/crashlogs.py:

(CrashLogs._find_newest_log_darwin):

Location:
trunk/Tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r119019 r119030  
     12012-05-30  Stephanie Lewis  <slewis@apple.com>
     2
     3        https://bugs.webkit.org/show_bug.cgi?id=87803
     4        Layout tests often fail trying to stat nonexistent logs
     5
     6        Reviewed by Dirk Pranke.
     7
     8        CrashReporter removes logs using a heuristic to conserve space.  Wrap a
     9        try/catch block around accessing the logs as a precaution.
     10
     11        * Scripts/webkitpy/common/system/crashlogs.py:
     12        (CrashLogs._find_newest_log_darwin):
     13
    1142012-05-30  Gavin Peters  <gavinp@chromium.org>
    215
  • trunk/Tools/Scripts/webkitpy/common/system/crashlogs.py

    r115977 r119030  
    5757        errors = ''
    5858        for path in reversed(sorted(logs)):
    59             if not newer_than or self._host.filesystem.mtime(path) > newer_than:
    60                 try:
     59            try:
     60                if not newer_than or self._host.filesystem.mtime(path) > newer_than:
    6161                    f = self._host.filesystem.read_text_file(path)
    6262                    match = first_line_regex.match(f[0:f.find('\n')])
    6363                    if match and match.group('process_name') == process_name and (pid is None or int(match.group('pid')) == pid):
    6464                        return errors + f
    65                 except IOError, e:
    66                     if include_errors:
    67                         errors += "ERROR: Failed to read '%s': %s\n" % (path, str(e))
     65            except IOError, e:
     66                if include_errors:
     67                    errors += "ERROR: Failed to read '%s': %s\n" % (path, str(e))
     68            except OSError, e:
     69                if include_errors:
     70                    errors += "ERROR: Failed to read '%s': %s\n" % (path, str(e))
    6871
    6972        if include_errors and errors:
  • trunk/Tools/Scripts/webkitpy/common/system/crashlogs_unittest.py

    r115977 r119030  
    7676            self.assertEqual(a.splitlines(), b.splitlines())
    7777
     78
    7879    def test_find_log_darwin(self):
    7980        if not SystemHost().platform.is_mac():
     
    106107
    107108        def bad_read(path):
    108             raise IOError('No such file or directory')
     109            raise IOError('IOError: No such file or directory')
     110
     111        def bad_mtime(path):
     112            raise OSError('OSError: No such file or directory')
    109113
    110114        filesystem.read_text_file = bad_read
    111115        log = crash_logs.find_newest_log("DumpRenderTree", 28531, include_errors=True)
    112         self.assertTrue('No such file or directory' in log)
     116        self.assertTrue('IOError: No such file or directory' in log)
     117
     118        filesystem = MockFileSystem(files)
     119        crash_logs = CrashLogs(MockSystemHost(filesystem=filesystem))
     120        filesystem.mtime = bad_mtime
     121        log = crash_logs.find_newest_log("DumpRenderTree", newer_than=1.0, include_errors=True)
     122        self.assertTrue('OSError: No such file or directory' in log)
Note: See TracChangeset for help on using the changeset viewer.