[Piglit] [PATCH 4/4] Replace poolName in Test constructor with boolean option.

U. Artie Eoff ullysses.a.eoff at intel.com
Sat Feb 12 12:07:08 PST 2011


Replaced poolName in the Test constructor with runConcurrent
boolean option.  runConcurrent defaults to False.  When True, the
Test pushes its doRunWork to the ConcurrentTestPool to be executed
in another thread.  When False, doRunWork is executed immediately
on the calling thread (main thread).
---
 framework/core.py             |   15 ++++++++++-----
 framework/glsl_parser_test.py |    6 +++---
 tests/all.tests               |    4 ++--
 3 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/framework/core.py b/framework/core.py
index 8f33b91..58b6292 100644
--- a/framework/core.py
+++ b/framework/core.py
@@ -290,17 +290,22 @@ class Test:
 	ignoreErrors = []
 	sleep = 0
 
-	def __init__(self, poolName = "base"):
-		self.poolName = poolName
+	def __init__(self, runConcurrent = False):
+		'''
+			'runConcurrent' controls whether this test will
+			execute it's work (i.e. __doRunWork) on the calling thread
+			(i.e. the main thread) or from the ConcurrentTestPool threads.
+		'''
+		self.runConcurrent = runConcurrent
 
 	def run(self):
 		raise NotImplementedError
 
 	def doRun(self, env, path):
-		if "base" == self.poolName:
-			self.__doRunWork(env, path)
-		else:
+		if self.runConcurrent:
 			ConcurrentTestPool().put(self.__doRunWork, args = (env, path,))
+		else:
+			self.__doRunWork(env, path)
 
 	def __doRunWork(self, env, path):
 		# Exclude tests that don't match the filter regexp
diff --git a/framework/glsl_parser_test.py b/framework/glsl_parser_test.py
index 3ecdf4c..0351125 100755
--- a/framework/glsl_parser_test.py
+++ b/framework/glsl_parser_test.py
@@ -185,11 +185,11 @@ class GLSLParserTest(PlainExecTest):
 		'require_extensions' : '',
 		}
 
-	def __init__(self, filepath, poolName='gpu-not-used'):
+	def __init__(self, filepath, runConcurrent = True):
 		"""
 		:filepath: Must end in one '.vert', '.geom', or '.frag'.
 		"""
-		Test.__init__(self, poolName)
+		Test.__init__(self, runConcurrent)
 		self.__config = None
 		self.__command = None
 		self.__filepath = filepath
@@ -305,7 +305,7 @@ class GLSLParserTest(PlainExecTest):
 
 		Check that that all required options are present. If
 		validation fails, set ``self.result`` to failure.
-		
+
 		Currently, this function does not validate the options'
 		values.
 
diff --git a/tests/all.tests b/tests/all.tests
index c817dc0..ef0bcd8 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1169,7 +1169,7 @@ for filename in os.listdir('tests/glslparsertest/glsl2'):
 asmparsertest = Group()
 def add_asmparsertest(group, shader):
 	test = PlainExecTest(['asmparsertest', '-auto', group, 'tests/asmparsertest/shaders/' + group + '/' + shader])
-	test.poolName = "gpu-not-used"
+	test.runConcurrent = True
 	asmparsertest[group + '/' + shader] = test
 
 add_asmparsertest('ARBfp1.0', 'abs-01.txt')
@@ -1620,7 +1620,7 @@ profile.tests['glx'] = glx
 
 class ValgrindExecTest(PlainExecTest):
 	def __init__(self, test):
-		Test.__init__(self, test.poolName)
+		Test.__init__(self, test.runConcurrent)
 		self.orig_test = test
 		self.env = {}
 		if 'PIGLIT_TEST' in test.env:
-- 
1.7.3.4



More information about the Piglit mailing list