Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1243)

Unified Diff: presubmit_support.py

Issue 1208743002: Changes to improve multiprocessing PRESUBMIT support in Windows (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: fix tests Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « presubmit_canned_checks.py ('k') | tests/presubmit_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: presubmit_support.py
diff --git a/presubmit_support.py b/presubmit_support.py
index 4baee778831d229386738d1a42d1a3b2b5ebef88..523bb79a1245f4c30534bea2e90ac447dda49aba 100755
--- a/presubmit_support.py
+++ b/presubmit_support.py
@@ -313,6 +313,12 @@ class InputApi(object):
self.cpu_count = multiprocessing.cpu_count()
+ # this is done here because in RunTests, the current working directory has
+ # changed, which causes Pool() to explode fantastically when run on windows
+ # (because it tries to load the __main__ module, which imports lots of
+ # things relative to the current working directory).
+ self._run_tests_pool = multiprocessing.Pool(self.cpu_count)
iannucci 2015/06/28 19:47:43 this is so we pick up the mocked cpu_count
+
# The local path of the currently-being-processed presubmit script.
self._current_presubmit_path = os.path.dirname(presubmit_path)
@@ -492,11 +498,8 @@ class InputApi(object):
if self.verbose:
t.info = _PresubmitNotifyResult
if len(tests) > 1 and parallel:
- pool = multiprocessing.Pool()
# async recipe works around multiprocessing bug handling Ctrl-C
- msgs.extend(pool.map_async(CallCommand, tests).get(99999))
- pool.close()
- pool.join()
+ msgs.extend(self._run_tests_pool.map_async(CallCommand, tests).get(99999))
else:
msgs.extend(map(CallCommand, tests))
return [m for m in msgs if m]
« no previous file with comments | « presubmit_canned_checks.py ('k') | tests/presubmit_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698