aboutsummaryrefslogtreecommitdiff
path: root/utils/test/MultiTestRunner.py
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-08-01 03:35:40 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-08-01 03:35:40 +0000
commit2bdccea9a7e2d028d319e7f6fe40e8e1553615bb (patch)
treeb2495c0a7f83bb6c9415db1aeb0579343bb3f428 /utils/test/MultiTestRunner.py
parent93fe03fb77dc4bb660775ef3447584182f60f018 (diff)
lit: Don't use threads when only running one test, or with -j 1.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77766 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/test/MultiTestRunner.py')
-rwxr-xr-xutils/test/MultiTestRunner.py34
1 files changed, 23 insertions, 11 deletions
diff --git a/utils/test/MultiTestRunner.py b/utils/test/MultiTestRunner.py
index cccc6e2360..93532ebf64 100755
--- a/utils/test/MultiTestRunner.py
+++ b/utils/test/MultiTestRunner.py
@@ -190,6 +190,24 @@ def findConfigPath(root):
raise ValueError,"Unable to find config file %r" % kConfigName
+def runTests(opts, provider):
+ # If only using one testing thread, don't use threads at all; this lets us
+ # profile, among other things.
+ if opts.numThreads == 1:
+ t = Tester(provider)
+ t.run()
+ return
+
+ # Otherwise spin up the testing threads and wait for them to finish.
+ testers = [Tester(provider) for i in range(opts.numThreads)]
+ for t in testers:
+ t.start()
+ try:
+ for t in testers:
+ t.join()
+ except KeyboardInterrupt:
+ sys.exit(1)
+
def main():
global options
from optparse import OptionParser, OptionGroup
@@ -323,19 +341,13 @@ def main():
if not progressBar:
print header
- display = TestingProgressDisplay(opts, len(tests), progressBar)
- provider = TestProvider(cfg, opts, tests, display)
+ # Don't create more threads than tests.
+ opts.numThreads = min(len(tests), opts.numThreads)
- testers = [Tester(provider) for i in range(opts.numThreads)]
startTime = time.time()
- for t in testers:
- t.start()
- try:
- for t in testers:
- t.join()
- except KeyboardInterrupt:
- sys.exit(1)
-
+ display = TestingProgressDisplay(opts, len(tests), progressBar)
+ provider = TestProvider(cfg, opts, tests, display)
+ runTests(opts, provider)
display.finish()
if not opts.quiet: