Changeset 76134 in webkit
- Timestamp:
- Jan 19, 2011 10:14:29 AM (13 years ago)
- Location:
- trunk/Tools
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r76119 r76134 1 2011-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 1 14 2011-01-19 Aparna Nandyal <aparna.nand@wipro.com> 2 15 -
trunk/Tools/Scripts/webkitpy/common/system/executive_mock.py
r72455 r76134 31 31 # FIXME: Unify with tool/mocktool.MockExecutive. 32 32 33 from webkitpy.common.system import executive 34 33 35 34 36 class MockExecutive2(object): … … 49 51 pass 50 52 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, 52 54 decode_output=False): 53 55 if self._exception: … … 57 59 if self._run_command_fn: 58 60 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 59 67 return self._output -
trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium.py
r75800 r76134 45 45 import webbrowser 46 46 47 from webkitpy.common.system import executive 47 48 from webkitpy.common.system.path import cygpath 48 49 from webkitpy.layout_tests.layout_package import test_expectations … … 121 122 def check_sys_deps(self, needs_http): 122 123 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: 124 132 _log.error('System dependencies check failed.') 125 133 _log.error('To override, invoke with --nocheck-sys-deps') 126 134 _log.error('') 135 _log.error(output) 127 136 return False 128 137 return True -
trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_unittest.py
r73748 r76134 31 31 import StringIO 32 32 33 from webkitpy.common.system import logtesting 34 from webkitpy.common.system import executive_mock 33 35 from webkitpy.tool import mocktool 34 36 from webkitpy.thirdparty.mock import Mock … … 154 156 return "/path/to/image_diff" 155 157 156 class MockExecute:157 def __init__(self, result):158 self._result = result159 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._result170 return ''171 172 158 mock_options = mocktool.MockOptions() 173 159 port = ChromiumPortTest.TestLinuxPort(mock_options) 174 160 175 161 # Images are different. 176 port._executive = MockExecute(0)162 port._executive = executive_mock.MockExecutive2(exit_code=0) 177 163 self.assertEquals(False, port.diff_image("EXPECTED", "ACTUAL")) 178 164 179 165 # Images are the same. 180 port._executive = MockExecute(1)166 port._executive = executive_mock.MockExecutive2(exit_code=1) 181 167 self.assertEquals(True, port.diff_image("EXPECTED", "ACTUAL")) 182 168 183 169 # There was some error running image_diff. 184 port._executive = MockExecute(2)170 port._executive = executive_mock.MockExecutive2(exit_code=2) 185 171 exception_raised = False 186 172 try: … … 190 176 self.assertFalse(exception_raised) 191 177 178 179 class 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 192 198 if __name__ == '__main__': 193 199 unittest.main()
Note: See TracChangeset
for help on using the changeset viewer.