summaryrefslogtreecommitdiffstats
path: root/utils/lit
diff options
context:
space:
mode:
authorAlp Toker <alp@nuanti.com>2013-10-26 08:22:44 +0000
committerAlp Toker <alp@nuanti.com>2013-10-26 08:22:44 +0000
commita4e71dea487750cd13a5a5821df3acee32988bf4 (patch)
tree3acdcf6cd09daf3c41d599af97f7b80f4e9c53f0 /utils/lit
parent887f9c5ec15582aec34aa6c28955d01e4e9961e2 (diff)
downloadexternal_llvm-a4e71dea487750cd13a5a5821df3acee32988bf4.zip
external_llvm-a4e71dea487750cd13a5a5821df3acee32988bf4.tar.gz
external_llvm-a4e71dea487750cd13a5a5821df3acee32988bf4.tar.bz2
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
Diffstat (limited to 'utils/lit')
-rwxr-xr-xutils/lit/lit/main.py3
-rw-r--r--utils/lit/lit/run.py16
2 files changed, 11 insertions, 8 deletions
diff --git a/utils/lit/lit/main.py b/utils/lit/lit/main.py
index 9754f2f..6f672a0 100755
--- a/utils/lit/lit/main.py
+++ b/utils/lit/lit/main.py
@@ -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
diff --git a/utils/lit/lit/run.py b/utils/lit/lit/run.py
index 8642ff1..8aaf52f 100644
--- a/utils/lit/lit/run.py
+++ b/utils/lit/lit/run.py
@@ -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)