[Piglit] [PATCH] framework: Split a TestProfile.prepare_test_list helper out of run().

Kenneth Graunke kenneth at whitecape.org
Tue Apr 17 17:22:30 PDT 2012

Before scheduling or running the tests, run() prepared the final list of
tests to run: first, flatten the Group() hierarchy; second, filter out
tests based on the -t and -x options.

It makes sense to have this as a helper function.  Doing so will also
enable other utilities that (for example) print a list of tests that
would be run and their command line programs.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
 framework/core.py |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/framework/core.py b/framework/core.py
index b85072a..4c255ca 100644
--- a/framework/core.py
+++ b/framework/core.py
@@ -510,13 +510,9 @@ class TestProfile:
 		# Clear out the old Group()
 		self.tests = Group()
-	def run(self, env, json_writer):
+	def prepare_test_list(self, env):
-		'''
-		Schedule all tests in profile for execution.
-		See ``Test.schedule`` and ``Test.run``.
-		'''
 		def matches_any_regexp(x, re_list):
 			return True in map(lambda r: r.search(x) != None, re_list)
@@ -528,6 +524,15 @@ class TestProfile:
 		# Filter out unwanted tests
 		self.test_list = dict(filter(test_matches, self.test_list.items()))
+	def run(self, env, json_writer):
+		'''
+		Schedule all tests in profile for execution.
+		See ``Test.schedule`` and ``Test.run``.
+		'''
+		self.prepare_test_list(env)
 		# Queue up all the concurrent tests, so the pool is filled
 		# at the start of the test run.
 		if env.concurrent:

More information about the Piglit mailing list