[Piglit] [PATCH] framework: use formatted time values in the HTML report
Ken Phillis Jr
kphillisjr at gmail.com
Tue Feb 25 16:50:21 PST 2014
On Tue, Feb 25, 2014 at 11:30 AM, Thomas Wood <thomas.wood at intel.com> wrote:
> 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')
In this area I believe that it should be possible to determine if the
value should be "None" or whatever the timedelta returns.
> 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)),
I believe this line here can simply be left as time=time.
> info=value.get('info', 'None'),
> traceback=value.get('traceback', 'None'),
> command=value.get('command', 'None'),
More information about the Piglit
mailing list