diff options
| author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-09-10 19:10:20 +0200 |
|---|---|---|
| committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-09-10 19:10:20 +0200 |
| commit | 284837daa07b29d6a63a748544a90b1f5842ac5c (patch) | |
| tree | ecd258180bde91fe741e0cfd2638beb3c6da7e8e /Tools/Scripts/webkitpy/common/system | |
| parent | 2e2ba8ff45915f40ed3e014101269c175f2a89a0 (diff) | |
| download | qtwebkit-284837daa07b29d6a63a748544a90b1f5842ac5c.tar.gz | |
Imported WebKit commit 68645295d2e3e09af2c942f092556f06aa5f8b0d (http://svn.webkit.org/repository/webkit/trunk@128073)
New snapshot
Diffstat (limited to 'Tools/Scripts/webkitpy/common/system')
5 files changed, 19 insertions, 5 deletions
diff --git a/Tools/Scripts/webkitpy/common/system/executive.py b/Tools/Scripts/webkitpy/common/system/executive.py index 1099e07fb..f1a401268 100644 --- a/Tools/Scripts/webkitpy/common/system/executive.py +++ b/Tools/Scripts/webkitpy/common/system/executive.py @@ -459,6 +459,8 @@ class Executive(object): def run_in_parallel(self, command_lines_and_cwds, processes=None): """Runs a list of (cmd_line list, cwd string) tuples in parallel and returns a list of (retcode, stdout, stderr) tuples.""" + assert len(command_lines_and_cwds) + if sys.platform in ('cygwin', 'win32'): return map(_run_command_thunk, command_lines_and_cwds) pool = multiprocessing.Pool(processes=processes) diff --git a/Tools/Scripts/webkitpy/common/system/executive_mock.py b/Tools/Scripts/webkitpy/common/system/executive_mock.py index cfe989968..cce21b233 100644 --- a/Tools/Scripts/webkitpy/common/system/executive_mock.py +++ b/Tools/Scripts/webkitpy/common/system/executive_mock.py @@ -58,11 +58,20 @@ class MockExecutive(object): self._should_throw = should_throw self._should_throw_when_run = should_throw_when_run or set() # FIXME: Once executive wraps os.getpid() we can just use a static pid for "this" process. - self._running_pids = [os.getpid()] + self._running_pids = {'test-webkitpy': os.getpid()} self._proc = None def check_running_pid(self, pid): - return pid in self._running_pids + return pid in self._running_pids.values() + + def running_pids(self, process_name_filter): + running_pids = [] + for process_name, process_pid in self._running_pids.iteritems(): + if process_name_filter(process_name): + running_pids.append(process_pid) + + log("MOCK running_pids: %s" % running_pids) + return running_pids def run_and_throw_if_fail(self, args, quiet=False, cwd=None, env=None): if self._should_log: diff --git a/Tools/Scripts/webkitpy/common/system/executive_unittest.py b/Tools/Scripts/webkitpy/common/system/executive_unittest.py index 79a8281cd..8a322e480 100644 --- a/Tools/Scripts/webkitpy/common/system/executive_unittest.py +++ b/Tools/Scripts/webkitpy/common/system/executive_unittest.py @@ -235,6 +235,9 @@ class ExecutiveTest(unittest.TestCase): self.assertEquals([output[1] for output in command_outputs], ["hello\n"] * NUM_PROCESSES) self.assertEquals([], multiprocessing.active_children()) + def test_run_in_parallel_assert_nonempty(self): + self.assertRaises(AssertionError, Executive().run_in_parallel, []) + def main(platform, stdin, stdout, cmd, args): if platform == 'win32' and hasattr(stdout, 'fileno'): diff --git a/Tools/Scripts/webkitpy/common/system/workspace.py b/Tools/Scripts/webkitpy/common/system/workspace.py index 5c73df77e..686837619 100644 --- a/Tools/Scripts/webkitpy/common/system/workspace.py +++ b/Tools/Scripts/webkitpy/common/system/workspace.py @@ -65,7 +65,7 @@ class Workspace(object): # However, getting the paths, encoding and compression correct could be non-trivial. # So, for now we depend on the environment having "zip" installed (likely fails on Win32) try: - self._executive.run_command(['zip', '-9', '-r', zip_path, source_path]) + self._executive.run_command(['zip', '-9', '-r', zip_path, '.'], cwd=source_path) except ScriptError, e: _log.error("Workspace.create_zip failed:\n%s" % e.message_with_output()) return None diff --git a/Tools/Scripts/webkitpy/common/system/workspace_unittest.py b/Tools/Scripts/webkitpy/common/system/workspace_unittest.py index 642afb9c6..49094ac63 100644 --- a/Tools/Scripts/webkitpy/common/system/workspace_unittest.py +++ b/Tools/Scripts/webkitpy/common/system/workspace_unittest.py @@ -50,7 +50,7 @@ class WorkspaceTest(unittest.TestCase): def test_create_zip(self): workspace = Workspace(None, MockExecutive(should_log=True)) - expected_stderr = "MOCK run_command: ['zip', '-9', '-r', '/zip/path', '/source/path'], cwd=None\n" + expected_stderr = "MOCK run_command: ['zip', '-9', '-r', '/zip/path', '.'], cwd=/source/path\n" class MockZipFile(object): def __init__(self, path): self.filename = path @@ -59,7 +59,7 @@ class WorkspaceTest(unittest.TestCase): def test_create_zip_exception(self): workspace = Workspace(None, MockExecutive(should_log=True, should_throw=True)) - expected_stderr = "MOCK run_command: ['zip', '-9', '-r', '/zip/path', '/source/path'], cwd=None\n" + expected_stderr = "MOCK run_command: ['zip', '-9', '-r', '/zip/path', '.'], cwd=/source/path\n" class MockZipFile(object): def __init__(self, path): self.filename = path |
