mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-28 04:33:05 +00:00
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
This commit is contained in:
parent
887f9c5ec1
commit
a4e71dea48
@ -111,8 +111,7 @@ def write_test_results(run, lit_config, testing_time, output_path):
|
||||
def main(builtinParameters = {}):
|
||||
# Use processes by default on Unix platforms.
|
||||
isWindows = platform.system() == 'Windows'
|
||||
# multiprocessing is broken on various BSD Python versions: http://bugs.python.org/issue3770
|
||||
useProcessesIsDefault = (not isWindows) and ('BSD' not in platform.system())
|
||||
useProcessesIsDefault = not isWindows
|
||||
|
||||
global options
|
||||
from optparse import OptionParser, OptionGroup
|
||||
|
@ -209,16 +209,20 @@ class Run(object):
|
||||
"""
|
||||
|
||||
# Choose the appropriate parallel execution implementation.
|
||||
if jobs == 1 or not use_processes or multiprocessing is None:
|
||||
if jobs != 1 and use_processes and multiprocessing:
|
||||
try:
|
||||
task_impl = multiprocessing.Process
|
||||
queue_impl = multiprocessing.Queue
|
||||
canceled_flag = multiprocessing.Value('i', 0)
|
||||
consumer = MultiprocessResultsConsumer(self, display, jobs)
|
||||
except ImportError:
|
||||
# Workaround for BSD: http://bugs.python.org/issue3770
|
||||
consumer = None
|
||||
if not consumer:
|
||||
task_impl = threading.Thread
|
||||
queue_impl = queue.Queue
|
||||
canceled_flag = LockedValue(0)
|
||||
consumer = ThreadResultsConsumer(display)
|
||||
else:
|
||||
task_impl = multiprocessing.Process
|
||||
queue_impl = multiprocessing.Queue
|
||||
canceled_flag = multiprocessing.Value('i', 0)
|
||||
consumer = MultiprocessResultsConsumer(self, display, jobs)
|
||||
|
||||
# Create the test provider.
|
||||
provider = TestProvider(self.tests, jobs, queue_impl, canceled_flag)
|
||||
|
Loading…
Reference in New Issue
Block a user