Commit 248a7787 authored by Nicolai Hähnle's avatar Nicolai Hähnle Committed by Marek Olšák

framework/html: guard against errors writing individual test results

v2: check ENAMETOOLONG
Reviewed-by: Dylan Baker's avatarDylan Baker <dylan@pnwbakers.com>
parent d54e84c2
......@@ -31,6 +31,7 @@ import os
import shutil
import sys
import tempfile
import traceback
import mako
from mako.lookup import TemplateLookup
......@@ -113,13 +114,19 @@ def _make_testrun_info(results, destination, exclude=None):
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):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment