Commit d525a0ce authored by Dylan Baker's avatar Dylan Baker

Add new concurrency option

This patch adds a new concurrency option that runs all tests out of a
multi-threaded pool, ignoring their request to be threaded or not. This
new option is mutually exclusive with the -1/--no-concurrency option.
Signed-off-by: Dylan Baker's avatarDylan Baker <baker.dylan.c@gmail.com>
parent d3db9a10
......@@ -564,22 +564,32 @@ class TestProfile:
self.prepare_test_list(env)
# If using concurrency, add all the concurrent tests to the pool and
# execute that pool
if env.concurrent:
# If concurrency is set to 'all' run all tests out of a concurrent
# threadpool, if it's none, then run evey test serially. otherwise mix
# and match them
if env.concurrent == "all":
pool = ThreadPool(multiprocessing.cpu_count())
for (path, test) in self.test_list.items():
pool.add(test.execute, (env, path, json_writer))
pool.join()
elif env.concurrent == "none":
pool = ThreadPool(1)
for (path, test) in self.test_list.items():
if not env.concurrent or not test.runConcurrent:
pool.add(test.execute, (env, path, json_writer))
pool.join()
else:
pool = ThreadPool(multiprocessing.cpu_count())
for (path, test) in self.test_list.items():
if test.runConcurrent:
pool.add(test.execute, (env, path, json_writer))
pool.join()
# Run any remaining tests serially from a single thread pool after the
# concurrent tests have finished
pool = ThreadPool(1)
for (path, test) in self.test_list.items():
if not env.concurrent or not test.runConcurrent:
pool.add(test.execute, (env, path, json_writer))
pool.join()
pool = ThreadPool(1)
for (path, test) in self.test_list.items():
if not test.runConcurrent:
pool.add(test.execute, (env, path, json_writer))
pool.join()
def remove_test(self, test_path):
"""Remove a fully qualified test from the profile.
......
......@@ -56,10 +56,19 @@ def main():
metavar="<regex>",
help="Exclude matching tests "
"(can be used more than once)")
parser.add_argument("-1", "--no-concurrency",
action="store_false",
dest="concurrency",
help="Disable concurrent test runs")
conc_parser = parser.add_mutually_exclusive_group()
conc_parser.add_argument('-c', '--all-concurrent',
action="store_const",
default="some",
const="all",
dest="concurrency",
help="Run all tests concurrently")
conc_parser.add_argument("-1", "--no-concurrency",
action="store_const",
default="some",
const="none",
dest="concurrency",
help="Disable concurrent test runs")
parser.add_argument("-p", "--platform",
choices=["glx", "x11_egl", "wayland", "gbm"],
help="Name of windows system passed to waffle")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment