mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-07 12:28:24 +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:
@@ -111,8 +111,7 @@ def write_test_results(run, lit_config, testing_time, output_path):
|
|||||||
def main(builtinParameters = {}):
|
def main(builtinParameters = {}):
|
||||||
# Use processes by default on Unix platforms.
|
# Use processes by default on Unix platforms.
|
||||||
isWindows = platform.system() == 'Windows'
|
isWindows = platform.system() == 'Windows'
|
||||||
# multiprocessing is broken on various BSD Python versions: http://bugs.python.org/issue3770
|
useProcessesIsDefault = not isWindows
|
||||||
useProcessesIsDefault = (not isWindows) and ('BSD' not in platform.system())
|
|
||||||
|
|
||||||
global options
|
global options
|
||||||
from optparse import OptionParser, OptionGroup
|
from optparse import OptionParser, OptionGroup
|
||||||
|
@@ -209,16 +209,20 @@ class Run(object):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
# Choose the appropriate parallel execution implementation.
|
# 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
|
task_impl = threading.Thread
|
||||||
queue_impl = queue.Queue
|
queue_impl = queue.Queue
|
||||||
canceled_flag = LockedValue(0)
|
canceled_flag = LockedValue(0)
|
||||||
consumer = ThreadResultsConsumer(display)
|
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.
|
# Create the test provider.
|
||||||
provider = TestProvider(self.tests, jobs, queue_impl, canceled_flag)
|
provider = TestProvider(self.tests, jobs, queue_impl, canceled_flag)
|
||||||
|
Reference in New Issue
Block a user