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

Thomas Wood thomas.wood at intel.com
Tue Feb 25 09:30:02 PST 2014


v2: fix some small style issues (Dylan Baker)

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

diff --git a/framework/summary.py b/framework/summary.py
index 2fc16ce..b5539b8 100644
--- a/framework/summary.py
+++ b/framework/summary.py
@@ -25,6 +25,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
@@ -379,7 +380,7 @@ class Summary:
 
             with open(path.join(destination, each.name, "index.html"), 'w') as out:
                 out.write(testindex.render(name=each.name,
-                                           time=each.time_elapsed,
+                                           time=str(timedelta(0, each.time_elapsed)),
                                            options=each.options,
                                            glxinfo=each.glxinfo,
                                            lspci=each.lspci))
@@ -401,6 +402,7 @@ class Summary:
 
                     with open(path.join(destination, each.name, key + ".html"),
                               'w') as out:
+                        time = value.get('time', 'None')
                         out.write(testfile.render(
                             testname=key,
                             status=value.get('result', 'None'),
@@ -410,7 +412,7 @@ class Summary:
                             # disapear at somepoint
                             env=value.get('environment', None),
                             returncode=value.get('returncode', 'None'),
-                            time=value.get('time', 'None'),
+                            time=time if time == 'None' else str(timedelta(0, time)),
                             info=value.get('info', 'None'),
                             traceback=value.get('traceback', 'None'),
                             command=value.get('command', 'None'),
-- 
1.8.5.3



More information about the Piglit mailing list