Fix Boundary brush not working when the whole mesh is inside the brush radius
[blender.git] / tests / python / cycles_render_tests.py
1 #!/usr/bin/env python3
2 # Apache License, Version 2.0
3
4 import argparse
5 import os
6 import shlex
7 import shutil
8 import subprocess
9 import sys
10 from pathlib import Path
11
12
13 def get_arguments(filepath, output_filepath):
14     dirname = os.path.dirname(filepath)
15     basedir = os.path.dirname(dirname)
16     subject = os.path.basename(dirname)
17
18     args = [
19         "--background",
20         "-noaudio",
21         "--factory-startup",
22         "--enable-autoexec",
23         "--debug-memory",
24         "--debug-exit-on-error",
25         filepath,
26         "-E", "CYCLES",
27         "-o", output_filepath,
28         "-F", "PNG"]
29
30     # OSL and GPU examples
31     # custom_args += ["--python-expr", "import bpy; bpy.context.scene.cycles.shading_system = True"]
32     # custom_args += ["--python-expr", "import bpy; bpy.context.scene.cycles.device = 'GPU'"]
33     custom_args = os.getenv('CYCLESTEST_ARGS')
34     if custom_args:
35         args.extend(shlex.split(custom_args))
36
37     if subject == 'bake':
38         args.extend(['--python', os.path.join(basedir, "util", "render_bake.py")])
39     elif subject == 'denoise_animation':
40         args.extend(['--python', os.path.join(basedir, "util", "render_denoise.py")])
41     else:
42         args.extend(["-f", "1"])
43
44     return args
45
46
47 def create_argparse():
48     parser = argparse.ArgumentParser()
49     parser.add_argument("-blender", nargs="+")
50     parser.add_argument("-testdir", nargs=1)
51     parser.add_argument("-outdir", nargs=1)
52     parser.add_argument("-idiff", nargs=1)
53     return parser
54
55
56 def main():
57     parser = create_argparse()
58     args = parser.parse_args()
59
60     blender = args.blender[0]
61     test_dir = args.testdir[0]
62     idiff = args.idiff[0]
63     output_dir = args.outdir[0]
64
65     from modules import render_report
66     report = render_report.Report("Cycles", output_dir, idiff)
67     report.set_pixelated(True)
68     report.set_reference_dir("cycles_renders")
69     report.set_compare_engines('cycles', 'eevee')
70
71     # Increase threshold for motion blur, see T78777.
72     test_dir_name = Path(test_dir).name
73     if test_dir_name == 'motion_blur':
74         report.set_fail_threshold(0.032)
75
76     ok = report.run(test_dir, blender, get_arguments, batch=True)
77
78     sys.exit(not ok)
79
80
81 if __name__ == "__main__":
82     main()