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 <[email protected]> --- framework/core.py | 30 ++++++++++++++++++++---------- piglit-run.py | 17 +++++++++++++---- 2 files changed, 33 insertions(+), 14 deletions(-) diff --git a/framework/core.py b/framework/core.py index 5a9e8b0..c8dc4bc 100644 --- a/framework/core.py +++ b/framework/core.py @@ -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. diff --git a/piglit-run.py b/piglit-run.py index 0d3d1be..c4bed93 100755 --- a/piglit-run.py +++ b/piglit-run.py @@ -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") -- 1.8.5.1 _______________________________________________ Piglit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/piglit
