[Piglit] [PATCH] piglit-run: Add option to enable/disable concurrent test runs

Chad Versace chad at chad-versace.us
Fri Jun 17 10:57:30 PDT 2011


-c bool, --concurrent=bool  Enable/disable concurrent test runs. Valid
			    option values are: 0, 1, on, off.  (default: on)

CC: Ben Widawsky <ben at bwidawsk.net>
Signed-off-by: Chad Versace <chad at chad-versace.us>
---
 framework/core.py |    3 ++-
 piglit-run.py     |   20 ++++++++++++++++++--
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/framework/core.py b/framework/core.py
index ee56852..fb17258 100644
--- a/framework/core.py
+++ b/framework/core.py
@@ -268,6 +268,7 @@ class TestrunResult:
 
 class Environment:
 	def __init__(self):
+		self.concurrent = True
 		self.file = sys.stdout
 		self.execute = True
 		self.filter = []
@@ -305,7 +306,7 @@ class Test:
 		raise NotImplementedError
 
 	def doRun(self, env, path):
-		if self.runConcurrent:
+		if self.runConcurrent and env.concurrent:
 			ConcurrentTestPool().put(self.__doRunWork, args = (env, path,))
 		else:
 			self.__doRunWork(env, path)
diff --git a/piglit-run.py b/piglit-run.py
index 1e6d515..11a7340 100755
--- a/piglit-run.py
+++ b/piglit-run.py
@@ -75,7 +75,8 @@ Options:
   -x regexp, --exclude-tests=regexp Excludey matching tests (can be used
                             more than once)
   -n name, --name=name      Name of the testrun
-
+  -c bool, --concurrent=bool  Enable/disable concurrent test runs. Valid
+			      option values are: 0, 1, on, off.  (default: on)
 Example:
   %(progName)s tests/all.tests results/all
          Run all tests, store the results in the directory results/all
@@ -94,7 +95,15 @@ def main():
 	env = core.Environment()
 
 	try:
-		options, args = getopt(sys.argv[1:], "hdt:n:x:", [ "help", "dry-run", "tests=", "name=", "exclude-tests=" ])
+		option_list = [
+			 "help",
+			 "dry-run",
+			 "tests=",
+			 "name=",
+			 "exclude-tests=",
+			 "concurrent=",
+			 ]
+		options, args = getopt(sys.argv[1:], "hdt:n:x:c:", option_list)
 	except GetoptError:
 		usage()
 
@@ -111,6 +120,13 @@ def main():
 			env.exclude_filter[:0] = [re.compile(value)]
 		elif name in ('-n', '--name'):
 			OptionName = value
+		elif name in ('-c, --concurrent'):
+			if value in ('1', 'on'):
+				env.concurrent = True
+			elif value in ('0', 'off'):
+				env.concurrent = False
+			else:
+				usage()
 
 	if len(args) != 2:
 		usage()
-- 
1.7.5.2



More information about the Piglit mailing list