[Piglit] [PATCH] framework: use formatted time values in the HTML report

Thomas Wood thomas.wood at intel.com
Mon Apr 28 03:56:52 PDT 2014


v2: update for the changes to the test result template and check for None
    in the summary index time value

Signed-off-by: Thomas Wood <thomas.wood at intel.com>
---
 framework/summary.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/framework/summary.py b/framework/summary.py
index 9228330..62e543f 100644
--- a/framework/summary.py
+++ b/framework/summary.py
@@ -26,6 +26,7 @@ import itertools
 import shutil
 import collections
 import tempfile
+from datetime import timedelta
 from mako.template import Template
 
 # a local variable status exists, prevent accidental overloading by renaming
@@ -383,9 +384,11 @@ class Summary:
         for each in self.results:
             os.mkdir(path.join(destination, each.name))
 
+            time = str(timedelta(0, each.time_elapsed)) if each.time_elapsed is not None else None
+
             with open(path.join(destination, each.name, "index.html"), 'w') as out:
                 out.write(testindex.render(name=each.name,
-                                           time=each.time_elapsed,
+                                           time=time,
                                            options=each.options,
                                            uname=each.uname,
                                            glxinfo=each.glxinfo,
@@ -405,6 +408,8 @@ class Summary:
                     if isinstance(value.get('dmesg'), list):
                         value['dmesg'] = "\n".join(value['dmesg'])
 
+                    value['time'] = str(timedelta(0, value.get('time'))) if value.get('time') is not None else None
+
                     with open(path.join(destination, each.name, key + ".html"),
                               'w') as out:
                         out.write(testfile.render(
-- 
1.9.0



More information about the Piglit mailing list