Changeset 227427 in webkit
- Timestamp:
- Jan 23, 2018 11:31:04 AM (6 years ago)
- Location:
- trunk/Tools
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r227422 r227427 1 2018-01-23 Basuke Suzuki <Basuke.Suzuki@sony.com> 2 3 Add ignore_errors keyword argument to Executive.run_command() for replacing the common pattern of error_handler usage 4 https://bugs.webkit.org/show_bug.cgi?id=180820 5 6 Reviewed by David Kilzer. 7 8 * Scripts/webkitpy/common/checkout/scm/git.py: 9 (Git.in_working_directory): 10 (Git.clone): 11 (Git.read_git_config): 12 (Git.apply_reverse_diff): 13 * Scripts/webkitpy/common/checkout/scm/scm.py: 14 (SCM.run): 15 * Scripts/webkitpy/common/checkout/scm/scm_unittest.py: 16 * Scripts/webkitpy/common/checkout/scm/svn.py: 17 (SVNRepository.has_authorization_for_realm): 18 * Scripts/webkitpy/common/net/credentials_unittest.py: 19 * Scripts/webkitpy/common/system/abstractexecutive.py: 20 (AbstractExecutive.run_command): 21 * Scripts/webkitpy/common/system/executive.py: 22 (Executive.kill_process.is): 23 (Executive.running_pids): 24 (Executive.kill_all): 25 (Executive.run_command): 26 * Scripts/webkitpy/common/system/executive_mock.py: 27 (MockExecutive.run_command): 28 (MockExecutive2.run_command): 29 * Scripts/webkitpy/common/system/executive_unittest.py: 30 (ExecutiveTest.test_run_command_with_bad_command.run_bad_command): 31 * Scripts/webkitpy/common/system/platforminfo.py: 32 (PlatformInfo.xcode_sdk_version): 33 * Scripts/webkitpy/layout_tests/servers/http_server.py: 34 (Lighttpd._check_and_kill): 35 * Scripts/webkitpy/port/base.py: 36 (Port._symbols_string): 37 * Scripts/webkitpy/port/gtk.py: 38 (GtkPort.setup_environ_for_server): 39 * Scripts/webkitpy/port/win.py: 40 (WinPort._runtime_feature_list): 41 (WinPort.read_registry_value): 42 * Scripts/webkitpy/port/win_unittest.py: 43 (WinPortTest.test_runtime_feature_list): 44 * Scripts/webkitpy/tool/commands/analyzechangelog.py: 45 * Scripts/webkitpy/tool/commands/analyzechangelog_unittest.py: 46 1 47 2018-01-23 Commit Queue <commit-queue@webkit.org> 2 48 -
trunk/Tools/Scripts/webkitpy/common/checkout/scm/git.py
r226009 r227427 110 110 try: 111 111 executive = executive or Executive() 112 return executive.run_command([cls.executable_name, 'rev-parse', '--is-inside-work-tree'], cwd=path, error_handler=Executive.ignore_error).rstrip() == "true"112 return executive.run_command([cls.executable_name, 'rev-parse', '--is-inside-work-tree'], cwd=path, ignore_errors=True).rstrip() == "true" 113 113 except OSError as e: 114 114 # The Windows bots seem to through a WindowsError when git isn't installed. … … 119 119 try: 120 120 executive = executive or Executive() 121 return executive.run_command([cls.executable_name, 'clone', '-v', url, directory], error_handler=Executive.ignore_error)121 return executive.run_command([cls.executable_name, 'clone', '-v', url, directory], ignore_errors=True) 122 122 except OSError as e: 123 123 return False … … 143 143 # FIXME: This should use an Executive. 144 144 executive = executive or Executive() 145 return executive.run_command([cls.executable_name, "config", "--get-all", key], error_handler=Executive.ignore_error, cwd=cwd).rstrip('\n')145 return executive.run_command([cls.executable_name, "config", "--get-all", key], ignore_errors=True, cwd=cwd).rstrip('\n') 146 146 147 147 @staticmethod … … 401 401 git_commit = self.git_commit_from_svn_revision(revision) 402 402 # I think this will always fail due to ChangeLogs. 403 self._run_git(['revert', '--no-commit', git_commit], error_handler=Executive.ignore_error)403 self._run_git(['revert', '--no-commit', git_commit], ignore_errors=True) 404 404 405 405 def revert_files(self, file_paths): -
trunk/Tools/Scripts/webkitpy/common/checkout/scm/scm.py
r213562 r227427 67 67 68 68 # A wrapper used by subclasses to create processes. 69 def run(self, args, cwd=None, input=None, error_handler=None, return_exit_code=False, return_stderr=True, decode_output=True):69 def run(self, args, cwd=None, input=None, error_handler=None, ignore_errors=False, return_exit_code=False, return_stderr=True, decode_output=True): 70 70 # FIXME: We should set cwd appropriately. 71 71 return self._executive.run_command(args, … … 73 73 input=input, 74 74 error_handler=error_handler, 75 ignore_errors=ignore_errors, 75 76 return_exit_code=return_exit_code, 76 77 return_stderr=return_stderr, -
trunk/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py
r224548 r227427 266 266 command_does_not_exist = ['does_not_exist', 'invalid_option'] 267 267 self.assertRaises(OSError, run_command, command_does_not_exist) 268 self.assertRaises(OSError, run_command, command_does_not_exist, error_handler=Executive.ignore_error)268 self.assertRaises(OSError, run_command, command_does_not_exist, ignore_errors=True) 269 269 270 270 command_returns_non_zero = ['/bin/sh', '--invalid-option'] 271 271 self.assertRaises(ScriptError, run_command, command_returns_non_zero) 272 272 # Check if returns error text: 273 self.assertTrue(run_command(command_returns_non_zero, error_handler=Executive.ignore_error))273 self.assertTrue(run_command(command_returns_non_zero, ignore_errors=True)) 274 274 275 275 self.assertRaises(CheckoutNeedsUpdate, commit_error_handler, ScriptError(output=git_failure_message)) -
trunk/Tools/Scripts/webkitpy/common/checkout/scm/svn.py
r225733 r227427 61 61 return False 62 62 find_args = ["find", ".subversion", "-type", "f", "-exec", "grep", "-q", realm, "{}", ";", "-print"] 63 find_output = self.run(find_args, cwd=home_directory, error_handler=Executive.ignore_error).rstrip()63 find_output = self.run(find_args, cwd=home_directory, ignore_errors=True).rstrip() 64 64 if not find_output or not os.path.isfile(os.path.join(home_directory, find_output)): 65 65 return False -
trunk/Tools/Scripts/webkitpy/common/net/credentials_unittest.py
r202362 r227427 32 32 33 33 from webkitpy.common.net.credentials import Credentials 34 from webkitpy.common.system.executive import Executive35 34 from webkitpy.common.system.outputcapture import OutputCapture 36 35 from webkitpy.common.system.user_mock import MockUser -
trunk/Tools/Scripts/webkitpy/common/system/abstractexecutive.py
r217801 r227427 117 117 return " ".join(escaped_args) 118 118 119 def run_command(self, args, cwd=None, env=None, input=None, error_handler=None, 119 def run_command(self, args, cwd=None, env=None, input=None, error_handler=None, ignore_errors=False, 120 120 return_exit_code=False, return_stderr=True, decode_output=True): 121 121 raise NotImplementedError('subclasses must implement') -
trunk/Tools/Scripts/webkitpy/common/system/executive.py
r225733 r227427 175 175 command = [task_kill_executable, "/f", "/t", "/pid", pid] 176 176 # taskkill will exit 128 if the process is not found. We should log. 177 self.run_command(command, error_handler=self.ignore_error)177 self.run_command(command, ignore_errors=True) 178 178 return 179 179 … … 272 272 running_pids = [] 273 273 if sys.platform in ("cygwin"): 274 ps_process = self.run_command(['ps', '-e'], error_handler=Executive.ignore_error)274 ps_process = self.run_command(['ps', '-e'], ignore_errors=True) 275 275 for line in ps_process.splitlines(): 276 276 tokens = line.strip().split() … … 326 326 command = [killCommmand, "/f", "/im", image_name] 327 327 # taskkill will exit 128 if the process is not found. We should log. 328 self.run_command(command, error_handler=self.ignore_error)328 self.run_command(command, ignore_errors=True) 329 329 return 330 330 … … 337 337 # FIXME: We should pass a custom error_handler to allow only exit_code 1. 338 338 # We should log in exit_code == 1 339 self.run_command(command, error_handler=self.ignore_error)339 self.run_command(command, ignore_errors=True) 340 340 341 341 def _compute_stdin(self, input): … … 365 365 input=None, 366 366 error_handler=None, 367 ignore_errors=False, 367 368 return_exit_code=False, 368 369 return_stderr=True, … … 402 403 output=output, 403 404 cwd=cwd) 405 406 if ignore_errors: 407 assert error_handler is None, "don't specify error_handler if ignore_errors is True" 408 error_handler = Executive.ignore_error 409 404 410 (error_handler or self.default_error_handler)(script_error) 405 411 return output -
trunk/Tools/Scripts/webkitpy/common/system/executive_mock.py
r212905 r227427 109 109 input=None, 110 110 error_handler=None, 111 ignore_errors=False, 111 112 return_exit_code=False, 112 113 return_stderr=True, … … 186 187 input=None, 187 188 error_handler=None, 189 ignore_errors=False, 188 190 return_exit_code=False, 189 191 return_stderr=True, … … 192 194 self.calls.append(args) 193 195 assert(isinstance(args, list) or isinstance(args, tuple)) 196 197 if ignore_errors: 198 assert error_handler is None, "don't specify error_handler if ignore_errors is True" 199 error_handler = self.ignore_error 200 194 201 if self._exception: 195 202 raise self._exception # pylint: disable=E0702 -
trunk/Tools/Scripts/webkitpy/common/system/executive_unittest.py
r202362 r227427 106 106 def test_run_command_with_bad_command(self): 107 107 def run_bad_command(): 108 Executive().run_command(["foo_bar_command_blah"], error_handler=Executive.ignore_error, return_exit_code=True)108 Executive().run_command(["foo_bar_command_blah"], ignore_errors=True, return_exit_code=True) 109 109 self.assertRaises(OSError, run_bad_command) 110 110 -
trunk/Tools/Scripts/webkitpy/common/system/platforminfo.py
r226652 r227427 153 153 if self.is_mac(): 154 154 # Assumes that xcrun does not write to standard output on failure (e.g. SDK does not exist). 155 xcrun_output = self.executive.run_command(['xcrun', '--sdk', sdk_name, '--show-sdk-version'], return_stderr=False, error_handler=Executive.ignore_error).rstrip()155 xcrun_output = self.executive.run_command(['xcrun', '--sdk', sdk_name, '--show-sdk-version'], return_stderr=False, ignore_errors=True).rstrip() 156 156 if xcrun_output: 157 157 return Version.from_string(xcrun_output) -
trunk/Tools/Scripts/webkitpy/layout_tests/servers/http_server.py
r225733 r227427 223 223 # 224 224 # If this is actually working, we should figure out a clean API. 225 self._executive.run_command(["taskkill.exe", "/f", "/t", "/pid", self._pid], error_handler=self._executive.ignore_error)225 self._executive.run_command(["taskkill.exe", "/f", "/t", "/pid", self._pid], ignore_errors=True) 226 226 else: 227 227 self._executive.kill_process(self._pid) -
trunk/Tools/Scripts/webkitpy/port/base.py
r227222 r227427 1491 1491 for path_to_module in self._modules_to_search_for_symbols(): 1492 1492 try: 1493 symbols += self._executive.run_command([self.nm_command(), path_to_module], error_handler=self._executive.ignore_error)1493 symbols += self._executive.run_command([self.nm_command(), path_to_module], ignore_errors=True) 1494 1494 except OSError as e: 1495 1495 _log.warn("Failed to run nm: %s. Can't determine supported features correctly." % e) -
trunk/Tools/Scripts/webkitpy/port/gtk.py
r225856 r227427 128 128 if self._driver_class() in [XvfbDriver, WestonDriver] and self._should_use_jhbuild(): 129 129 llvmpipe_libgl_path = self.host.executive.run_command(self._jhbuild_wrapper + ['printenv', 'LLVMPIPE_LIBGL_PATH'], 130 error_handler=self.host.executive.ignore_error).strip()130 ignore_errors=True).strip() 131 131 dri_libgl_path = os.path.join(llvmpipe_libgl_path, "dri") 132 132 if os.path.exists(os.path.join(llvmpipe_libgl_path, "libGL.so")) and os.path.exists(os.path.join(dri_libgl_path, "swrast_dri.so")): -
trunk/Tools/Scripts/webkitpy/port/win.py
r225856 r227427 152 152 supported_features_command = [self._path_to_driver(), '--print-supported-features'] 153 153 try: 154 output = self._executive.run_command(supported_features_command, error_handler=Executive.ignore_error)154 output = self._executive.run_command(supported_features_command, ignore_errors=True) 155 155 except OSError as e: 156 156 _log.warn("Exception running driver: %s, %s. Driver must be built before calling WebKitPort.test_expectations()." % (supported_features_command, e)) … … 262 262 _log.debug("Reading %s" % (registry_key)) 263 263 read_registry_command = ["regtool", arch, "get", registry_key] 264 int_value = self._executive.run_command(read_registry_command, error_handler=Executive.ignore_error)264 int_value = self._executive.run_command(read_registry_command, ignore_errors=True) 265 265 # regtool doesn't return the type of the entry, so need this ugly hack: 266 266 if reg_path in (self.WINDOWS_ERROR_REPORTING_KEY, self.WOW64_WINDOWS_ERROR_REPORTING_KEY): -
trunk/Tools/Scripts/webkitpy/port/win_unittest.py
r225856 r227427 96 96 def test_runtime_feature_list(self): 97 97 port = self.make_port() 98 port._executive.run_command = lambda command, cwd=None, error_handler=None: "Nonsense"98 port._executive.run_command = lambda command, cwd=None, ignore_errors=False: "Nonsense" 99 99 # runtime_features_list returns None when its results are meaningless (it couldn't run DRT or parse the output, etc.) 100 100 self.assertEqual(port._runtime_feature_list(), None) 101 port._executive.run_command = lambda command, cwd=None, error_handler=None: "SupportedFeatures:foo bar"101 port._executive.run_command = lambda command, cwd=None, ignore_errors=False: "SupportedFeatures:foo bar" 102 102 self.assertEqual(port._runtime_feature_list(), ['foo', 'bar']) 103 103 -
trunk/Tools/Scripts/webkitpy/tool/commands/analyzechangelog.py
r225724 r227427 36 36 from webkitpy.common.config.contributionareas import ContributionAreas 37 37 from webkitpy.common.system.filesystem import FileSystem 38 from webkitpy.common.system.executive import Executive39 38 from webkitpy.tool.multicommandtool import Command 40 39 from webkitpy.tool import steps -
trunk/Tools/Scripts/webkitpy/tool/commands/analyzechangelog_unittest.py
r148360 r227427 32 32 from webkitpy.common.host_mock import MockHost 33 33 from webkitpy.common.system.filesystem_mock import MockFileSystem 34 from webkitpy.common.system.executive import Executive35 34 from webkitpy.common.system.outputcapture import OutputCapture 36 35 from webkitpy.tool.commands.analyzechangelog import AnalyzeChangeLog
Note: See TracChangeset
for help on using the changeset viewer.