[Piglit] [PATCH] framework: dmesg is expected to be a string, not a list of values

Dylan Baker baker.dylan.c at gmail.com
Sun Feb 9 23:37:17 PST 2014


On Friday, February 07, 2014 10:23:01 PM Ilia Mirkin wrote:
> Since there are now also summary results in the wild with the list in
> their json, handle them correctly as well instead of printing out a
> stringified array.
> 
> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
> ---
>  framework/dmesg.py   | 2 +-
>  framework/summary.py | 6 +++++-
>  2 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/framework/dmesg.py b/framework/dmesg.py
> index feb05ad..3af8496 100644
> --- a/framework/dmesg.py
> +++ b/framework/dmesg.py
> @@ -109,7 +109,7 @@ class LinuxDmesg(object):
>                      result['subtest'][key] = replace(value)
> 
>              # Add the dmesg values to the result
> -            result['dmesg'] = self._new_messages
> +            result['dmesg'] = "\n".join(self._new_messages)
> 
>          return result
> 
> diff --git a/framework/summary.py b/framework/summary.py
> index 874b104..2fc16ce 100644
> --- a/framework/summary.py
> +++ b/framework/summary.py
> @@ -395,6 +395,10 @@ class Summary:
>                      if not path.exists(temp_path):
>                          os.makedirs(temp_path)
> 
> +                    dmesg = value.get('dmesg', 'None')
> +                    if isinstance(dmesg, list):
> +                        dmesg = "\n".join(dmesg)
> +
>                      with open(path.join(destination, each.name, key +
> ".html"), 'w') as out:
>                          out.write(testfile.render(
> @@ -410,7 +414,7 @@ class Summary:
>                              info=value.get('info', 'None'),
>                              traceback=value.get('traceback', 'None'),
>                              command=value.get('command', 'None'),
> -                            dmesg=value.get('dmesg', 'None'),
> +                            dmesg=dmesg,
>                              css=path.relpath(result_css, temp_path),
>                              index=path.relpath(index, temp_path)))

Grr, I really despise json.

Reviewed-by: Dylan Baker <baker.dylan.c at gmail.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20140209/cc610519/attachment.pgp>


More information about the Piglit mailing list