Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2017-09-03 01:15:14 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2017-09-12 13:50:44 +0300
commit28532f18672b1a2a8d3190f6ec1e7ec861699d66 (patch)
tree3f450ea1aa2d3b22169280b3245f70d3af4214a1 /tests
parentcd6c9e9e5f4726ab0b0b2c58249f98dab5c5d267 (diff)
Cycles tests: add environment variable to update references renders.
This will copy new renders over references renders: CYCLESTEST_UPDATE=1 ctest -R cycles
Diffstat (limited to 'tests')
-rwxr-xr-xtests/python/cycles_render_tests.py48
1 files changed, 29 insertions, 19 deletions
diff --git a/tests/python/cycles_render_tests.py b/tests/python/cycles_render_tests.py
index ba4c04f7cf3..2bdadced80f 100755
--- a/tests/python/cycles_render_tests.py
+++ b/tests/python/cycles_render_tests.py
@@ -142,7 +142,7 @@ def test_get_images(filepath):
os.makedirs(diff_dirpath)
diff_img = os.path.join(diff_dirpath, testname + ".diff.png")
- return ref_img, new_img, diff_img
+ return old_img, ref_img, new_img, diff_img
class Report:
@@ -239,7 +239,7 @@ class Report:
name = test_get_name(filepath)
name = name.replace('_', ' ')
- ref_img, new_img, diff_img = test_get_images(filepath)
+ old_img, ref_img, new_img, diff_img = test_get_images(filepath)
status = error if error else ""
style = """ style="background-color: #f99;" """ if error else ""
@@ -266,7 +266,7 @@ class Report:
def verify_output(report, filepath):
- ref_img, new_img, diff_img = test_get_images(filepath)
+ old_img, ref_img, new_img, diff_img = test_get_images(filepath)
# copy new image
if os.path.exists(new_img):
@@ -274,25 +274,35 @@ def verify_output(report, filepath):
if os.path.exists(TEMP_FILE):
shutil.copy(TEMP_FILE, new_img)
+ update = os.getenv('CYCLESTEST_UPDATE')
+
+ if os.path.exists(ref_img):
+ # diff test with threshold
+ command = (
+ IDIFF,
+ "-fail", "0.016",
+ "-failpercent", "1",
+ ref_img,
+ TEMP_FILE,
+ )
+ try:
+ subprocess.check_output(command)
+ failed = False
+ except subprocess.CalledProcessError as e:
+ if VERBOSE:
+ print_message(e.output.decode("utf-8"))
+ failed = e.returncode != 1
+ else:
+ if not update:
+ return False
- if not os.path.exists(ref_img):
- return False
+ failed = True
- # diff test with threshold
- command = (
- IDIFF,
- "-fail", "0.016",
- "-failpercent", "1",
- ref_img,
- TEMP_FILE,
- )
- try:
- subprocess.check_output(command)
+ if failed and update:
+ # update reference
+ shutil.copy(new_img, ref_img)
+ shutil.copy(new_img, old_img)
failed = False
- except subprocess.CalledProcessError as e:
- if VERBOSE:
- print_message(e.output.decode("utf-8"))
- failed = e.returncode != 1
# generate diff image
command = (