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

Kenneth Graunke kenneth at whitecape.org
Wed Dec 21 11:46:25 PST 2011


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>
---
 framework/core.py |    3 ---
 piglit-run.py     |    3 +++
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/framework/core.py b/framework/core.py
index 0bef48d..e64edbd 100644
--- a/framework/core.py
+++ b/framework/core.py
@@ -539,8 +539,6 @@ class TestProfile:
 
 		See ``Test.doRun``.
 		'''
-		json_writer.write_dict_key('tests')
-		json_writer.open_dict()
 		# queue up the concurrent tests up front, so the pool
 		# is filled from the start of the test.
 		if env.concurrent:
@@ -551,7 +549,6 @@ class TestProfile:
 		env.run_concurrent = False
 		self.tests.doRun(env, '', 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 92b554d..39e2ee0 100755
--- a/piglit-run.py
+++ b/piglit-run.py
@@ -134,7 +134,10 @@ def main():
 	profile = core.loadTestProfile(profileFilename, resultsDir)
 	time_start = time.time()
 
+	json_writer.write_dict_key('tests')
+	json_writer.open_dict()
 	profile.run(env, json_writer)
+	json_writer.close_dict()
 
 	time_end = time.time()
 	results.time_elapsed = time_end - time_start
-- 
1.7.7.3



More information about the Piglit mailing list