On 08/12/15 01:07, [email protected] wrote:
From: Dylan Baker <[email protected]>

Storing recording the traceback into the object is nice and all, but it
would be really nice if it was written and read from disk too.

Signed-off-by: Dylan Baker <[email protected]>
---
  framework/results.py             |  3 ++-
  framework/tests/results_tests.py | 10 ++++++++++
  2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/framework/results.py b/framework/results.py
index eeffcb7..5d73100 100644
--- a/framework/results.py
+++ b/framework/results.py
@@ -197,6 +197,7 @@ class TestResult(object):
              'time': self.time,
              'exception': self.exception,
              'dmesg': self.dmesg,
+            'traceback': self.traceback,
          }
          return obj

@@ -216,7 +217,7 @@ class TestResult(object):
          inst = cls()

          for each in ['returncode', 'command', 'exception', 'environment',
-                     'time', 'result', 'dmesg']:
+                     'time', 'result', 'dmesg', 'traceback']:
              if each in dict_:
                  setattr(inst, each, dict_[each])

diff --git a/framework/tests/results_tests.py b/framework/tests/results_tests.py
index 83c2ae2..5e9d55a 100644
--- a/framework/tests/results_tests.py
+++ b/framework/tests/results_tests.py
@@ -205,6 +205,7 @@ class TestTestResult_to_json(object):
              'result': 'crash',
              'exception': 'an exception',
              'dmesg': 'this is dmesg',
+            'traceback': 'this is a traceback',
          }

          test = results.TestResult.from_dict(cls.dict)
@@ -247,6 +248,10 @@ class TestTestResult_to_json(object):
          """results.TestResult.to_json: Adds the dmesg attribute"""
          nt.eq_(self.json['dmesg'], 'this is dmesg')

+    def test_traceback(self):
+        """results.TestResult.to_json: Adds the traceback attribute"""
+        nt.eq_(self.json['traceback'], 'this is a traceback')
+

  class TestTestResult_from_dict(object):
      """Tests for the from_dict method."""
@@ -265,6 +270,7 @@ class TestTestResult_from_dict(object):
              'result': 'crash',
              'exception': 'an exception',
              'dmesg': 'this is dmesg',
+            'traceback': 'this is a traceback',
          }

          cls.test = results.TestResult.from_dict(cls.dict)
@@ -306,6 +312,10 @@ class TestTestResult_from_dict(object):
          """results.TestResult.from_dict: sets dmesg properly"""
          nt.eq_(self.test.dmesg, self.dict['dmesg'])

+    def test_traceback(self):
+        """results.TestResult.to_json: Adds the traceback attribute"""
+        nt.eq_(self.test.traceback, self.dict['traceback'])
+

  def test_TestResult_update():
      """results.TestResult.update: result is updated"""


Reviewed-by: Jose Fonseca <[email protected]>

Jose
_______________________________________________
Piglit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to