Changeset 85462 in webkit


Ignore:
Timestamp:
May 2, 2011 12:17:32 AM (13 years ago)
Author:
abarth@webkit.org
Message:

2011-05-02 Adam Barth <abarth@webkit.org>

Reviewed by Eric Seidel.

workspace.py fails to import ScriptError
https://bugs.webkit.org/show_bug.cgi?id=59915

If the workspace fails to create a zip, webkitpy crashes instead of
handling the error as expected.

  • Scripts/webkitpy/common/system/workspace.py:
  • Scripts/webkitpy/common/system/workspace_unittest.py:
  • Scripts/webkitpy/tool/mocktool.py:
Location:
trunk/Tools
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r85461 r85462  
     12011-05-02  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        workspace.py fails to import ScriptError
     6        https://bugs.webkit.org/show_bug.cgi?id=59915
     7
     8        If the workspace fails to create a zip, webkitpy crashes instead of
     9        handling the error as expected.
     10
     11        * Scripts/webkitpy/common/system/workspace.py:
     12        * Scripts/webkitpy/common/system/workspace_unittest.py:
     13        * Scripts/webkitpy/tool/mocktool.py:
     14
    1152011-05-01  Adam Barth  <abarth@webkit.org>
    216
  • trunk/Tools/Scripts/webkitpy/common/system/workspace.py

    r84333 r85462  
    3232import logging
    3333import zipfile
     34
     35from webkitpy.common.system.executive import ScriptError
    3436
    3537
  • trunk/Tools/Scripts/webkitpy/common/system/workspace_unittest.py

    r76071 r85462  
    5757        archive = OutputCapture().assert_outputs(self, workspace.create_zip, ["/zip/path", "/source/path", MockZipFile], expected_stderr=expected_stderr)
    5858        self.assertEqual(archive.filename, "/zip/path")
     59
     60    def test_create_zip_exception(self):
     61        workspace = Workspace(None, MockExecutive(should_log=True, should_throw=True))
     62        expected_stderr = "MOCK run_command: ['zip', '-r', '/zip/path', '/source/path']\n"
     63        class MockZipFile(object):
     64            def __init__(self, path):
     65                self.filename = path
     66        archive = OutputCapture().assert_outputs(self, workspace.create_zip, ["/zip/path", "/source/path", MockZipFile], expected_stderr=expected_stderr)
     67        self.assertEqual(archive, None)
  • trunk/Tools/Scripts/webkitpy/tool/mocktool.py

    r85065 r85462  
    3535from webkitpy.common.net.bugzilla import Bug, Attachment
    3636from webkitpy.common.system.deprecated_logging import log
     37from webkitpy.common.system.executive import ScriptError
    3738from webkitpy.common.system.filesystem_mock import MockFileSystem
    3839from webkitpy.thirdparty.mock import Mock
     
    663664# FIXME: Unify with common.system.executive_mock.MockExecutive.
    664665class MockExecutive(Mock):
    665     def __init__(self, should_log):
    666         self.should_log = should_log
     666    def __init__(self, should_log, should_throw=False):
     667        self._should_log = should_log
     668        self._should_throw = should_throw
    667669
    668670    def run_and_throw_if_fail(self, args, quiet=False):
    669         if self.should_log:
     671        if self._should_log:
    670672            log("MOCK run_and_throw_if_fail: %s" % args)
    671673        return "MOCK output of child process"
     
    679681                    return_stderr=True,
    680682                    decode_output=False):
    681         if self.should_log:
     683        if self._should_log:
    682684            log("MOCK run_command: %s" % args)
     685        if self._should_throw:
     686            raise ScriptError("MOCK ScriptError")
    683687        return "MOCK output of child process"
    684688
Note: See TracChangeset for help on using the changeset viewer.