summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2011-08-12 14:28:31 -0700
committerEric Anholt <eric@anholt.net>2011-08-28 20:53:54 -0700
commit87b362f7deb00876cd8c268f1e3a17d6645c7f40 (patch)
tree273a89b0c204e82d329417ac581300bae952432d
parent5a17cc0fdcb1cb2d4ee2a568e9e184af89a2af87 (diff)
piglit: Queue up all concurrent tests before starting serial test running.
Previously, there would be bursts of concurrent tests as we ran into a series of them while walking the list of tests. If we get to the point of the serial tests not being the limiting factor, it might have impacted our total time. Acked-by: Ian Romanick <ian.d.romanick@intel.com>
-rw-r--r--framework/core.py19
1 files changed, 16 insertions, 3 deletions
diff --git a/framework/core.py b/framework/core.py
index 90aa46104..5c583c72b 100644
--- a/framework/core.py
+++ b/framework/core.py
@@ -386,7 +386,10 @@ class TestrunResult:
class Environment:
def __init__(self):
+ # If disabled, runs all tests serially from the main thread.
self.concurrent = True
+ # Set when we want doRun to only run a test if it's concurrent.
+ self.run_concurrent = True
self.execute = True
self.filter = []
self.exclude_filter = []
@@ -437,10 +440,12 @@ class Test:
assigned to ``testrun.tests[path]``
'''
args = (env, path, json_writer)
- if self.runConcurrent and env.concurrent:
- ConcurrentTestPool().put(self.__doRunWork, args=args)
+ if env.run_concurrent:
+ if self.runConcurrent:
+ ConcurrentTestPool().put(self.__doRunWork, args=args)
else:
- self.__doRunWork(*args)
+ if not env.concurrent or not self.runConcurrent:
+ self.__doRunWork(*args)
def __doRunWork(self, env, path, json_writer):
# Exclude tests that don't match the filter regexp
@@ -537,6 +542,14 @@ class TestProfile:
'''
json_writer.write_dict_key('tests')
json_writer.open_dict()
+ # queue up the concurrent tests up front, so the pool
+ # is filled from the start of the test.
+ if env.concurrent:
+ env.run_concurrent = True
+ self.tests.doRun(env, '', json_writer)
+ # Run any remaining non-concurrent tests serially from this
+ # thread, while the concurrent tests
+ env.run_concurrent = False
self.tests.doRun(env, '', json_writer)
ConcurrentTestPool().join()
json_writer.close_dict()