llvm.org GIT mirror llvm / a4e71de
lit: handle late multiprocessing errors gracefully This should be a better fix for lit multiprocessing failures, replacing the OpenBSD and FreeBSD workarounds in r193413 and r193457. Reference: http://bugs.python.org/issue3770 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193463 91177308-0d34-0410-b5e6-96231b3b80d8 Alp Toker 5 years ago
2 changed file(s) with 11 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
110110 def main(builtinParameters = {}):
111111 # Use processes by default on Unix platforms.
112112 isWindows = platform.system() == 'Windows'
113 # multiprocessing is broken on various BSD Python versions: http://bugs.python.org/issue3770
114 useProcessesIsDefault = (not isWindows) and ('BSD' not in platform.system())
113 useProcessesIsDefault = not isWindows
115114
116115 global options
117116 from optparse import OptionParser, OptionGroup
208208 """
209209
210210 # Choose the appropriate parallel execution implementation.
211 if jobs == 1 or not use_processes or multiprocessing is None:
211 if jobs != 1 and use_processes and multiprocessing:
212 try:
213 task_impl = multiprocessing.Process
214 queue_impl = multiprocessing.Queue
215 canceled_flag = multiprocessing.Value('i', 0)
216 consumer = MultiprocessResultsConsumer(self, display, jobs)
217 except ImportError:
218 # Workaround for BSD: http://bugs.python.org/issue3770
219 consumer = None
220 if not consumer:
212221 task_impl = threading.Thread
213222 queue_impl = queue.Queue
214223 canceled_flag = LockedValue(0)
215224 consumer = ThreadResultsConsumer(display)
216 else:
217 task_impl = multiprocessing.Process
218 queue_impl = multiprocessing.Queue
219 canceled_flag = multiprocessing.Value('i', 0)
220 consumer = MultiprocessResultsConsumer(self, display, jobs)
221225
222226 # Create the test provider.
223227 provider = TestProvider(self.tests, jobs, queue_impl, canceled_flag)