forked from bartvdbraak/blender
Cleanup: Better logging for imbuf tests
Recent failures requiring investigation have exposed some shortcomings that this addresses: - When creating the diff image for offline comparison, use a higher threshold to prevent idiff from printing more output which will often contradict the primary failure output just above it (very confusing) - For metadata failures, make sure these get printed so it's obvious what kind of failure we're dealing with Pull Request: https://projects.blender.org/blender/blender/pulls/107058
This commit is contained in:
parent
302eb1e0d7
commit
1bb77d9eae
@ -32,6 +32,7 @@ class ImBufTest(AbstractImBufTest):
|
|||||||
colorspace = img.colorspace_settings.name
|
colorspace = img.colorspace_settings.name
|
||||||
alpha_mode = img.alpha_mode
|
alpha_mode = img.alpha_mode
|
||||||
actual_metadata = f"{channels=} {is_float=} {colorspace=} {alpha_mode=}"
|
actual_metadata = f"{channels=} {is_float=} {colorspace=} {alpha_mode=}"
|
||||||
|
expected_metadata = ""
|
||||||
|
|
||||||
# Save actual metadata
|
# Save actual metadata
|
||||||
out_metadata_path.write_text(actual_metadata, encoding="utf-8")
|
out_metadata_path.write_text(actual_metadata, encoding="utf-8")
|
||||||
@ -52,10 +53,14 @@ class ImBufTest(AbstractImBufTest):
|
|||||||
|
|
||||||
failed = True
|
failed = True
|
||||||
|
|
||||||
if failed and self.update:
|
if failed:
|
||||||
|
if self.update:
|
||||||
# Update reference if requested.
|
# Update reference if requested.
|
||||||
ref_metadata_path.write_text(actual_metadata, encoding="utf-8")
|
ref_metadata_path.write_text(actual_metadata, encoding="utf-8")
|
||||||
failed = False
|
failed = False
|
||||||
|
else:
|
||||||
|
print_message(
|
||||||
|
"Expected [{}] but got [{}]".format(expected_metadata, actual_metadata))
|
||||||
|
|
||||||
return not failed
|
return not failed
|
||||||
|
|
||||||
|
@ -73,12 +73,14 @@ class AbstractImBufTest(unittest.TestCase):
|
|||||||
shutil.copy(out_filepath, ref_filepath)
|
shutil.copy(out_filepath, ref_filepath)
|
||||||
failed = False
|
failed = False
|
||||||
|
|
||||||
# Generate diff image.
|
# Generate diff image (set fail thresholds high to reduce output spam).
|
||||||
diff_img = str(self.diff_dir.joinpath(out_name + ".diff.png"))
|
diff_img = str(self.diff_dir.joinpath(out_name + ".diff.png"))
|
||||||
command = (
|
command = (
|
||||||
str(self.idiff),
|
str(self.idiff),
|
||||||
"-o", diff_img,
|
"-fail", "1",
|
||||||
|
"-failpercent", "100",
|
||||||
"-abs", "-scale", "16",
|
"-abs", "-scale", "16",
|
||||||
|
"-o", diff_img,
|
||||||
ref_filepath,
|
ref_filepath,
|
||||||
out_filepath
|
out_filepath
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user