[Piglit] [Patch v2] results.py: Fix JSONWriter.close_json()
Dylan Baker
baker.dylan.c at gmail.com
Tue Jun 24 18:20:46 PDT 2014
A previous patch created a bug which caused an AssertionError at the end
of a piglit run. This bug is the result of calling
JSONWriter.close_dict() too many times. This solution is to split the
start of the test dict out of initialize_json() and do it in the calling
function instead.
v2: - take this approach rather than close dicts as a stack
Signed-off-by: Dylan Baker <baker.dylan.c at gmail.com>
---
framework/programs/run.py | 6 ++++++
framework/results.py | 4 ----
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/framework/programs/run.py b/framework/programs/run.py
index eea0a60..bd9bd2e 100644
--- a/framework/programs/run.py
+++ b/framework/programs/run.py
@@ -170,6 +170,9 @@ def run(input_):
json_writer.initialize_json(options, results.name,
core.collect_system_info())
+ json_writer.write_dict_key('tests')
+ json_writer.open_dict()
+
profile = framework.profile.merge_test_profiles(args.test_profile)
profile.results_dir = args.results_path
@@ -217,6 +220,9 @@ def resume(input_):
json_writer.initialize_json(results.options, results.name,
core.collect_system_info())
+ json_writer.write_dict_key('tests')
+ json_writer.open_dict()
+
for key, value in results.tests.iteritems():
json_writer.write_dict_item(key, value)
opts.exclude_tests.add(key)
diff --git a/framework/results.py b/framework/results.py
index 43c1736..1a6a652 100644
--- a/framework/results.py
+++ b/framework/results.py
@@ -160,9 +160,6 @@ class JSONWriter(object):
for key, value in env.iteritems():
self.write_dict_item(key, value)
- self.write_dict_key('tests')
- self.open_dict()
-
def close_json(self):
""" End json serialization and cleanup
@@ -171,7 +168,6 @@ class JSONWriter(object):
"""
self.close_dict()
- self.close_dict()
assert self._open_containers == []
self.file.close()
--
2.0.0
More information about the Piglit
mailing list