Changeset 76134 in webkit


Ignore:
Timestamp:
Jan 19, 2011 10:14:29 AM (13 years ago)
Author:
tony@chromium.org
Message:

2011-01-19 Tony Chang <tony@chromium.org>

Reviewed by Mihai Parparita.

[chromium] [linux] if check-sys-deps fails, output the failure reason
https://bugs.webkit.org/show_bug.cgi?id=52671

  • Scripts/webkitpy/common/system/executive_mock.py: Add support for

error handler functions.

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

output the error text from --check-sys-deps

  • Scripts/webkitpy/layout_tests/port/chromium_unittest.py:
Location:
trunk/Tools
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r76119 r76134  
     12011-01-19  Tony Chang  <tony@chromium.org>
     2
     3        Reviewed by Mihai Parparita.
     4
     5        [chromium] [linux] if check-sys-deps fails, output the failure reason
     6        https://bugs.webkit.org/show_bug.cgi?id=52671
     7
     8        * Scripts/webkitpy/common/system/executive_mock.py: Add support for
     9            error handler functions.
     10        * Scripts/webkitpy/layout_tests/port/chromium.py:
     11            output the error text from --check-sys-deps
     12        * Scripts/webkitpy/layout_tests/port/chromium_unittest.py:
     13
    1142011-01-19  Aparna Nandyal  <aparna.nand@wipro.com>
    215
  • trunk/Tools/Scripts/webkitpy/common/system/executive_mock.py

    r72455 r76134  
    3131# FIXME: Unify with tool/mocktool.MockExecutive.
    3232
     33from webkitpy.common.system import executive
     34
    3335
    3436class MockExecutive2(object):
     
    4951        pass
    5052
    51     def run_command(self, arg_list, return_exit_code=False,
     53    def run_command(self, arg_list, error_handler=None, return_exit_code=False,
    5254                    decode_output=False):
    5355        if self._exception:
     
    5759        if self._run_command_fn:
    5860            return self._run_command_fn(arg_list)
     61        if self._exit_code and error_handler:
     62            script_error = executive.ScriptError(script_args=arg_list,
     63                                                 exit_code=self._exit_code,
     64                                                 output=self._output)
     65            error_handler(script_error)
     66
    5967        return self._output
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium.py

    r75800 r76134  
    4545import webbrowser
    4646
     47from webkitpy.common.system import executive
    4748from webkitpy.common.system.path import cygpath
    4849from webkitpy.layout_tests.layout_package import test_expectations
     
    121122    def check_sys_deps(self, needs_http):
    122123        cmd = [self._path_to_driver(), '--check-layout-test-sys-deps']
    123         if self._executive.run_command(cmd, return_exit_code=True):
     124
     125        local_error = executive.ScriptError()
     126
     127        def error_handler(script_error):
     128            local_error.exit_code = script_error.exit_code
     129
     130        output = self._executive.run_command(cmd, error_handler=error_handler)
     131        if local_error.exit_code:
    124132            _log.error('System dependencies check failed.')
    125133            _log.error('To override, invoke with --nocheck-sys-deps')
    126134            _log.error('')
     135            _log.error(output)
    127136            return False
    128137        return True
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_unittest.py

    r73748 r76134  
    3131import StringIO
    3232
     33from webkitpy.common.system import logtesting
     34from webkitpy.common.system import executive_mock
    3335from webkitpy.tool import mocktool
    3436from webkitpy.thirdparty.mock import Mock
     
    154156                return "/path/to/image_diff"
    155157
    156         class MockExecute:
    157             def __init__(self, result):
    158                 self._result = result
    159 
    160             def run_command(self,
    161                             args,
    162                             cwd=None,
    163                             input=None,
    164                             error_handler=None,
    165                             return_exit_code=False,
    166                             return_stderr=True,
    167                             decode_output=False):
    168                 if return_exit_code:
    169                     return self._result
    170                 return ''
    171 
    172158        mock_options = mocktool.MockOptions()
    173159        port = ChromiumPortTest.TestLinuxPort(mock_options)
    174160
    175161        # Images are different.
    176         port._executive = MockExecute(0)
     162        port._executive = executive_mock.MockExecutive2(exit_code=0)
    177163        self.assertEquals(False, port.diff_image("EXPECTED", "ACTUAL"))
    178164
    179165        # Images are the same.
    180         port._executive = MockExecute(1)
     166        port._executive = executive_mock.MockExecutive2(exit_code=1)
    181167        self.assertEquals(True, port.diff_image("EXPECTED", "ACTUAL"))
    182168
    183169        # There was some error running image_diff.
    184         port._executive = MockExecute(2)
     170        port._executive = executive_mock.MockExecutive2(exit_code=2)
    185171        exception_raised = False
    186172        try:
     
    190176        self.assertFalse(exception_raised)
    191177
     178
     179class ChromiumPortLoggingTest(logtesting.LoggingTestCase):
     180    def test_check_sys_deps(self):
     181        mock_options = mocktool.MockOptions()
     182        port = ChromiumPortTest.TestLinuxPort(options=mock_options)
     183
     184        # Success
     185        port._executive = executive_mock.MockExecutive2(exit_code=0)
     186        self.assertTrue(port.check_sys_deps(needs_http=False))
     187
     188        # Failure
     189        port._executive = executive_mock.MockExecutive2(exit_code=1,
     190            output='testing output failure')
     191        self.assertFalse(port.check_sys_deps(needs_http=False))
     192        self.assertLog([
     193            'ERROR: System dependencies check failed.\n',
     194            'ERROR: To override, invoke with --nocheck-sys-deps\n',
     195            'ERROR: \n',
     196            'ERROR: testing output failure\n'])
     197
    192198if __name__ == '__main__':
    193199    unittest.main()
Note: See TracChangeset for help on using the changeset viewer.