Cycles tests: add environment variable to update references renders.
This will copy new renders over references renders: CYCLESTEST_UPDATE=1 ctest -R cycles
This commit is contained in:
@@ -142,7 +142,7 @@ def test_get_images(filepath):
|
|||||||
os.makedirs(diff_dirpath)
|
os.makedirs(diff_dirpath)
|
||||||
diff_img = os.path.join(diff_dirpath, testname + ".diff.png")
|
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:
|
class Report:
|
||||||
@@ -239,7 +239,7 @@ class Report:
|
|||||||
name = test_get_name(filepath)
|
name = test_get_name(filepath)
|
||||||
name = name.replace('_', ' ')
|
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 ""
|
status = error if error else ""
|
||||||
style = """ style="background-color: #f99;" """ if error else ""
|
style = """ style="background-color: #f99;" """ if error else ""
|
||||||
@@ -266,7 +266,7 @@ class Report:
|
|||||||
|
|
||||||
|
|
||||||
def verify_output(report, filepath):
|
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
|
# copy new image
|
||||||
if os.path.exists(new_img):
|
if os.path.exists(new_img):
|
||||||
@@ -274,25 +274,35 @@ def verify_output(report, filepath):
|
|||||||
if os.path.exists(TEMP_FILE):
|
if os.path.exists(TEMP_FILE):
|
||||||
shutil.copy(TEMP_FILE, new_img)
|
shutil.copy(TEMP_FILE, new_img)
|
||||||
|
|
||||||
|
update = os.getenv('CYCLESTEST_UPDATE')
|
||||||
|
|
||||||
if not os.path.exists(ref_img):
|
if os.path.exists(ref_img):
|
||||||
return False
|
# 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
|
||||||
|
|
||||||
# diff test with threshold
|
failed = True
|
||||||
command = (
|
|
||||||
IDIFF,
|
if failed and update:
|
||||||
"-fail", "0.016",
|
# update reference
|
||||||
"-failpercent", "1",
|
shutil.copy(new_img, ref_img)
|
||||||
ref_img,
|
shutil.copy(new_img, old_img)
|
||||||
TEMP_FILE,
|
|
||||||
)
|
|
||||||
try:
|
|
||||||
subprocess.check_output(command)
|
|
||||||
failed = False
|
failed = False
|
||||||
except subprocess.CalledProcessError as e:
|
|
||||||
if VERBOSE:
|
|
||||||
print_message(e.output.decode("utf-8"))
|
|
||||||
failed = e.returncode != 1
|
|
||||||
|
|
||||||
# generate diff image
|
# generate diff image
|
||||||
command = (
|
command = (
|
||||||
|
Reference in New Issue
Block a user