Tests: Disable --cycles-device arguments on non-Cycles tests

This commit reworks the RenderReport base class to avoid adding
`--cycles-device` device arguments to non Cycles tests.

This reduces some warnings that can show up with EEVEE and
Workbench tests that accidentally used these arguments.

Pull Request: https://projects.blender.org/blender/blender/pulls/133724
This commit is contained in:
Alaska
2025-01-30 04:15:27 +01:00
committed by Alaska
parent d62c143ab7
commit ea7d07098b
4 changed files with 38 additions and 30 deletions

View File

@@ -135,10 +135,10 @@ class CyclesReport(render_report.Report):
def __init__(self, title, output_dir, oiiotool, device=None, blocklist=[], osl=False):
# Split device name in format "<device_type>[-<RT>]" into individual
# tokens, setting the RT suffix to an empty string if its not specified.
device, suffix = (device.split("-") + [""])[:2]
self.device, suffix = (device.split("-") + [""])[:2]
self.use_hwrt = (suffix == "RT")
super().__init__(title, output_dir, oiiotool, device, blocklist)
super().__init__(title, output_dir, oiiotool, self.device, blocklist)
if self.use_hwrt:
self.title = self.title + " RT"
@@ -151,6 +151,9 @@ class CyclesReport(render_report.Report):
def _get_render_arguments(self, arguments_cb, filepath, base_output_filepath):
return arguments_cb(filepath, base_output_filepath, self.use_hwrt, self.osl)
def _get_arguments_suffix(self):
return ['--', '--cycles-device', self.device] if self.device else []
def get_arguments(filepath, output_filepath, use_hwrt=False, osl=False):
dirname = os.path.dirname(filepath)

View File

@@ -14,12 +14,12 @@ try:
from modules import render_report
class EEVEEReport(render_report.Report):
def __init__(self, title, output_dir, oiiotool, device=None, blocklist=[]):
super().__init__(title, output_dir, oiiotool, device=device, blocklist=blocklist)
self.gpu_backend = device
def __init__(self, title, output_dir, oiiotool, variation=None, blocklist=[]):
super().__init__(title, output_dir, oiiotool, variation=variation, blocklist=blocklist)
self.gpu_backend = variation
def _get_render_arguments(self, arguments_cb, filepath, base_output_filepath):
return arguments_cb(filepath, base_output_filepath, gpu_backend=self.device)
return arguments_cb(filepath, base_output_filepath, gpu_backend=self.gpu_backend)
except ImportError:
# render_report can only be loaded when running the render tests. It errors when
@@ -229,7 +229,7 @@ def main():
if args.gpu_backend == "metal":
blocklist += BLOCKLIST_METAL
report = EEVEEReport("Eevee Next", args.outdir, args.oiiotool, device=args.gpu_backend, blocklist=blocklist)
report = EEVEEReport("Eevee Next", args.outdir, args.oiiotool, variation=args.gpu_backend, blocklist=blocklist)
if args.gpu_backend == "vulkan":
report.set_compare_engine('eevee_next', 'opengl')
else:

View File

