[Piglit] [PATCH 07/19] results.py: Add write_test method

Dylan Baker baker.dylan.c at gmail.com
Thu Aug 28 15:35:35 PDT 2014


This is the test writing method provided by Backend.

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 framework/exectest.py     | 2 +-
 framework/programs/run.py | 2 +-
 framework/results.py      | 5 +++++
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/framework/exectest.py b/framework/exectest.py
index 90067e4..cb07ae0 100644
--- a/framework/exectest.py
+++ b/framework/exectest.py
@@ -123,7 +123,7 @@ class Test(object):
             log.log(path, self.result['result'])
             log.post_log(log_current, self.result['result'])
 
-            json_writer.write_dict_item(path, self.result)
+            json_writer.write_test(path, self.result)
         else:
             log.log(path, 'dry-run')
             log.post_log(log_current, 'dry-run')
diff --git a/framework/programs/run.py b/framework/programs/run.py
index c7aa789..d2afeff 100644
--- a/framework/programs/run.py
+++ b/framework/programs/run.py
@@ -276,7 +276,7 @@ def resume(input_):
                                                file_fsync=opts.sync)
 
     for key, value in results.tests.iteritems():
-        json_writer.write_dict_item(key, value)
+        json_writer.write_test(key, value)
         opts.exclude_tests.add(key)
 
     profile = framework.profile.merge_test_profiles(results.options['profile'])
diff --git a/framework/results.py b/framework/results.py
index 0b69f9d..a767ad4 100644
--- a/framework/results.py
+++ b/framework/results.py
@@ -342,6 +342,11 @@ class JSONWriter(object):
 
         self.__file_sync()
 
+    @synchronized_self
+    def write_test(self, name, data):
+        """ Write a test into the JSON tests dictionary """
+        self.write_dict_item(name, data)
+
 
 class TestResult(dict):
     def __init__(self, *args):
-- 
2.1.0



More information about the Piglit mailing list