[Piglit] [PATCH] framework: actually write dmesg to testresult

Daniel Vetter daniel at ffwll.ch
Mon Oct 12 00:21:15 PDT 2015


On Sat, Oct 10, 2015 at 01:10:25PM -0700, Dylan Baker wrote:
> Everything is hooked up, except writing it. Restoring, processing, all
> of that still works, just not writing it to the json, so fix that.
> 
> cc: imirkin at alum.mit.edu
> Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>

Just random thought: By writing into /dev/kmsg you can inject stuff into
dmesg, which would allow us to test all the dmesg capturing stuff.
Unfortunately only works as root :( Plan B would be to inject a mocked
dmesg script into PATH while running dmesg-related tests.
-Daniel

> ---
> 
> Ilia: if this looks good to you and you want it before Monday feel free
> to push it.
> 
>  framework/results.py             |  1 +
>  framework/tests/results_tests.py | 10 ++++++++++
>  2 files changed, 11 insertions(+)
> 
> diff --git a/framework/results.py b/framework/results.py
> index 5354a32..847ab14 100644
> --- a/framework/results.py
> +++ b/framework/results.py
> @@ -196,6 +196,7 @@ class TestResult(object):
>              'subtests': self.subtests,
>              'time': self.time,
>              'exception': self.exception,
> +            'dmesg': self.dmesg,
>          }
>          return obj
>  
> diff --git a/framework/tests/results_tests.py b/framework/tests/results_tests.py
> index 8128b38..c476174 100644
> --- a/framework/tests/results_tests.py
> +++ b/framework/tests/results_tests.py
> @@ -204,6 +204,7 @@ class TestTestResult_to_json(object):
>              },
>              'result': 'crash',
>              'exception': 'an exception',
> +            'dmesg': 'this is dmesg',
>          }
>  
>          test = results.TestResult.from_dict(cls.dict)
> @@ -242,6 +243,10 @@ class TestTestResult_to_json(object):
>          """results.TestResult.to_json: adds the __type__ hint"""
>          nt.eq_(self.json['__type__'], 'TestResult')
>  
> +    def test_dmesg(self):
> +        """results.TestResult.to_json: Adds the dmesg attribute"""
> +        nt.eq_(self.json['dmesg'], 'this is dmesg')
> +
>  
>  class TestTestResult_from_dict(object):
>      """Tests for the from_dict method."""
> @@ -259,6 +264,7 @@ class TestTestResult_from_dict(object):
>              },
>              'result': 'crash',
>              'exception': 'an exception',
> +            'dmesg': 'this is dmesg',
>          }
>  
>          cls.test = results.TestResult.from_dict(cls.dict)
> @@ -296,6 +302,10 @@ class TestTestResult_from_dict(object):
>          nt.assert_is(self.test.subtests['a'], status.PASS)
>          nt.assert_is(self.test.subtests['b'], status.FAIL)
>  
> +    def test_dmesg(self):
> +        """results.TestResult.from_dict: sets dmesg properly"""
> +        nt.eq_(self.test.dmesg, self.dict['dmesg'])
> +
>  
>  def test_TestResult_update():
>      """results.TestResult.update: result is updated"""
> -- 
> 2.6.1
> 
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the Piglit mailing list