[Piglit] [PATCH 1/3] framework/html: guard against errors writing individual test results
Dylan Baker
dylan at pnwbakers.com
Wed May 30 20:14:49 UTC 2018
Reviewed-by: Dylan Baker <dylan at pnwbakers.com>
Quoting Marek Olšák (2018-05-30 13:04:46)
> From: Nicolai Hähnle <nicolai.haehnle at amd.com>
>
> v2: check ENAMETOOLONG
> ---
> framework/summary/html_.py | 21 ++++++++++++++-------
> 1 file changed, 14 insertions(+), 7 deletions(-)
>
> diff --git a/framework/summary/html_.py b/framework/summary/html_.py
> index f7fdc8576..14dd76fa8 100644
> --- a/framework/summary/html_.py
> +++ b/framework/summary/html_.py
> @@ -24,20 +24,21 @@
>
> from __future__ import (
> absolute_import, division, print_function, unicode_literals
> )
> import errno
> import getpass
> import os
> import shutil
> import sys
> import tempfile
> +import traceback
>
> import mako
> from mako.lookup import TemplateLookup
> import six
>
> # a local variable status exists, prevent accidental overloading by renaming
> # the module
> from framework import backends, exceptions, core
>
> from .common import Results, escape_filename, escape_pathname
> @@ -106,27 +107,33 @@ def _make_testrun_info(results, destination, exclude=None):
>
> # Then build the individual test results
> for key, value in six.iteritems(each.tests):
> html_path = os.path.join(destination, name,
> escape_filename(key + ".html"))
> temp_path = os.path.dirname(html_path)
>
> if value.result not in exclude:
> core.check_dir(temp_path)
>
> - with open(html_path, 'wb') as out:
> - out.write(_TEMPLATES.get_template(
> - 'test_result.mako').render(
> - testname=key,
> - value=value,
> - css=os.path.relpath(result_css, temp_path),
> - index=os.path.relpath(index, temp_path)))
> + try:
> + with open(html_path, 'wb') as out:
> + out.write(_TEMPLATES.get_template(
> + 'test_result.mako').render(
> + testname=key,
> + value=value,
> + css=os.path.relpath(result_css, temp_path),
> + index=os.path.relpath(index, temp_path)))
> + except OSError as e:
> + if e.errno == errno.ENAMETOOLONG:
> + print('WARN: filename "{}" too long'.format(html_name))
> + else:
> + raise
>
>
> def _make_comparison_pages(results, destination, exclude):
> """Create the pages of comparisons."""
> pages = frozenset(['changes', 'problems', 'skips', 'fixes',
> 'regressions', 'enabled', 'disabled'])
>
> # Index.html is a bit of a special case since there is index, all, and
> # alltests, where the other pages all use the same name. ie,
> # changes.html, changes, and page=changes.
> --
> 2.17.0
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: signature
URL: <https://lists.freedesktop.org/archives/piglit/attachments/20180530/b464d2ce/attachment.sig>
More information about the Piglit
mailing list