RenderTests: Fix Incorrect Command in Report

When running the render test for EEVEE-Next the command printed on
the report to update the reference images was incorrect. In stead of
displaying
`BLENDER_TEST_UPDATE=1 ctest -R eevee_next` it displayed
`BLENDER_TEST_UPDATE=1 ctest -R eevee next`.

The cause of this is that the title of the report is used to create
the command. EEVEE-Next has a space in its title which generates
an incorrect command.

A quick fix would be to replace spaces with underscores. But it would
be better to fix this more clearly by adding an attribute containing the
engine name.

This PR adds a `set_engine_name` method to the Report class. By
default the engine name is set based on the title.

Pull Request: https://projects.blender.org/blender/blender/pulls/117503
This commit is contained in:
Jeroen Bakker
2024-01-25 18:55:28 +01:00
parent 5c4779f872
commit 49d07653f9
2 changed files with 7 additions and 1 deletions

View File

@@ -76,6 +76,7 @@ def test_get_images(output_dir, filepath, reference_dir, reference_override_dir)
class Report:
__slots__ = (
'title',
'engine_name',
'output_dir',
'global_dir',
'reference_dir',
@@ -104,6 +105,7 @@ class Report:
self.compare_engine = None
self.fail_threshold = 0.016
self.fail_percent = 1
self.engine_name = self.title.lower().replace(" ", "_")
self.device = device
self.blacklist = blacklist
@@ -142,6 +144,9 @@ class Report:
def set_compare_engine(self, other_engine, other_device=None):
self.compare_engine = (other_engine, other_device)
def set_engine_name(self, engine_name):
self.engine_name = engine_name
def run(self, dirpath, blender, arguments_cb, batch=False):
# Run tests and output report.
dirname = os.path.basename(dirpath)
@@ -232,7 +237,7 @@ class Report:
if failed:
message = """<div class="alert alert-danger" role="alert">"""
message += """<p>Run this command to regenerate reference (ground truth) images:</p>"""
message += """<p><tt>BLENDER_TEST_UPDATE=1 ctest -R %s</tt></p>""" % self.title.lower()
message += """<p><tt>BLENDER_TEST_UPDATE=1 ctest -R %s</tt></p>""" % self.engine_name
message += """<p>This then happens for new and failing tests; reference images of """ \
"""passing test cases will not be updated. Be sure to commit the new reference """ \
"""images to the SVN repository afterwards.</p>"""