Cleanup: Remove unused and outdated render test files
Pull Request: https://projects.blender.org/blender/blender/pulls/143438
This commit is contained in:
committed by
Brecht Van Lommel
parent
7158e02aed
commit
24a7c42766
@@ -1,35 +0,0 @@
|
||||
Auto Render Regression suite
|
||||
==================================
|
||||
|
||||
Running
|
||||
==================================
|
||||
|
||||
./blender -b -P /path/to/tests/auto/render_test_files.py
|
||||
|
||||
If desired the blender executable path can be set in test_config.py to
|
||||
run the script outside of Blender with:
|
||||
|
||||
python render_test_files.py
|
||||
|
||||
Results
|
||||
==================================
|
||||
|
||||
It saves all renders and additional info into tests/auto/test_renders
|
||||
The reference renders are in tests/auto/reference_renders
|
||||
|
||||
Comparisons
|
||||
==================================
|
||||
|
||||
Manual comparison is possible, easier is to use automatic comparsion with
|
||||
OpenImageIO installed. If it's in PATH then it will be found automatically,
|
||||
otherwise the path can be set in test_config.py.
|
||||
|
||||
For comparing two Blender versions, you can run the tests with old version,
|
||||
copy the .png files from test_renders to reference_renders and then run the
|
||||
tests with the newer version.
|
||||
|
||||
Notes
|
||||
==================================
|
||||
|
||||
* test_run.py is executed for each .blend file.
|
||||
* The script renders every cycles file twice on the CPU (SVM and OSL).
|
||||
BIN
tests/files/auto/reference_renders/bmps_osl.png
(Stored with Git LFS)
BIN
tests/files/auto/reference_renders/bmps_osl.png
(Stored with Git LFS)
Binary file not shown.
BIN
tests/files/auto/reference_renders/bmps_svm.png
(Stored with Git LFS)
BIN
tests/files/auto/reference_renders/bmps_svm.png
(Stored with Git LFS)
Binary file not shown.
BIN
tests/files/auto/reference_renders/bmw_osl.png
(Stored with Git LFS)
BIN
tests/files/auto/reference_renders/bmw_osl.png
(Stored with Git LFS)
Binary file not shown.
BIN
tests/files/auto/reference_renders/bmw_svm.png
(Stored with Git LFS)
BIN
tests/files/auto/reference_renders/bmw_svm.png
(Stored with Git LFS)
Binary file not shown.
BIN
tests/files/auto/reference_renders/closures_osl.png
(Stored with Git LFS)
BIN
tests/files/auto/reference_renders/closures_osl.png
(Stored with Git LFS)
Binary file not shown.
BIN
tests/files/auto/reference_renders/closures_svm.png
(Stored with Git LFS)
BIN
tests/files/auto/reference_renders/closures_svm.png
(Stored with Git LFS)
Binary file not shown.
BIN
tests/files/auto/reference_renders/color_ramp_osl.png
(Stored with Git LFS)
BIN
tests/files/auto/reference_renders/color_ramp_osl.png
(Stored with Git LFS)
Binary file not shown.
BIN
tests/files/auto/reference_renders/color_ramp_svm.png
(Stored with Git LFS)
BIN
tests/files/auto/reference_renders/color_ramp_svm.png
(Stored with Git LFS)
Binary file not shown.
BIN
tests/files/auto/reference_renders/cornell_box_osl.png
(Stored with Git LFS)
BIN
tests/files/auto/reference_renders/cornell_box_osl.png
(Stored with Git LFS)
Binary file not shown.
BIN
tests/files/auto/reference_renders/cornell_box_svm.png
(Stored with Git LFS)
BIN
tests/files/auto/reference_renders/cornell_box_svm.png
(Stored with Git LFS)
Binary file not shown.
BIN
tests/files/auto/reference_renders/hair_osl.png
(Stored with Git LFS)
BIN
tests/files/auto/reference_renders/hair_osl.png
(Stored with Git LFS)
Binary file not shown.
BIN
tests/files/auto/reference_renders/hair_svm.png
(Stored with Git LFS)
BIN
tests/files/auto/reference_renders/hair_svm.png
(Stored with Git LFS)
Binary file not shown.
BIN
tests/files/auto/reference_renders/images_osl.png
(Stored with Git LFS)
BIN
tests/files/auto/reference_renders/images_osl.png
(Stored with Git LFS)
Binary file not shown.
BIN
tests/files/auto/reference_renders/images_svm.png
(Stored with Git LFS)
BIN
tests/files/auto/reference_renders/images_svm.png
(Stored with Git LFS)
Binary file not shown.
@@ -1,2 +0,0 @@
|
||||
These reference images have been renderd with:
|
||||
SVN 55063 on Mac OS X 10.8
|
||||
BIN
tests/files/auto/reference_renders/lamps_osl.png
(Stored with Git LFS)
BIN
tests/files/auto/reference_renders/lamps_osl.png
(Stored with Git LFS)
Binary file not shown.
BIN
tests/files/auto/reference_renders/lamps_svm.png
(Stored with Git LFS)
BIN
tests/files/auto/reference_renders/lamps_svm.png
(Stored with Git LFS)
Binary file not shown.
BIN
tests/files/auto/reference_renders/motion_blur_osl.png
(Stored with Git LFS)
BIN
tests/files/auto/reference_renders/motion_blur_osl.png
(Stored with Git LFS)
Binary file not shown.
BIN
tests/files/auto/reference_renders/motion_blur_svm.png
(Stored with Git LFS)
BIN
tests/files/auto/reference_renders/motion_blur_svm.png
(Stored with Git LFS)
Binary file not shown.
BIN
tests/files/auto/reference_renders/object_info_node_osl.png
(Stored with Git LFS)
BIN
tests/files/auto/reference_renders/object_info_node_osl.png
(Stored with Git LFS)
Binary file not shown.
BIN
tests/files/auto/reference_renders/object_info_node_svm.png
(Stored with Git LFS)
BIN
tests/files/auto/reference_renders/object_info_node_svm.png
(Stored with Git LFS)
Binary file not shown.
BIN
tests/files/auto/reference_renders/osl_osl.png
(Stored with Git LFS)
BIN
tests/files/auto/reference_renders/osl_osl.png
(Stored with Git LFS)
Binary file not shown.
BIN
tests/files/auto/reference_renders/osl_svm.png
(Stored with Git LFS)
BIN
tests/files/auto/reference_renders/osl_svm.png
(Stored with Git LFS)
Binary file not shown.
BIN
tests/files/auto/reference_renders/procedural_textures_osl.png
(Stored with Git LFS)
BIN
tests/files/auto/reference_renders/procedural_textures_osl.png
(Stored with Git LFS)
Binary file not shown.
BIN
tests/files/auto/reference_renders/procedural_textures_svm.png
(Stored with Git LFS)
BIN
tests/files/auto/reference_renders/procedural_textures_svm.png
(Stored with Git LFS)
Binary file not shown.
BIN
tests/files/auto/reference_renders/render_passes_osl.png
(Stored with Git LFS)
BIN
tests/files/auto/reference_renders/render_passes_osl.png
(Stored with Git LFS)
Binary file not shown.
BIN
tests/files/auto/reference_renders/render_passes_svm.png
(Stored with Git LFS)
BIN
tests/files/auto/reference_renders/render_passes_svm.png
(Stored with Git LFS)
Binary file not shown.
@@ -1,188 +0,0 @@
|
||||
# SPDX-FileCopyrightText: 2024 Blender Authors
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
# Run auto regression files
|
||||
import os
|
||||
import select
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
# Find executables and files
|
||||
def find_test_directory():
|
||||
test_directory = ""
|
||||
|
||||
if "__file__" in globals():
|
||||
test_directory = os.path.dirname(__file__)
|
||||
sys.path.append(test_directory)
|
||||
|
||||
return test_directory
|
||||
|
||||
|
||||
def find_idiff(idiff_path):
|
||||
if not idiff_path:
|
||||
if shutil.which("idiff"):
|
||||
idiff_path = "idiff"
|
||||
|
||||
return idiff_path
|
||||
|
||||
|
||||
def find_blender(blender_executable):
|
||||
if not blender_executable:
|
||||
if os.path.split(sys.executable)[1] == "blender":
|
||||
blender_executable = sys.executable
|
||||
print("")
|
||||
|
||||
return blender_executable
|
||||
|
||||
|
||||
def find_test_files(directory, search_items, extension):
|
||||
files = []
|
||||
|
||||
for item in search_items:
|
||||
item_path = os.path.join(directory, item)
|
||||
|
||||
if os.path.isdir(item_path):
|
||||
# find all .blend files in directory
|
||||
for filename in os.listdir(item_path):
|
||||
name, ext = os.path.splitext(filename)
|
||||
if ext == extension:
|
||||
files += [(name, os.path.join(item, filename))]
|
||||
else:
|
||||
# single .blend
|
||||
name = os.path.splitext(os.path.basename(item))[0]
|
||||
files += [(name, item)]
|
||||
|
||||
return files
|
||||
|
||||
|
||||
def render_variations(blend_file):
|
||||
if blend_file.find("cycles") == -1:
|
||||
return ("",)
|
||||
else:
|
||||
return ("_svm", "_osl")
|
||||
|
||||
|
||||
# Execute command while printing and logging it
|
||||
def execute_command(command, logfile):
|
||||
logdir = os.path.dirname(logfile)
|
||||
if not os.path.exists(logdir):
|
||||
os.makedirs(logdir)
|
||||
|
||||
log = open(str(logfile), "w")
|
||||
log.write(command + "\n\n")
|
||||
|
||||
p = subprocess.Popen(command.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
|
||||
maxlen = 10
|
||||
columns = shutil.get_terminal_size().columns
|
||||
|
||||
while True:
|
||||
reads = [p.stdout.fileno(), p.stderr.fileno()]
|
||||
ret = select.select(reads, [], [])
|
||||
|
||||
for fd in ret[0]:
|
||||
for std in (p.stdout, p.stderr):
|
||||
if fd == std.fileno():
|
||||
read = std.readline().decode('utf8').rstrip()
|
||||
log.write(read + "\n")
|
||||
|
||||
# get last part, and no multiline because it breaks \r
|
||||
read = read.split('|')[-1].strip()
|
||||
if len(read) > columns:
|
||||
read = read[:columns]
|
||||
|
||||
maxlen = max(len(read), maxlen)
|
||||
sys.stdout.write("\r" + read + (maxlen - len(read)) * " " + "\r")
|
||||
|
||||
if p.poll() is not None:
|
||||
break
|
||||
|
||||
log.close()
|
||||
sys.stdout.write("\r" + maxlen * " \r")
|
||||
|
||||
return p.returncode
|
||||
|
||||
|
||||
def failure_color(message):
|
||||
return '\033[91m' + message + '\033[0m'
|
||||
|
||||
|
||||
def ok_color(message):
|
||||
return '\033[92m' + message + '\033[0m'
|
||||
|
||||
|
||||
def bold_color(message):
|
||||
return '\033[1m' + message + '\033[0m'
|
||||
|
||||
|
||||
# Setup paths
|
||||
test_directory = find_test_directory()
|
||||
|
||||
import test_config
|
||||
|
||||
idiff_path = find_idiff(test_config.idiff_path)
|
||||
blender_executable = find_blender(test_config.blender_executable)
|
||||
blend_files = find_test_files(test_directory, test_config.files, ".blend")
|
||||
|
||||
# Run tests
|
||||
for blend_name, blend_file in blend_files:
|
||||
# Remove previous output
|
||||
def clear_file(blend_name, blend_file):
|
||||
for variation in render_variations(blend_file):
|
||||
extension = variation + ".png"
|
||||
diff_log = os.path.join(test_directory, "test_renders", blend_name + ".diff")
|
||||
test_image = os.path.join(test_directory, "test_renders", blend_name + extension)
|
||||
|
||||
if os.path.exists(diff_log):
|
||||
os.remove(diff_log)
|
||||
if os.path.exists(test_image):
|
||||
os.remove(test_image)
|
||||
|
||||
# Render
|
||||
def render_file(blend_name, blend_file):
|
||||
test_script = os.path.join(test_directory, "test_run.py")
|
||||
blend_path = os.path.join(test_directory, blend_file)
|
||||
blend_log = os.path.join(test_directory, "test_renders", blend_name + ".log")
|
||||
|
||||
command = '%s -b %s -P %s' % (blender_executable, blend_path, test_script)
|
||||
print("Rendering " + bold_color(blend_file))
|
||||
if execute_command(command, blend_log) != 0:
|
||||
print(failure_color("Render Failed"))
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
# Compare
|
||||
def compare_file(blend_name, blend_file):
|
||||
for variation in render_variations(blend_file):
|
||||
extension = variation + ".png"
|
||||
diff_log = os.path.join(test_directory, "test_renders", blend_name + ".diff")
|
||||
reference_image = os.path.join(test_directory, "reference_renders", blend_name + extension)
|
||||
test_image = os.path.join(test_directory, "test_renders", blend_name + extension)
|
||||
|
||||
if not os.path.isfile(test_image):
|
||||
print(failure_color("Output image missing"))
|
||||
return False
|
||||
if idiff_path and not os.path.isfile(reference_image):
|
||||
print(ok_color("Render OK"))
|
||||
return True
|
||||
|
||||
if idiff_path:
|
||||
command = '%s -fail %f -failpercent %f %s %s' % (idiff_path, 0.02, 2, reference_image, test_image)
|
||||
if execute_command(command, diff_log) not in (0, 1):
|
||||
print(failure_color("Image does not match reference"))
|
||||
return False
|
||||
else:
|
||||
print(ok_color("Render OK"))
|
||||
return True
|
||||
|
||||
print(ok_color("Render + Compare OK"))
|
||||
return True
|
||||
|
||||
clear_file(blend_name, blend_file)
|
||||
|
||||
if render_file(blend_name, blend_file):
|
||||
compare_file(blend_name, blend_file)
|
||||
@@ -1,29 +0,0 @@
|
||||
# SPDX-FileCopyrightText: 2024 Blender Authors
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
# Full path to Blender executable, autodetected when running from Blender
|
||||
blender_executable = ""
|
||||
|
||||
# Path to OpenImageIO idiff executable, empty if in PATH
|
||||
idiff_path = ""
|
||||
|
||||
# list of .blend files and directories with .blend files to render
|
||||
files = [
|
||||
"animation",
|
||||
"gameengine_visual",
|
||||
"modifier_stack",
|
||||
"sequence_editing",
|
||||
"glsl",
|
||||
"compositing",
|
||||
"particles_and_hair",
|
||||
"libraries_and_linking",
|
||||
"physics",
|
||||
"materials",
|
||||
"rendering",
|
||||
"modeling",
|
||||
"sculpting",
|
||||
"cycles",
|
||||
]
|
||||
|
||||
files = ["../" + f for f in files]
|
||||
@@ -1,19 +0,0 @@
|
||||
# SPDX-FileCopyrightText: 2024 Blender Authors
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
# Main imports
|
||||
import bpy
|
||||
import os
|
||||
import sys
|
||||
|
||||
# Get the cycles test directory
|
||||
filepath = bpy.data.filepath
|
||||
test_dir = os.path.dirname(__file__)
|
||||
|
||||
# Append to sys.path
|
||||
sys.path.append(test_dir)
|
||||
|
||||
# Import external script and execute
|
||||
import test_utils
|
||||
test_utils.main()
|
||||
@@ -1,78 +0,0 @@
|
||||
# SPDX-FileCopyrightText: 2024 Blender Authors
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
import os
|
||||
import sys
|
||||
import bpy
|
||||
import time
|
||||
|
||||
# Get the cycles test directory
|
||||
filepath = bpy.data.filepath
|
||||
blend_files_dir = os.path.dirname(filepath)
|
||||
test_dir = os.path.dirname(__file__)
|
||||
|
||||
# Get the filename without ending
|
||||
basename = os.path.basename(filepath)
|
||||
filename = os.path.splitext(basename)[0]
|
||||
|
||||
|
||||
def write_log_file(seconds, dir, blend_file, shading):
|
||||
rev = get_blender_revision()
|
||||
seconds = round(seconds, 2)
|
||||
path = "%s/test_renders/log.txt" % dir
|
||||
|
||||
try:
|
||||
logfile = open(path, "a")
|
||||
try:
|
||||
logfile.write('%s - %s - %s - %s seconds\n' % (blend_file, rev, shading, seconds))
|
||||
finally:
|
||||
logfile.close()
|
||||
except IOError:
|
||||
pass
|
||||
|
||||
|
||||
def is_background():
|
||||
return bpy.app.background
|
||||
|
||||
|
||||
def get_blender_revision():
|
||||
return bpy.app.build_revision
|
||||
|
||||
|
||||
def set_shading_system(scene, system):
|
||||
if system == 'svm':
|
||||
scene.cycles['shading_system'] = 0
|
||||
elif system == 'osl':
|
||||
scene.cycles['shading_system'] = 1
|
||||
|
||||
|
||||
def render(shading_system):
|
||||
scene = bpy.context.scene
|
||||
|
||||
if shading_system == "":
|
||||
scene.render.filepath = "%s/test_renders/%s" % (test_dir, filename)
|
||||
else:
|
||||
set_shading_system(scene, shading_system)
|
||||
scene.render.filepath = "%s/test_renders/%s_%s" % (test_dir, filename, shading_system)
|
||||
|
||||
scene.render.image_settings.media_type = 'IMAGE'
|
||||
scene.render.image_settings.file_format = 'PNG'
|
||||
scene.render.use_file_extension = True
|
||||
|
||||
start_time = time.time()
|
||||
bpy.ops.render.render(write_still=True)
|
||||
end_time = time.time()
|
||||
write_log_file((end_time - start_time), test_dir, basename, shading_system)
|
||||
|
||||
|
||||
def main():
|
||||
# Only run in background mode
|
||||
if not is_background():
|
||||
return
|
||||
|
||||
if filepath.find("cycles") == -1:
|
||||
render("")
|
||||
else:
|
||||
render("svm")
|
||||
render("osl")
|
||||
BIN
tests/files/render/integrator/cycles_renders/resumable_render.png
(Stored with Git LFS)
BIN
tests/files/render/integrator/cycles_renders/resumable_render.png
(Stored with Git LFS)
Binary file not shown.
BIN
tests/files/render/integrator/eevee_renders/resumable_render.png
(Stored with Git LFS)
BIN
tests/files/render/integrator/eevee_renders/resumable_render.png
(Stored with Git LFS)
Binary file not shown.
BIN
tests/files/render/integrator/resumable_render.blend
(Stored with Git LFS)
BIN
tests/files/render/integrator/resumable_render.blend
(Stored with Git LFS)
Binary file not shown.
BIN
tests/files/render/integrator/storm_hydra_renders/resumable_render.png
(Stored with Git LFS)
BIN
tests/files/render/integrator/storm_hydra_renders/resumable_render.png
(Stored with Git LFS)
Binary file not shown.
BIN
tests/files/render/integrator/storm_usd_renders/resumable_render.png
(Stored with Git LFS)
BIN
tests/files/render/integrator/storm_usd_renders/resumable_render.png
(Stored with Git LFS)
Binary file not shown.
BIN
tests/files/render/integrator/workbench_renders/resumable_render.png
(Stored with Git LFS)
BIN
tests/files/render/integrator/workbench_renders/resumable_render.png
(Stored with Git LFS)
Binary file not shown.
Reference in New Issue
Block a user