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

Ilia Mirkin imirkin at alum.mit.edu
Fri Feb 7 19:23:01 PST 2014


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)))
 
-- 
1.8.3.2



More information about the Piglit mailing list