[Piglit] [PATCH 3/4] Move writing of JSON 'tests' dictionary section out of TestProfile.run.

Kenneth Graunke kenneth at whitecape.org
Fri Feb 17 01:38:50 PST 2012


When resuming an interrupted piglit run, we'll want to output both
existing and new results into the same 'tests' section.  Since
TestProfile.run only handles newly run tests, it can't open/close the
JSON dictionary.

So, move it to the caller in piglit-run.py.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Paul Berry <stereotype441 at gmail.com> [v1]
---
 framework/core.py |    4 ----
 piglit-run.py     |    9 +++++++--
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/framework/core.py b/framework/core.py
index a84c68f..2af8ed3 100644
--- a/framework/core.py
+++ b/framework/core.py
@@ -514,9 +514,6 @@ class TestProfile:
 
 		See ``Test.schedule`` and ``Test.run``.
 		'''
-		json_writer.write_dict_key('tests')
-		json_writer.open_dict()
-
 		def matches_any_regexp(x, re_list):
 			return True in map(lambda r: r.search(x) != None, re_list)
 
@@ -539,7 +536,6 @@ class TestProfile:
 			if not env.concurrent or not test.runConcurrent:
 				test.doRun(env, path, json_writer)
 		ConcurrentTestPool().join()
-		json_writer.close_dict()
 
 	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 b6f8bf5..2867a73 100755
--- a/piglit-run.py
+++ b/piglit-run.py
@@ -132,11 +132,16 @@ def main():
 		json_writer.write_dict_item(key, value)
 
 	profile = core.loadTestProfile(profileFilename, resultsDir)
-	time_start = time.time()
 
-	profile.run(env, json_writer)
+	json_writer.write_dict_key('tests')
+	json_writer.open_dict()
 
+	time_start = time.time()
+	profile.run(env, json_writer)
 	time_end = time.time()
+
+	json_writer.close_dict()
+
 	results.time_elapsed = time_end - time_start
 	json_writer.write_dict_item('time_elapsed', results.time_elapsed)
 
-- 
1.7.7.6



More information about the Piglit mailing list