forked from bartvdbraak/blender
Tests: add navigation links for HTML test reports, and other tweaks
This commit is contained in:
parent
0e327968a9
commit
51c6dfd7f0
@ -104,7 +104,7 @@ def main():
|
|||||||
output_dir = args.outdir[0]
|
output_dir = args.outdir[0]
|
||||||
|
|
||||||
from modules import render_report
|
from modules import render_report
|
||||||
report = render_report.Report("Cycles Test Report", output_dir, idiff)
|
report = render_report.Report("Cycles", output_dir, idiff)
|
||||||
report.set_pixelated(True)
|
report.set_pixelated(True)
|
||||||
report.set_reference_dir("cycles_renders")
|
report.set_reference_dir("cycles_renders")
|
||||||
report.set_compare_engines('cycles', 'eevee')
|
report.set_compare_engines('cycles', 'eevee')
|
||||||
|
@ -122,7 +122,7 @@ def main():
|
|||||||
output_dir = args.outdir[0]
|
output_dir = args.outdir[0]
|
||||||
|
|
||||||
from modules import render_report
|
from modules import render_report
|
||||||
report = render_report.Report("Eevee Test Report", output_dir, idiff)
|
report = render_report.Report("Eevee", output_dir, idiff)
|
||||||
report.set_pixelated(True)
|
report.set_pixelated(True)
|
||||||
report.set_reference_dir("eevee_renders")
|
report.set_reference_dir("eevee_renders")
|
||||||
report.set_compare_engines('eevee', 'cycles')
|
report.set_compare_engines('eevee', 'cycles')
|
||||||
|
@ -32,11 +32,12 @@ def _write_html(output_dir):
|
|||||||
.failed {{ color: red; }}
|
.failed {{ color: red; }}
|
||||||
.none {{ color: #999; }}
|
.none {{ color: #999; }}
|
||||||
</style>
|
</style>
|
||||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css">
|
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<br/>
|
<br/>
|
||||||
|
<h1>{title}</h1>
|
||||||
{combined_reports}
|
{combined_reports}
|
||||||
<br/>
|
<br/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -159,6 +159,23 @@ class Report:
|
|||||||
filepath = os.path.join(outdir, "compare.data")
|
filepath = os.path.join(outdir, "compare.data")
|
||||||
pathlib.Path(filepath).write_text(self.compare_tests)
|
pathlib.Path(filepath).write_text(self.compare_tests)
|
||||||
|
|
||||||
|
def _navigation_item(self, title, href, active):
|
||||||
|
if active:
|
||||||
|
return """<li class="breadcrumb-item active" aria-current="page">%s</li>""" % title
|
||||||
|
else:
|
||||||
|
return """<li class="breadcrumb-item"><a href="%s">%s</a></li>""" % (href, title)
|
||||||
|
|
||||||
|
def _navigation_html(self, comparison):
|
||||||
|
html = """<nav aria-label="breadcrumb"><ol class="breadcrumb">"""
|
||||||
|
html += self._navigation_item("Test Reports", "../report.html", False)
|
||||||
|
html += self._navigation_item(self.title, "report.html", not comparison)
|
||||||
|
if self.compare_engines:
|
||||||
|
compare_title = "Compare with %s" % self.compare_engines[1].capitalize()
|
||||||
|
html += self._navigation_item(compare_title, "compare.html", comparison)
|
||||||
|
html += """</ol></nav>"""
|
||||||
|
|
||||||
|
return html
|
||||||
|
|
||||||
def _write_html(self, comparison=False):
|
def _write_html(self, comparison=False):
|
||||||
# Gather intermediate data for all tests.
|
# Gather intermediate data for all tests.
|
||||||
if comparison:
|
if comparison:
|
||||||
@ -186,17 +203,25 @@ class Report:
|
|||||||
else:
|
else:
|
||||||
image_rendering = 'auto'
|
image_rendering = 'auto'
|
||||||
|
|
||||||
|
# Navigation
|
||||||
|
menu = self._navigation_html(comparison)
|
||||||
|
|
||||||
failed = len(failed_tests) > 0
|
failed = len(failed_tests) > 0
|
||||||
if failed:
|
if failed:
|
||||||
message = "<p>Run <tt>BLENDER_TEST_UPDATE=1 ctest</tt> to create or update reference images for failed tests.</p>"
|
message = """<div class="alert alert-danger" role="alert">"""
|
||||||
|
message += """Run this command to update reference images for failed tests, or create images for new tests:<br>"""
|
||||||
|
message += """<tt>BLENDER_TEST_UPDATE=1 ctest -R %s</tt>""" % self.title.lower()
|
||||||
|
message += """</div>"""
|
||||||
else:
|
else:
|
||||||
message = ""
|
message = ""
|
||||||
|
|
||||||
if comparison:
|
if comparison:
|
||||||
title = "Render Test Compare"
|
title = self.title + " Test Compare"
|
||||||
columns_html = "<tr><th>Name</th><th>%s</th><th>%s</th>" % self.compare_engines
|
engine_self = self.compare_engines[0].capitalize()
|
||||||
|
engine_other = self.compare_engines[1].capitalize()
|
||||||
|
columns_html = "<tr><th>Name</th><th>%s</th><th>%s</th>" % (engine_self, engine_other)
|
||||||
else:
|
else:
|
||||||
title = self.title
|
title = self.title + " Test Report"
|
||||||
columns_html = "<tr><th>Name</th><th>New</th><th>Reference</th><th>Diff</th>"
|
columns_html = "<tr><th>Name</th><th>New</th><th>Reference</th><th>Diff</th>"
|
||||||
|
|
||||||
html = """
|
html = """
|
||||||
@ -226,16 +251,16 @@ class Report:
|
|||||||
}}
|
}}
|
||||||
table td:first-child {{ width: 256px; }}
|
table td:first-child {{ width: 256px; }}
|
||||||
</style>
|
</style>
|
||||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css">
|
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<br/>
|
<br/>
|
||||||
<h1>{title}</h1>
|
<h1>{title}</h1>
|
||||||
|
{menu}
|
||||||
{message}
|
{message}
|
||||||
<br/>
|
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead class="thead-default">
|
<thead class="thead-dark">
|
||||||
{columns_html}
|
{columns_html}
|
||||||
</thead>
|
</thead>
|
||||||
{tests_html}
|
{tests_html}
|
||||||
@ -245,6 +270,7 @@ class Report:
|
|||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
""" . format(title=title,
|
""" . format(title=title,
|
||||||
|
menu=menu,
|
||||||
message=message,
|
message=message,
|
||||||
image_rendering=image_rendering,
|
image_rendering=image_rendering,
|
||||||
tests_html=tests_html,
|
tests_html=tests_html,
|
||||||
@ -256,12 +282,11 @@ class Report:
|
|||||||
|
|
||||||
print_message("Report saved to: " + pathlib.Path(filepath).as_uri())
|
print_message("Report saved to: " + pathlib.Path(filepath).as_uri())
|
||||||
|
|
||||||
|
|
||||||
# Update global report
|
# Update global report
|
||||||
link_name = "Renders" if not comparison else "Comparison"
|
if not comparison:
|
||||||
global_output_dir = os.path.dirname(self.output_dir)
|
global_output_dir = os.path.dirname(self.output_dir)
|
||||||
global_failed = failed if not comparison else None
|
global_failed = failed if not comparison else None
|
||||||
global_report.add(global_output_dir, self.title, link_name, filepath, global_failed)
|
global_report.add(global_output_dir, "Render", self.title, filepath, global_failed)
|
||||||
|
|
||||||
def _relative_url(self, filepath):
|
def _relative_url(self, filepath):
|
||||||
relpath = os.path.relpath(filepath, self.output_dir)
|
relpath = os.path.relpath(filepath, self.output_dir)
|
||||||
@ -274,7 +299,7 @@ class Report:
|
|||||||
old_img, ref_img, new_img, diff_img = test_get_images(self.output_dir, filepath, self.reference_dir)
|
old_img, ref_img, new_img, diff_img = test_get_images(self.output_dir, filepath, self.reference_dir)
|
||||||
|
|
||||||
status = error if error else ""
|
status = error if error else ""
|
||||||
tr_style = """ style="background-color: #f99;" """ if error else ""
|
tr_style = """ class="table-danger" """ if error else ""
|
||||||
|
|
||||||
new_url = self._relative_url(new_img)
|
new_url = self._relative_url(new_img)
|
||||||
ref_url = self._relative_url(ref_img)
|
ref_url = self._relative_url(ref_img)
|
||||||
|
@ -91,7 +91,7 @@ def main():
|
|||||||
output_dir = args.outdir[0]
|
output_dir = args.outdir[0]
|
||||||
|
|
||||||
from modules import render_report
|
from modules import render_report
|
||||||
report = render_report.Report("OpenGL Draw Test Report", output_dir, idiff)
|
report = render_report.Report("OpenGL Draw", output_dir, idiff)
|
||||||
ok = report.run(test_dir, render_file)
|
ok = report.run(test_dir, render_file)
|
||||||
|
|
||||||
sys.exit(not ok)
|
sys.exit(not ok)
|
||||||
|
@ -109,7 +109,7 @@ def main():
|
|||||||
output_dir = args.outdir[0]
|
output_dir = args.outdir[0]
|
||||||
|
|
||||||
from modules import render_report
|
from modules import render_report
|
||||||
report = render_report.Report("Workbench Test Report", output_dir, idiff)
|
report = render_report.Report("Workbench", output_dir, idiff)
|
||||||
report.set_pixelated(True)
|
report.set_pixelated(True)
|
||||||
report.set_reference_dir("workbench_renders")
|
report.set_reference_dir("workbench_renders")
|
||||||
report.set_compare_engines('workbench', 'eevee')
|
report.set_compare_engines('workbench', 'eevee')
|
||||||
|
Loading…
Reference in New Issue
Block a user