@@ -18,7 +18,7 @@ from . import global_report
from .colored_print import (print_message, use_message_colors)
def blend_list(dirpath, device, blocklist):
def blend_list(dirpath, blocklist):
import re
for root, dirs, files in os.walk(dirpath):
@@ -91,11 +91,10 @@ class Report:
'passed_tests',
'compare_tests',
'compare_engine',
'device',
'blocklist',
)
def __init__(self, title, output_dir, oiiotool, device=None, blocklist=[]):
def __init__(self, title, output_dir, oiiotool, variation=None, blocklist=[]):
self.title = title
self.output_dir = output_dir
self.global_dir = os.path.dirname(output_dir)
@@ -106,12 +105,11 @@ class Report:
self.fail_threshold = 0.016
self.fail_percent = 1
self.engine_name = self.title.lower().replace(" ", "_")
self.device = device
self.blocklist = [] if os.getenv('BLENDER_TEST_IGNORE_BLOCKLIST') is not None else blocklist
if device:
self.title = self._engine_title(title, device)
self.output_dir = self._engine_path(self.output_dir, device.lower())
if variation:
self.title = self._engine_title(title, variation)
self.output_dir = self._engine_path(self.output_dir, variation.lower())
self.pixelated = False
self.verbose = os.environ.get("BLENDER_VERBOSE") is not None
@@ -141,8 +139,8 @@ class Report:
def set_reference_override_dir(self, reference_override_dir):
self.reference_override_dir = reference_override_dir
def set_compare_engine(self, other_engine, other_device=None):
self.compare_engine = (other_engine, other_device)
def set_compare_engine(self, other_engine, other_variation=None):
self.compare_engine = (other_engine, other_variation)
def set_engine_name(self, engine_name):
self.engine_name = engine_name
@@ -178,15 +176,15 @@ class Report:
else:
return """<li class="breadcrumb-item"><a href="%s">%s</a></li>""" % (href, title)
def _engine_title(self, engine, device):
if device:
return engine.title() + ' ' + device
def _engine_title(self, engine, variation):
if variation:
return engine.title() + ' ' + variation
else:
return engine.title()
def _engine_path(self, path, device):
if device:
return os.path.join(path, device.lower())
def _engine_path(self, path, variation):
if variation:
return os.path.join(path, variation.lower())
else:
return path
@@ -464,6 +462,14 @@ class Report:
# Do not delete.
return arguments_cb(filepath, base_output_filepath)
def _get_arguments_suffix(self):
# Get command line arguments that need to be provided after all file-specific ones.
# For example the Cycles render device argument needs to be added at the end of
# the argument list, otherwise tests can't be batched together.
#
# Each render test is supposed to override this method.
return []
def _run_tests(self, filepaths, blender, arguments_cb, batch):
# Run multiple tests in a single Blender process since startup can be
# a significant factor. In case of crashes, re-run the remaining tests.
@@ -494,8 +500,7 @@ class Report:
if not batch:
break
if self.device:
command.extend(['--', '--cycles-device', self.device])
command.extend(self._get_arguments_suffix())
# Run process
crash = False
@@ -548,7 +553,7 @@ class Report:
passed_tests = []
failed_tests = []
silently_failed_tests = []
all_files = list(blend_list(dirpath, self.device, self.blocklist))
all_files = list(blend_list(dirpath, self.blocklist))
all_files.sort()
if not list(blend_list(dirpath, self.device, [])):
print_message("No .blend files found in '{}'!".format(dirpath), 'FAILURE', 'FAILED')

View File

@@ -13,12 +13,12 @@ try:
from modules import render_report
class WorkbenchReport(render_report.Report):
def __init__(self, title, output_dir, oiiotool, device=None, blocklist=[]):
super().__init__(title, output_dir, oiiotool, device=device, blocklist=blocklist)
self.gpu_backend = device
def __init__(self, title, output_dir, oiiotool, variation=None, blocklist=[]):
super().__init__(title, output_dir, oiiotool, variation=variation, blocklist=blocklist)
self.gpu_backend = variation
def _get_render_arguments(self, arguments_cb, filepath, base_output_filepath):
return arguments_cb(filepath, base_output_filepath, gpu_backend=self.device)
return arguments_cb(filepath, base_output_filepath, gpu_backend=self.gpu_backend)
except ImportError:
# render_report can only be loaded when running the render tests. It errors when
@@ -91,7 +91,7 @@ def main():
parser = create_argparse()
args = parser.parse_args()
report = WorkbenchReport("Workbench", args.outdir, args.oiiotool, device=args.gpu_backend)
report = WorkbenchReport("Workbench", args.outdir, args.oiiotool, variation=args.gpu_backend)
if args.gpu_backend == "vulkan":
report.set_compare_engine('workbench', 'opengl')
else: