diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-09-13 16:44:13 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-09-13 16:44:13 +0300 |
commit | 37d8d4787cfa3d04b09f935c5600f1a3ea7b74e7 (patch) | |
tree | b60dfc428ccd61b5b3af6a06cee6ddbe69d3973e /tests | |
parent | 9abacf38fd4f3b0de4b6d9a4644b9cb1155482c9 (diff) | |
parent | 6f633dec5d105ad91dcb5774a6fd4fb06bf264a5 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'tests')
-rw-r--r-- | tests/python/CMakeLists.txt | 1 | ||||
-rwxr-xr-x | tests/python/cycles_render_tests.py | 64 |
2 files changed, 46 insertions, 19 deletions
diff --git a/tests/python/CMakeLists.txt b/tests/python/CMakeLists.txt index 4d5c0934cf2..a3460823e69 100644 --- a/tests/python/CMakeLists.txt +++ b/tests/python/CMakeLists.txt @@ -534,6 +534,7 @@ if(WITH_CYCLES) if(WITH_OPENGL_TESTS) add_cycles_render_test(opengl) endif() + add_cycles_render_test(bake) add_cycles_render_test(denoise) add_cycles_render_test(displacement) add_cycles_render_test(image_data_types) diff --git a/tests/python/cycles_render_tests.py b/tests/python/cycles_render_tests.py index ba4c04f7cf3..fde0b6bdcba 100755 --- a/tests/python/cycles_render_tests.py +++ b/tests/python/cycles_render_tests.py @@ -77,6 +77,22 @@ def render_file(filepath): '--python', os.path.join(basedir, "util", "render_opengl.py")] + elif subject == 'bake': + command = [ + BLENDER, + "-b", + "-noaudio", + "--factory-startup", + "--enable-autoexec", + filepath, + "-E", "CYCLES"] + command += custom_args + command += [ + "-o", TEMP_FILE_MASK, + "-F", "PNG", + '--python', os.path.join(basedir, + "util", + "render_bake.py")] else: command = [ BLENDER, @@ -142,7 +158,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 +255,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 +282,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 +290,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 = ( |