[Piglit] [PATCH] framework/results.py: write and restore traceback.

Jose Fonseca jfonseca at vmware.com
Wed Dec 9 00:09:54 PST 2015


On 08/12/15 01:07, baker.dylan.c at gmail.com wrote:
> From: Dylan Baker <baker.dylan.c at gmail.com>
>
> 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 <dylanx.c.baker at intel.com>
> ---
>   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 <jfonseca at vmware.com>

Jose


More information about the Piglit mailing list