aboutsummaryrefslogtreecommitdiffstats
path: root/utils/lit
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2013-08-29 00:54:09 +0000
committerDaniel Dunbar <daniel@zuster.org>2013-08-29 00:54:09 +0000
commitb11b690d3f36d552091423293489f845090efb4f (patch)
tree7d2d33a7fa6af01ff3575dd3c6f90514be57f56c /utils/lit
parentec8e0592544de7b99b87535352a26b0420c51820 (diff)
downloadexternal_llvm-b11b690d3f36d552091423293489f845090efb4f.zip
external_llvm-b11b690d3f36d552091423293489f845090efb4f.tar.gz
external_llvm-b11b690d3f36d552091423293489f845090efb4f.tar.bz2
[lit] Put display lock inside the ThreadResultsConsumer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189553 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/lit')
-rwxr-xr-xutils/lit/lit/main.py26
1 files changed, 9 insertions, 17 deletions
diff --git a/utils/lit/lit/main.py b/utils/lit/lit/main.py
index 0a7347b..29275ac 100755
--- a/utils/lit/lit/main.py
+++ b/utils/lit/lit/main.py
@@ -22,23 +22,9 @@ class TestingProgressDisplay:
self.opts = opts
self.numTests = numTests
self.current = None
- self.lock = threading.Lock()
self.progressBar = progressBar
self.completed = 0
- def update(self, test):
- # Avoid locking overhead in quiet mode
- if self.opts.quiet and not test.result.code.isFailure:
- self.completed += 1
- return
-
- # Output lock.
- self.lock.acquire()
- try:
- self.handleUpdate(test)
- finally:
- self.lock.release()
-
def finish(self):
if self.progressBar:
self.progressBar.clear()
@@ -47,13 +33,14 @@ class TestingProgressDisplay:
elif self.opts.succinct:
sys.stdout.write('\n')
- def handleUpdate(self, test):
+ def update(self, test):
self.completed += 1
if self.progressBar:
self.progressBar.update(float(self.completed)/self.numTests,
test.getFullName())
- if self.opts.succinct and not test.result.code.isFailure:
+ if not test.result.code.isFailure and \
+ (self.opts.quiet or self.opts.succinct):
return
if self.progressBar:
@@ -129,9 +116,14 @@ class Tester(object):
class ThreadResultsConsumer(object):
def __init__(self, display):
self.display = display
+ self.lock = threading.Lock()
def update(self, test_index, test):
- self.display.update(test)
+ self.lock.acquire()
+ try:
+ self.display.update(test)
+ finally:
+ self.lock.release()
def taskFinished(self):
pass