[Piglit] [PATCH] results.py: Fix JSONWriter.close_json()

Dylan Baker baker.dylan.c at gmail.com
Tue Jun 24 18:05:27 PDT 2014

This bug was caused by calling close_dict() too many times for
piglit-run (but the correct number of times for piglit-resume), the
solution is to actually count the number of open dicts and close them
until the stack is empty

Signed-off-by: Dylan Baker <baker.dylan.c at gmail.com>
cc: tom at stellard.net
cc: imirkin at alum.mit.edu

Ilia, Do you have a better suggestion, you weren't thrilled with this
implementation the first time around, but it definately solves the
problem that Tom is seeing here:
which is caused becuase run and resume do different things after the
tests finish running.

 framework/results.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/framework/results.py b/framework/results.py
index 43c1736..13f7c0c 100644
--- a/framework/results.py
+++ b/framework/results.py
@@ -170,9 +170,9 @@ class JSONWriter(object):
         containers that are still open and closes the file
-        self.close_dict()
-        self.close_dict()
-        assert self._open_containers == []
+        for x in self._open_containers:
+            if x == 'dict':
+                self.close_dict()

More information about the Piglit mailing list