From 4970bac061721996ac8142c76389f61ab2580ce8 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sun, 6 Apr 2025 13:52:15 +0200 Subject: [PATCH] Tests: Properly disable tests when data directory is missing And clean up cmake output to be less verbose. --- build_files/cmake/testing.cmake | 3 + tests/python/CMakeLists.txt | 1399 ++++++++++++++------------- tests/python/collada/CMakeLists.txt | 72 -- 3 files changed, 728 insertions(+), 746 deletions(-) delete mode 100644 tests/python/collada/CMakeLists.txt diff --git a/build_files/cmake/testing.cmake b/build_files/cmake/testing.cmake index 75662527e7d..c09966a132c 100644 --- a/build_files/cmake/testing.cmake +++ b/build_files/cmake/testing.cmake @@ -139,6 +139,9 @@ function(blender_add_ctests) if(ARGC LESS 1) message(FATAL_ERROR "No arguments supplied to blender_add_ctests()") endif() + if(NOT EXISTS "${CMAKE_SOURCE_DIR}/tests/data/render") + return() + endif() # Parse the arguments set(oneValueArgs DISCOVER_TESTS TARGET SUITE_NAME) diff --git a/tests/python/CMakeLists.txt b/tests/python/CMakeLists.txt index 39206a57b11..465f0aac399 100644 --- a/tests/python/CMakeLists.txt +++ b/tests/python/CMakeLists.txt @@ -17,9 +17,20 @@ file(MAKE_DIRECTORY ${TEST_OUT_DIR}) file(MAKE_DIRECTORY ${TEST_OUT_DIR}/io_tests) file(MAKE_DIRECTORY ${TEST_OUT_DIR}/blendfile_io) -# if(NOT IS_DIRECTORY ${TEST_SRC_DIR}) -# message(FATAL_ERROR "CMake test directory not found!") -# endif() +# Check which tests can be enabled. +if(IS_DIRECTORY ${TEST_SRC_DIR}/render) + set(TEST_SRC_DIR_EXISTS TRUE) + + if(OPENIMAGEIO_TOOL) + set(TEST_OPENIMAGEIO_TOOL_EXISTS TRUE) + else() + set(TEST_OPENIMAGEIO_TOOL_EXISTS FALSE) + message(STATUS "Tests: Disabling render tests, missing oiiotool") + endif() +else() + set(TEST_SRC_DIR_EXISTS FALSE) + message(STATUS "Tests: Disabling most tests, no test data in ${TEST_SRC_DIR}") +endif() if(WITH_SYSTEM_PYTHON_TESTS) if(NOT EXISTS "${TEST_SYSTEM_PYTHON_EXE}") @@ -152,11 +163,13 @@ endfunction() # Run Python render test. function(add_render_test testname testscript) - set(_args ${ARGN} --blender "${TEST_BLENDER_EXE}" --oiiotool "${OPENIMAGEIO_TOOL}") - if(WITH_TESTS_BATCHED) - list(APPEND _args --batch) + if(TEST_OPENIMAGEIO_TOOL_EXISTS) + set(_args ${ARGN} --blender "${TEST_BLENDER_EXE}" --oiiotool "${OPENIMAGEIO_TOOL}") + if(WITH_TESTS_BATCHED) + list(APPEND _args --batch) + endif() + add_python_test(${testname} ${testscript} ${_args}) endif() - add_python_test(${testname} ${testscript} ${_args}) endfunction() # Run Python script outside Blender, using system default Python3 interpreter, @@ -176,6 +189,8 @@ endfunction() # ------------------------------------------------------------------------------ # TESTS USING SYSTEM PYTHON +# ------------------------------------------------------------------------------ + add_system_python_test( script_validate_on_system_python ${CMAKE_CURRENT_LIST_DIR}/system_python/load_tool_scripts.py @@ -184,6 +199,8 @@ add_system_python_test( # ------------------------------------------------------------------------------ # GENERAL PYTHON CORRECTNESS TESTS +# ------------------------------------------------------------------------------ + add_blender_test( script_load_keymap --python ${CMAKE_CURRENT_LIST_DIR}/bl_keymap_completeness.py @@ -220,6 +237,8 @@ endif() # ------------------------------------------------------------------------------ # PY API TESTS +# ------------------------------------------------------------------------------ + add_blender_test( script_pyapi_bpy_path --python ${CMAKE_CURRENT_LIST_DIR}/bl_pyapi_bpy_path.py @@ -267,6 +286,7 @@ add_blender_test( # ------------------------------------------------------------------------------ # DATA MANAGEMENT TESTS +# ------------------------------------------------------------------------------ add_blender_test( id_management @@ -285,6 +305,7 @@ add_blender_test( # ------------------------------------------------------------------------------ # BLEND IO & LINKING +# ------------------------------------------------------------------------------ add_blender_test( blendfile_io @@ -295,571 +316,587 @@ add_blender_test( # This test can be extremely long, especially in debug builds. # Generate BLENDFILE_VERSIONING_SPLIT_RANGE instances of the test, # each processing their own subset of the whole set of blendfiles. -set(BLENDFILE_VERSIONING_SPLIT_RANGE 32) -math(EXPR BLENDFILE_VERSIONING_SPLIT_RANGE_CMAKE "${BLENDFILE_VERSIONING_SPLIT_RANGE} - 1") -foreach(idx RANGE ${BLENDFILE_VERSIONING_SPLIT_RANGE_CMAKE}) +if(TEST_SRC_DIR_EXISTS) + set(BLENDFILE_VERSIONING_SPLIT_RANGE 32) + math(EXPR BLENDFILE_VERSIONING_SPLIT_RANGE_CMAKE "${BLENDFILE_VERSIONING_SPLIT_RANGE} - 1") + foreach(idx RANGE ${BLENDFILE_VERSIONING_SPLIT_RANGE_CMAKE}) + add_blender_test( + "blendfile_versioning_${idx}_over_${BLENDFILE_VERSIONING_SPLIT_RANGE}" + --log "*blendfile*" + --debug-memory + --debug + --python ${CMAKE_CURRENT_LIST_DIR}/bl_blendfile_versioning.py -- + --src-test-dir ${TEST_SRC_DIR}/ + --slice-range ${BLENDFILE_VERSIONING_SPLIT_RANGE} + --slice-index ${idx} + ) + endforeach() + add_blender_test( - "blendfile_versioning_${idx}_over_${BLENDFILE_VERSIONING_SPLIT_RANGE}" - --log "*blendfile*" - --debug-memory - --debug - --python ${CMAKE_CURRENT_LIST_DIR}/bl_blendfile_versioning.py -- + blendfile_liblink + --python ${CMAKE_CURRENT_LIST_DIR}/bl_blendfile_liblink.py -- --src-test-dir ${TEST_SRC_DIR}/ - --slice-range ${BLENDFILE_VERSIONING_SPLIT_RANGE} - --slice-index ${idx} + --output-dir ${TEST_OUT_DIR}/blendfile_io/ ) -endforeach() -add_blender_test( - blendfile_liblink - --python ${CMAKE_CURRENT_LIST_DIR}/bl_blendfile_liblink.py -- - --src-test-dir ${TEST_SRC_DIR}/ - --output-dir ${TEST_OUT_DIR}/blendfile_io/ -) + add_blender_test( + blendfile_relationships + --python ${CMAKE_CURRENT_LIST_DIR}/bl_blendfile_relationships.py -- + --src-test-dir ${TEST_SRC_DIR}/ + --output-dir ${TEST_OUT_DIR}/blendfile_io/ + ) -add_blender_test( - blendfile_relationships - --python ${CMAKE_CURRENT_LIST_DIR}/bl_blendfile_relationships.py -- - --src-test-dir ${TEST_SRC_DIR}/ - --output-dir ${TEST_OUT_DIR}/blendfile_io/ -) - -add_blender_test( - blendfile_library_overrides - --python ${CMAKE_CURRENT_LIST_DIR}/bl_blendfile_library_overrides.py -- - --output-dir ${TEST_OUT_DIR}/blendfile_io/ - --test-dir "${TEST_SRC_DIR}/libraries_and_linking" -) + add_blender_test( + blendfile_library_overrides + --python ${CMAKE_CURRENT_LIST_DIR}/bl_blendfile_library_overrides.py -- + --output-dir ${TEST_OUT_DIR}/blendfile_io/ + --test-dir "${TEST_SRC_DIR}/libraries_and_linking" + ) +endif() # ------------------------------------------------------------------------------ # MODELING TESTS -add_blender_test( - bmesh_bevel - ${TEST_SRC_DIR}/modeling/bevel_regression.blend - --python ${TEST_PYTHON_DIR}/bevel_operator.py - -- - --run-all-tests -) +# ------------------------------------------------------------------------------ -add_blender_test( - bmesh_boolean - ${TEST_SRC_DIR}/modeling/bool_regression.blend - --python ${TEST_PYTHON_DIR}/boolean_operator.py - -- - --run-all-tests -) +if(TEST_SRC_DIR_EXISTS) + add_blender_test( + bmesh_bevel + ${TEST_SRC_DIR}/modeling/bevel_regression.blend + --python ${TEST_PYTHON_DIR}/bevel_operator.py + -- + --run-all-tests + ) -add_blender_test( - bmesh_split_faces - ${TEST_SRC_DIR}/modeling/split_faces_test.blend - --python-text run_tests -) + add_blender_test( + bmesh_boolean + ${TEST_SRC_DIR}/modeling/bool_regression.blend + --python ${TEST_PYTHON_DIR}/boolean_operator.py + -- + --run-all-tests + ) -add_blender_test( - curve_to_mesh - ${TEST_SRC_DIR}/modeling/curve_to_mesh.blend - --python ${TEST_PYTHON_DIR}/curve_to_mesh.py - -- - --run-all-tests -) + add_blender_test( + bmesh_split_faces + ${TEST_SRC_DIR}/modeling/split_faces_test.blend + --python-text run_tests + ) -add_blender_test( - curves_extrude - ${TEST_SRC_DIR}/modeling/curves_extrude.blend - --python ${TEST_PYTHON_DIR}/curves_extrude.py - -- - --run-all-tests -) + add_blender_test( + curve_to_mesh + ${TEST_SRC_DIR}/modeling/curve_to_mesh.blend + --python ${TEST_PYTHON_DIR}/curve_to_mesh.py + -- + --run-all-tests + ) -add_blender_test( - object_conversion - ${TEST_SRC_DIR}/modeling/object_conversion.blend - --python ${TEST_PYTHON_DIR}/object_conversion.py - -- - --run-all-tests -) + add_blender_test( + curves_extrude + ${TEST_SRC_DIR}/modeling/curves_extrude.blend + --python ${TEST_PYTHON_DIR}/curves_extrude.py + -- + --run-all-tests + ) -add_blender_test( - object_api - --python ${TEST_PYTHON_DIR}/bl_object.py -) + add_blender_test( + object_conversion + ${TEST_SRC_DIR}/modeling/object_conversion.blend + --python ${TEST_PYTHON_DIR}/object_conversion.py + -- + --run-all-tests + ) + + add_blender_test( + object_api + --python ${TEST_PYTHON_DIR}/bl_object.py + ) +endif() # ------------------------------------------------------------------------------ # MODIFIERS TESTS -add_blender_test( - object_modifier_array - ${TEST_SRC_DIR}/modifier_stack/array_test.blend - --python-text run_tests.py -) +# ------------------------------------------------------------------------------ -add_blender_test( - modifiers - ${TEST_SRC_DIR}/modeling/modifiers.blend - --python ${TEST_PYTHON_DIR}/modifiers.py - -- - --run-all-tests -) - -add_blender_test( - physics_cloth - ${TEST_SRC_DIR}/physics/cloth_test.blend - --python ${TEST_PYTHON_DIR}/physics_cloth.py - -- - --run-all-tests -) - -add_blender_test( - physics_softbody - ${TEST_SRC_DIR}/physics/softbody_test.blend - --python ${TEST_PYTHON_DIR}/physics_softbody.py - -- - --run-all-tests -) - -add_blender_test( - physics_dynamic_paint - ${TEST_SRC_DIR}/physics/dynamic_paint_test.blend - --python ${TEST_PYTHON_DIR}/physics_dynamic_paint.py - -- - --run-all-tests -) - -add_blender_test( - deform_modifiers - ${TEST_SRC_DIR}/modeling/deform_modifiers.blend - --python ${TEST_PYTHON_DIR}/deform_modifiers.py - -- - --run-all-tests -) - -if(WITH_MOD_OCEANSIM) +if(TEST_SRC_DIR_EXISTS) add_blender_test( - physics_ocean - ${TEST_SRC_DIR}/physics/ocean_test.blend - --python ${TEST_PYTHON_DIR}/physics_ocean.py + object_modifier_array + ${TEST_SRC_DIR}/modifier_stack/array_test.blend + --python-text run_tests.py + ) + + add_blender_test( + modifiers + ${TEST_SRC_DIR}/modeling/modifiers.blend + --python ${TEST_PYTHON_DIR}/modifiers.py + -- + --run-all-tests + ) + + add_blender_test( + physics_cloth + ${TEST_SRC_DIR}/physics/cloth_test.blend + --python ${TEST_PYTHON_DIR}/physics_cloth.py + -- + --run-all-tests + ) + + add_blender_test( + physics_softbody + ${TEST_SRC_DIR}/physics/softbody_test.blend + --python ${TEST_PYTHON_DIR}/physics_softbody.py + -- + --run-all-tests + ) + + add_blender_test( + physics_dynamic_paint + ${TEST_SRC_DIR}/physics/dynamic_paint_test.blend + --python ${TEST_PYTHON_DIR}/physics_dynamic_paint.py + -- + --run-all-tests + ) + + add_blender_test( + deform_modifiers + ${TEST_SRC_DIR}/modeling/deform_modifiers.blend + --python ${TEST_PYTHON_DIR}/deform_modifiers.py + -- + --run-all-tests + ) + + if(WITH_MOD_OCEANSIM) + add_blender_test( + physics_ocean + ${TEST_SRC_DIR}/physics/ocean_test.blend + --python ${TEST_PYTHON_DIR}/physics_ocean.py + -- + --run-all-tests + ) + endif() + + add_blender_test( + physics_particle_system + ${TEST_SRC_DIR}/physics/physics_particle_test.blend + --python ${TEST_PYTHON_DIR}/physics_particle_system.py + -- + --run-all-tests + ) + + add_blender_test( + physics_particle_instance + ${TEST_SRC_DIR}/physics/physics_particle_instance.blend + --python ${TEST_PYTHON_DIR}/physics_particle_instance.py + -- + --run-all-tests + ) + + add_blender_test( + constraints + --python ${CMAKE_CURRENT_LIST_DIR}/bl_constraints.py + -- + --testdir "${TEST_SRC_DIR}/constraints" + ) +endif() + +# ------------------------------------------------------------------------------ +# OPERATORS TESTS +# ------------------------------------------------------------------------------ + +if(TEST_SRC_DIR_EXISTS) + add_blender_test( + operators + ${TEST_SRC_DIR}/modeling/operators.blend + --python ${TEST_PYTHON_DIR}/operators.py -- --run-all-tests ) endif() - -add_blender_test( - physics_particle_system - ${TEST_SRC_DIR}/physics/physics_particle_test.blend - --python ${TEST_PYTHON_DIR}/physics_particle_system.py - -- - --run-all-tests -) - -add_blender_test( - physics_particle_instance - ${TEST_SRC_DIR}/physics/physics_particle_instance.blend - --python ${TEST_PYTHON_DIR}/physics_particle_instance.py - -- - --run-all-tests -) - -add_blender_test( - constraints - --python ${CMAKE_CURRENT_LIST_DIR}/bl_constraints.py - -- - --testdir "${TEST_SRC_DIR}/constraints" -) - -# ------------------------------------------------------------------------------ -# OPERATORS TESTS -add_blender_test( - operators - ${TEST_SRC_DIR}/modeling/operators.blend - --python ${TEST_PYTHON_DIR}/operators.py - -- - --run-all-tests -) - # ------------------------------------------------------------------------------ # ANIMATION TESTS +# ------------------------------------------------------------------------------ + add_blender_test( bl_animation_armature --python ${CMAKE_CURRENT_LIST_DIR}/bl_animation_armature.py ) -add_blender_test( - bl_animation_drivers - --python ${CMAKE_CURRENT_LIST_DIR}/bl_animation_drivers.py - -- - --testdir "${TEST_SRC_DIR}/animation" -) - -add_blender_test( - bl_animation_fcurves - --python ${CMAKE_CURRENT_LIST_DIR}/bl_animation_fcurves.py - -- - --testdir "${TEST_SRC_DIR}/animation" -) - -add_blender_test( - bl_animation_action - --python ${CMAKE_CURRENT_LIST_DIR}/bl_animation_action.py - -- - --testdir "${TEST_SRC_DIR}/animation" - --output-dir "${TEST_OUT_DIR}/bl_animation_action" -) - -add_blender_test( - bl_animation_keyframing - --python ${CMAKE_CURRENT_LIST_DIR}/bl_animation_keyframing.py - -- - --testdir "${TEST_SRC_DIR}/animation" -) - add_blender_test( bl_animation_bake --python ${CMAKE_CURRENT_LIST_DIR}/bl_animation_bake.py ) -add_blender_test( - bl_pose_assets - --python ${CMAKE_CURRENT_LIST_DIR}/bl_pose_assets.py - -- - --testdir "${TEST_SRC_DIR}/animation" -) - add_blender_test( bl_animation_nla_strip --python ${CMAKE_CURRENT_LIST_DIR}/bl_animation_nla_strip.py ) -add_blender_test( - bl_rigging_symmetrize - --python ${CMAKE_CURRENT_LIST_DIR}/bl_rigging_symmetrize.py - -- - --testdir "${TEST_SRC_DIR}/animation" -) +if(TEST_SRC_DIR_EXISTS) + add_blender_test( + bl_animation_drivers + --python ${CMAKE_CURRENT_LIST_DIR}/bl_animation_drivers.py + -- + --testdir "${TEST_SRC_DIR}/animation" + ) + + add_blender_test( + bl_animation_fcurves + --python ${CMAKE_CURRENT_LIST_DIR}/bl_animation_fcurves.py + -- + --testdir "${TEST_SRC_DIR}/animation" + ) + + add_blender_test( + bl_animation_action + --python ${CMAKE_CURRENT_LIST_DIR}/bl_animation_action.py + -- + --testdir "${TEST_SRC_DIR}/animation" + --output-dir "${TEST_OUT_DIR}/bl_animation_action" + ) + + add_blender_test( + bl_animation_keyframing + --python ${CMAKE_CURRENT_LIST_DIR}/bl_animation_keyframing.py + -- + --testdir "${TEST_SRC_DIR}/animation" + ) + + add_blender_test( + bl_pose_assets + --python ${CMAKE_CURRENT_LIST_DIR}/bl_pose_assets.py + -- + --testdir "${TEST_SRC_DIR}/animation" + ) + + add_blender_test( + bl_rigging_symmetrize + --python ${CMAKE_CURRENT_LIST_DIR}/bl_rigging_symmetrize.py + -- + --testdir "${TEST_SRC_DIR}/animation" + ) +endif() # ------------------------------------------------------------------------------ # NODE GROUP TESTS -add_blender_test( - bl_node_field_type_inference - --python ${CMAKE_CURRENT_LIST_DIR}/bl_node_field_type_inference.py - -- - --testdir "${TEST_SRC_DIR}/node_group" -) +# ------------------------------------------------------------------------------ -add_blender_test( - bl_node_group_compat - --python ${CMAKE_CURRENT_LIST_DIR}/bl_node_group_compat.py - -- - --testdir "${TEST_SRC_DIR}/node_group" -) +if(TEST_SRC_DIR_EXISTS) + add_blender_test( + bl_node_field_type_inference + --python ${CMAKE_CURRENT_LIST_DIR}/bl_node_field_type_inference.py + -- + --testdir "${TEST_SRC_DIR}/node_group" + ) -add_blender_test( - bl_node_group_interface - --python ${CMAKE_CURRENT_LIST_DIR}/bl_node_group_interface.py - -- - --testdir "${TEST_SRC_DIR}/node_group" -) + add_blender_test( + bl_node_group_compat + --python ${CMAKE_CURRENT_LIST_DIR}/bl_node_group_compat.py + -- + --testdir "${TEST_SRC_DIR}/node_group" + ) -# SVG Import -if(TRUE) - if(NOT OPENIMAGEIO_TOOL) - message(WARNING "Disabling SVG tests because OIIO oiiotool does not exist") - else() - set(_svg_render_tests complex path) - - foreach(render_test ${_svg_render_tests}) - add_render_test( - io_curve_svg_${render_test} - ${CMAKE_CURRENT_LIST_DIR}/bl_io_curve_svg_test.py - --testdir "${TEST_SRC_DIR}/io_tests/svg/${render_test}" - --outdir "${TEST_OUT_DIR}/io_curve_svg" - ) - endforeach() - - unset(_svg_render_tests) - endif() + add_blender_test( + bl_node_group_interface + --python ${CMAKE_CURRENT_LIST_DIR}/bl_node_group_interface.py + -- + --testdir "${TEST_SRC_DIR}/node_group" + ) endif() -if(WITH_CYCLES OR WITH_GPU_RENDER_TESTS) - if(NOT OPENIMAGEIO_TOOL) - message(WARNING "Disabling render tests because OIIO oiiotool does not exist") - elseif(NOT EXISTS "${TEST_SRC_DIR}/render/shader") - message( - WARNING "Disabling render tests because tests directory doesn't exist at ${TEST_SRC_DIR}" - ) - elseif(NOT WITH_OPENCOLORIO) - message(WARNING "Disabling render tests because WITH_OPENCOLORIO is disabled") - else() - set(render_tests - attributes - camera - bsdf - hair - image_colorspace - image_data_types - image_mapping - image_texture_limit - integrator - light - light_group - light_linking - mesh - pointcloud - principled_bsdf - shader - shadow_catcher - sss - texture +# ------------------------------------------------------------------------------ +# SVG TESTS +# ------------------------------------------------------------------------------ + +if(TEST_SRC_DIR_EXISTS) + set(_svg_render_tests complex path) + + foreach(render_test ${_svg_render_tests}) + add_render_test( + io_curve_svg_${render_test} + ${CMAKE_CURRENT_LIST_DIR}/bl_io_curve_svg_test.py + --testdir "${TEST_SRC_DIR}/io_tests/svg/${render_test}" + --outdir "${TEST_OUT_DIR}/io_curve_svg" ) + endforeach() - if(WITH_OPENSUBDIV) - list(APPEND render_tests displacement) + unset(_svg_render_tests) +endif() + +# ------------------------------------------------------------------------------ +# RENDER TESTS +# ------------------------------------------------------------------------------ + +if((WITH_CYCLES OR WITH_GPU_RENDER_TESTS) AND TEST_SRC_DIR_EXISTS) + set(render_tests + attributes + camera + bsdf + hair + image_colorspace + image_data_types + image_mapping + image_texture_limit + integrator + light + light_group + light_linking + mesh + pointcloud + principled_bsdf + shader + shadow_catcher + sss + texture + ) + + if(WITH_OPENSUBDIV) + list(APPEND render_tests displacement) + endif() + + if(WITH_FREESTYLE) + list(APPEND render_tests render_layer) + endif() + + if(WITH_MOD_FLUID) + list(APPEND render_tests motion_blur reports volume) + endif() + + if(WITH_OPENVDB) + list(APPEND render_tests openvdb) + endif() + + if(WITH_OPENIMAGEDENOISE) + list(APPEND render_tests denoise) + endif() + + # Disabled until new OpenPGL version with deterministic results. + # if(WITH_CYCLES_PATH_GUIDING) + # list(APPEND render_tests guiding) + # endif() + + if(WITH_GPU_RENDER_TESTS) + list(APPEND render_tests grease_pencil) + endif() + + list(SORT render_tests) + + # Cycles + if(WITH_CYCLES) + set(_cycles_blocklist "") + set(_cycles_known_test_devices CPU CUDA OPTIX HIP HIP-RT METAL METAL-RT ONEAPI ONEAPI-RT) + if((NOT WITH_CYCLES_OSL) OR (WITH_CYCLES_TEST_OSL AND WITH_CYCLES_OSL)) + # Disable OSL tests if built without OSL or + # Disable OSL tests during the "normal" test phase to avoid double + # testing during the OSL test phase. + set(_cycles_blocklist OSL) endif() - - if(WITH_FREESTYLE) - list(APPEND render_tests render_layer) - endif() - - if(WITH_MOD_FLUID) - list(APPEND render_tests motion_blur reports volume) - endif() - - if(WITH_OPENVDB) - list(APPEND render_tests openvdb) - endif() - - if(WITH_OPENIMAGEDENOISE) - list(APPEND render_tests denoise) - endif() - - # Disabled until new OpenPGL version with deterministic results. - # if(WITH_CYCLES_PATH_GUIDING) - # list(APPEND render_tests guiding) - # endif() - - if(WITH_GPU_RENDER_TESTS) - list(APPEND render_tests grease_pencil) - endif() - - list(SORT render_tests) - - # Cycles - if(WITH_CYCLES) - set(_cycles_blocklist "") - set(_cycles_known_test_devices CPU CUDA OPTIX HIP HIP-RT METAL METAL-RT ONEAPI ONEAPI-RT) - if((NOT WITH_CYCLES_OSL) OR (WITH_CYCLES_TEST_OSL AND WITH_CYCLES_OSL)) - # Disable OSL tests if built without OSL or - # Disable OSL tests during the "normal" test phase to avoid double - # testing during the OSL test phase. - set(_cycles_blocklist OSL) + foreach(_cycles_device ${CYCLES_TEST_DEVICES}) + if(NOT ${_cycles_device} IN_LIST _cycles_known_test_devices) + message(FATAL_ERROR "Unknown Cycles test device ${_cycles_device}." + "Supported devices are: ${_cycles_known_test_devices}") endif() - foreach(_cycles_device ${CYCLES_TEST_DEVICES}) - if(NOT ${_cycles_device} IN_LIST _cycles_known_test_devices) - message(FATAL_ERROR "Unknown Cycles test device ${_cycles_device}." - "Supported devices are: ${_cycles_known_test_devices}") - endif() - string(TOLOWER "${_cycles_device}" _cycles_device_lower) - set(_cycles_render_tests bake;${render_tests};osl) + string(TOLOWER "${_cycles_device}" _cycles_device_lower) + set(_cycles_render_tests bake;${render_tests};osl) - foreach(render_test ${_cycles_render_tests}) - set(_cycles_test_name "cycles_${render_test}_${_cycles_device_lower}") - if(NOT(WITH_CYCLES_TEST_OSL AND WITH_CYCLES_OSL AND ("${render_test}" STREQUAL "osl"))) - # Only run OSL basic tests during this phase if WITH_CYCLES_TEST_OSL isn't enabled + foreach(render_test ${_cycles_render_tests}) + set(_cycles_test_name "cycles_${render_test}_${_cycles_device_lower}") + if(NOT(WITH_CYCLES_TEST_OSL AND WITH_CYCLES_OSL AND ("${render_test}" STREQUAL "osl"))) + # Only run OSL basic tests during this phase if WITH_CYCLES_TEST_OSL isn't enabled + add_render_test( + ${_cycles_test_name} + ${CMAKE_CURRENT_LIST_DIR}/cycles_render_tests.py + --testdir "${TEST_SRC_DIR}/render/${render_test}" + --outdir "${TEST_OUT_DIR}/cycles" + --device ${_cycles_device} + --blocklist ${_cycles_blocklist} + ) + if(NOT ("${_cycles_device_lower}" STREQUAL "cpu")) + set_tests_properties(${_cycles_test_name} PROPERTIES RUN_SERIAL TRUE) + endif() + endif() + + if(WITH_CYCLES_TEST_OSL AND WITH_CYCLES_OSL) + # OSL is only supported with CPU and OptiX + # TODO: Enable OptiX support once it's more stable + if(("${_cycles_device_lower}" STREQUAL "cpu") OR + ("${_cycles_device_lower}" STREQUAL "optix")) add_render_test( - ${_cycles_test_name} + ${_cycles_test_name}_osl ${CMAKE_CURRENT_LIST_DIR}/cycles_render_tests.py --testdir "${TEST_SRC_DIR}/render/${render_test}" - --outdir "${TEST_OUT_DIR}/cycles" + --outdir "${TEST_OUT_DIR}/cycles_osl" --device ${_cycles_device} - --blocklist ${_cycles_blocklist} + --osl ) if(NOT ("${_cycles_device_lower}" STREQUAL "cpu")) - set_tests_properties(${_cycles_test_name} PROPERTIES RUN_SERIAL TRUE) + set_tests_properties(${_cycles_test_name}_osl PROPERTIES RUN_SERIAL TRUE) endif() endif() + endif() - if(WITH_CYCLES_TEST_OSL AND WITH_CYCLES_OSL) - # OSL is only supported with CPU and OptiX - # TODO: Enable OptiX support once it's more stable - if(("${_cycles_device_lower}" STREQUAL "cpu") OR - ("${_cycles_device_lower}" STREQUAL "optix")) - add_render_test( - ${_cycles_test_name}_osl - ${CMAKE_CURRENT_LIST_DIR}/cycles_render_tests.py - --testdir "${TEST_SRC_DIR}/render/${render_test}" - --outdir "${TEST_OUT_DIR}/cycles_osl" - --device ${_cycles_device} - --osl - ) - if(NOT ("${_cycles_device_lower}" STREQUAL "cpu")) - set_tests_properties(${_cycles_test_name}_osl PROPERTIES RUN_SERIAL TRUE) - endif() - endif() - endif() - - unset(_cycles_test_name) - endforeach() + unset(_cycles_test_name) endforeach() - unset(_cycles_blocklist) - unset(_cycles_known_test_devices) + endforeach() + unset(_cycles_blocklist) + unset(_cycles_known_test_devices) + endif() + + if(WITH_GPU_RENDER_TESTS) + list(APPEND gpu_render_tests ${render_tests}) + list(FILTER gpu_render_tests EXCLUDE REGEX light_group|shadow_catcher|denoise|guiding|reports) + + set(_gpu_render_tests_arguments) + if(WITH_GPU_RENDER_TESTS_SILENT) + list(APPEND _gpu_render_tests_arguments --fail-silently) endif() - if(WITH_GPU_RENDER_TESTS) - list(APPEND gpu_render_tests ${render_tests}) - list(FILTER gpu_render_tests EXCLUDE REGEX light_group|shadow_catcher|denoise|guiding|reports) + # Eevee Next + if(WITH_OPENGL_BACKEND) + foreach(render_test ${gpu_render_tests}) + add_render_test( + eevee_next_opengl_${render_test} + ${CMAKE_CURRENT_LIST_DIR}/eevee_next_render_tests.py + --testdir "${TEST_SRC_DIR}/render/${render_test}" + --outdir "${TEST_OUT_DIR}/eevee_next_opengl" + --gpu-backend opengl + ${_gpu_render_tests_arguments} + ) + endforeach() + endif() - set(_gpu_render_tests_arguments) - if(WITH_GPU_RENDER_TESTS_SILENT) - list(APPEND _gpu_render_tests_arguments --fail-silently) - endif() + if(WITH_METAL_BACKEND) + foreach(render_test ${gpu_render_tests}) + add_render_test( + eevee_next_metal_${render_test} + ${CMAKE_CURRENT_LIST_DIR}/eevee_next_render_tests.py + --testdir "${TEST_SRC_DIR}/render/${render_test}" + --outdir "${TEST_OUT_DIR}/eevee_next_metal" + --gpu-backend metal + ${_gpu_render_tests_arguments} + ) + endforeach() + endif() - # Eevee Next + if(WITH_VULKAN_BACKEND AND WITH_GPU_RENDER_TESTS_VULKAN) + foreach(render_test ${gpu_render_tests}) + add_render_test( + eevee_next_vulkan_${render_test} + ${CMAKE_CURRENT_LIST_DIR}/eevee_next_render_tests.py + --testdir "${TEST_SRC_DIR}/render/${render_test}" + --outdir "${TEST_OUT_DIR}/eevee_next_vulkan" + --gpu-backend vulkan + ${_gpu_render_tests_arguments} + ) + endforeach() + endif() + + # Workbench + if(WITH_OPENGL_BACKEND) + foreach(render_test ${gpu_render_tests}) + add_render_test( + workbench_opengl_${render_test} + ${CMAKE_CURRENT_LIST_DIR}/workbench_render_tests.py + --testdir "${TEST_SRC_DIR}/render/${render_test}" + --outdir "${TEST_OUT_DIR}/workbench_opengl" + --gpu-backend opengl + ${_gpu_render_tests_arguments} + ) + endforeach() + endif() + + if(WITH_METAL_BACKEND) + foreach(render_test ${gpu_render_tests}) + add_render_test( + workbench_metal_${render_test} + ${CMAKE_CURRENT_LIST_DIR}/workbench_render_tests.py + --testdir "${TEST_SRC_DIR}/render/${render_test}" + --outdir "${TEST_OUT_DIR}/workbench_metal" + --gpu-backend metal + ${_gpu_render_tests_arguments} + ) + endforeach() + endif() + + if(WITH_VULKAN_BACKEND AND WITH_GPU_RENDER_TESTS_VULKAN) + foreach(render_test ${gpu_render_tests}) + add_render_test( + workbench_vulkan_${render_test} + ${CMAKE_CURRENT_LIST_DIR}/workbench_render_tests.py + --testdir "${TEST_SRC_DIR}/render/${render_test}" + --outdir "${TEST_OUT_DIR}/workbench/vulkan" + --gpu-backend vulkan + ${_gpu_render_tests_arguments} + ) + endforeach() + endif() + + # Overlay + if(WITH_GPU_RENDER_TESTS_HEADED) if(WITH_OPENGL_BACKEND) - foreach(render_test ${gpu_render_tests}) - add_render_test( - eevee_next_opengl_${render_test} - ${CMAKE_CURRENT_LIST_DIR}/eevee_next_render_tests.py - --testdir "${TEST_SRC_DIR}/render/${render_test}" - --outdir "${TEST_OUT_DIR}/eevee_next_opengl" - --gpu-backend opengl - ${_gpu_render_tests_arguments} - ) - endforeach() + add_render_test( + overlay_opengl + ${CMAKE_CURRENT_LIST_DIR}/overlay_render_tests.py + --testdir "${TEST_SRC_DIR}/overlay" + --outdir "${TEST_OUT_DIR}/overlay" + --gpu-backend opengl + ${_gpu_render_tests_arguments} + ) endif() if(WITH_METAL_BACKEND) - foreach(render_test ${gpu_render_tests}) - add_render_test( - eevee_next_metal_${render_test} - ${CMAKE_CURRENT_LIST_DIR}/eevee_next_render_tests.py - --testdir "${TEST_SRC_DIR}/render/${render_test}" - --outdir "${TEST_OUT_DIR}/eevee_next_metal" - --gpu-backend metal - ${_gpu_render_tests_arguments} - ) - endforeach() + add_render_test( + overlay_metal + ${CMAKE_CURRENT_LIST_DIR}/overlay_render_tests.py + --testdir "${TEST_SRC_DIR}/overlay" + --outdir "${TEST_OUT_DIR}/overlay" + --gpu-backend metal + ${_gpu_render_tests_arguments} + ) endif() if(WITH_VULKAN_BACKEND AND WITH_GPU_RENDER_TESTS_VULKAN) - foreach(render_test ${gpu_render_tests}) - add_render_test( - eevee_next_vulkan_${render_test} - ${CMAKE_CURRENT_LIST_DIR}/eevee_next_render_tests.py - --testdir "${TEST_SRC_DIR}/render/${render_test}" - --outdir "${TEST_OUT_DIR}/eevee_next_vulkan" - --gpu-backend vulkan - ${_gpu_render_tests_arguments} - ) - endforeach() + add_render_test( + overlay_vulkan + ${CMAKE_CURRENT_LIST_DIR}/overlay_render_tests.py + --testdir "${TEST_SRC_DIR}/overlay" + --outdir "${TEST_OUT_DIR}/overlay" + --gpu-backend vulkan + ${_gpu_render_tests_arguments} + ) endif() - - # Workbench - if(WITH_OPENGL_BACKEND) - foreach(render_test ${gpu_render_tests}) - add_render_test( - workbench_opengl_${render_test} - ${CMAKE_CURRENT_LIST_DIR}/workbench_render_tests.py - --testdir "${TEST_SRC_DIR}/render/${render_test}" - --outdir "${TEST_OUT_DIR}/workbench_opengl" - --gpu-backend opengl - ${_gpu_render_tests_arguments} - ) - endforeach() - endif() - - if(WITH_METAL_BACKEND) - foreach(render_test ${gpu_render_tests}) - add_render_test( - workbench_metal_${render_test} - ${CMAKE_CURRENT_LIST_DIR}/workbench_render_tests.py - --testdir "${TEST_SRC_DIR}/render/${render_test}" - --outdir "${TEST_OUT_DIR}/workbench_metal" - --gpu-backend metal - ${_gpu_render_tests_arguments} - ) - endforeach() - endif() - - if(WITH_VULKAN_BACKEND AND WITH_GPU_RENDER_TESTS_VULKAN) - foreach(render_test ${gpu_render_tests}) - add_render_test( - workbench_vulkan_${render_test} - ${CMAKE_CURRENT_LIST_DIR}/workbench_render_tests.py - --testdir "${TEST_SRC_DIR}/render/${render_test}" - --outdir "${TEST_OUT_DIR}/workbench/vulkan" - --gpu-backend vulkan - ${_gpu_render_tests_arguments} - ) - endforeach() - endif() - - # Overlay - if(WITH_GPU_RENDER_TESTS_HEADED) - if(WITH_OPENGL_BACKEND) - add_render_test( - overlay_opengl - ${CMAKE_CURRENT_LIST_DIR}/overlay_render_tests.py - --testdir "${TEST_SRC_DIR}/overlay" - --outdir "${TEST_OUT_DIR}/overlay" - --gpu-backend opengl - ${_gpu_render_tests_arguments} - ) - endif() - - if(WITH_METAL_BACKEND) - add_render_test( - overlay_metal - ${CMAKE_CURRENT_LIST_DIR}/overlay_render_tests.py - --testdir "${TEST_SRC_DIR}/overlay" - --outdir "${TEST_OUT_DIR}/overlay" - --gpu-backend metal - ${_gpu_render_tests_arguments} - ) - endif() - - if(WITH_VULKAN_BACKEND AND WITH_GPU_RENDER_TESTS_VULKAN) - add_render_test( - overlay_vulkan - ${CMAKE_CURRENT_LIST_DIR}/overlay_render_tests.py - --testdir "${TEST_SRC_DIR}/overlay" - --outdir "${TEST_OUT_DIR}/overlay" - --gpu-backend vulkan - ${_gpu_render_tests_arguments} - ) - endif() - endif() - - if(WITH_HYDRA) - # Hydra Storm - foreach(render_test ${gpu_render_tests}) - add_render_test( - storm_hydra_${render_test} - ${CMAKE_CURRENT_LIST_DIR}/storm_render_tests.py - --testdir "${TEST_SRC_DIR}/render/${render_test}" - --outdir "${TEST_OUT_DIR}/storm_hydra" - --export_method "HYDRA" - ${_gpu_render_tests_arguments} - ) - endforeach() - - foreach(render_test ${gpu_render_tests}) - add_render_test( - storm_usd_${render_test} - ${CMAKE_CURRENT_LIST_DIR}/storm_render_tests.py - --testdir "${TEST_SRC_DIR}/render/${render_test}" - --outdir "${TEST_OUT_DIR}/storm_usd" - --export_method "USD" - ${_gpu_render_tests_arguments} - ) - endforeach() - endif() - unset(_gpu_render_tests_arguments) endif() + + if(WITH_HYDRA) + # Hydra Storm + foreach(render_test ${gpu_render_tests}) + add_render_test( + storm_hydra_${render_test} + ${CMAKE_CURRENT_LIST_DIR}/storm_render_tests.py + --testdir "${TEST_SRC_DIR}/render/${render_test}" + --outdir "${TEST_OUT_DIR}/storm_hydra" + --export_method "HYDRA" + ${_gpu_render_tests_arguments} + ) + endforeach() + + foreach(render_test ${gpu_render_tests}) + add_render_test( + storm_usd_${render_test} + ${CMAKE_CURRENT_LIST_DIR}/storm_render_tests.py + --testdir "${TEST_SRC_DIR}/render/${render_test}" + --outdir "${TEST_OUT_DIR}/storm_usd" + --export_method "USD" + ${_gpu_render_tests_arguments} + ) + endforeach() + endif() + unset(_gpu_render_tests_arguments) endif() endif() -if(NOT OPENIMAGEIO_TOOL) - message(WARNING "Disabling Compositor tests because OIIO oiiotool does not exist") -else() +# ------------------------------------------------------------------------------ +# COMPOSITOR TESTS +# ------------------------------------------------------------------------------ + +if(TEST_SRC_DIR_EXISTS) set(compositor_tests color converter @@ -892,124 +929,123 @@ else() --testdir "${TEST_SRC_DIR}/compositor/file_output/" --outdir "${TEST_OUT_DIR}/compositor_cpu/file_output" ) - endif() -if(WITH_GPU_COMPOSITOR_TESTS) - if(NOT OPENIMAGEIO_TOOL) - message(WARNING "Disabling compositor tests because OIIO oiiotool does not exist") - else() - set(compositor_tests - color - converter - filter - input - output - vector +if(WITH_GPU_COMPOSITOR_TESTS AND TEST_SRC_DIR_EXISTS) + set(compositor_tests + color + converter + filter + input + output + vector - pixel_nodes - multiple_node_setups - ) + pixel_nodes + multiple_node_setups + ) - if(WITH_LIBMV) - list(APPEND compositor_tests distort matte) - endif() + if(WITH_LIBMV) + list(APPEND compositor_tests distort matte) + endif() - if(WITH_OPENGL_BACKEND) - foreach(comp_test ${compositor_tests}) - add_render_test( - compositor_opengl_${comp_test} - ${CMAKE_CURRENT_LIST_DIR}/compositor_render_tests.py - --testdir "${TEST_SRC_DIR}/compositor/${comp_test}" - --outdir "${TEST_OUT_DIR}/compositor_opengl" - --gpu-backend opengl - ) - endforeach() - add_blender_test( - compositor_opengl_file_output - --python ${CMAKE_CURRENT_LIST_DIR}/compositor_file_output_tests.py - -- - --testdir "${TEST_SRC_DIR}/compositor/file_output/" - --outdir "${TEST_OUT_DIR}/compositor_opengl/file_output" + if(WITH_OPENGL_BACKEND) + foreach(comp_test ${compositor_tests}) + add_render_test( + compositor_opengl_${comp_test} + ${CMAKE_CURRENT_LIST_DIR}/compositor_render_tests.py + --testdir "${TEST_SRC_DIR}/compositor/${comp_test}" + --outdir "${TEST_OUT_DIR}/compositor_opengl" --gpu-backend opengl ) - endif() - if(WITH_METAL_BACKEND) - foreach(comp_test ${compositor_tests}) - add_render_test( - compositor_metal_${comp_test} - ${CMAKE_CURRENT_LIST_DIR}/compositor_render_tests.py - --testdir "${TEST_SRC_DIR}/compositor/${comp_test}" - --outdir "${TEST_OUT_DIR}/compositor_metal" - --gpu-backend metal - ) - endforeach() - add_blender_test( - compositor_metal_file_output - --python ${CMAKE_CURRENT_LIST_DIR}/compositor_file_output_tests.py - -- - --testdir "${TEST_SRC_DIR}/compositor/file_output/" - --outdir "${TEST_OUT_DIR}/compositor_metal/file_output" + endforeach() + add_blender_test( + compositor_opengl_file_output + --python ${CMAKE_CURRENT_LIST_DIR}/compositor_file_output_tests.py + -- + --testdir "${TEST_SRC_DIR}/compositor/file_output/" + --outdir "${TEST_OUT_DIR}/compositor_opengl/file_output" + --gpu-backend opengl + ) + endif() + if(WITH_METAL_BACKEND) + foreach(comp_test ${compositor_tests}) + add_render_test( + compositor_metal_${comp_test} + ${CMAKE_CURRENT_LIST_DIR}/compositor_render_tests.py + --testdir "${TEST_SRC_DIR}/compositor/${comp_test}" + --outdir "${TEST_OUT_DIR}/compositor_metal" --gpu-backend metal ) - endif() - if(WITH_VULKAN_BACKEND) - foreach(comp_test ${compositor_tests}) - add_render_test( - compositor_vulkan_${comp_test} - ${CMAKE_CURRENT_LIST_DIR}/compositor_render_tests.py - --testdir "${TEST_SRC_DIR}/compositor/${comp_test}" - --outdir "${TEST_OUT_DIR}/compositor_vulkan" - --gpu-backend vulkan - ) - endforeach() - add_blender_test( - compositor_vulkan_file_output - --python ${CMAKE_CURRENT_LIST_DIR}/compositor_file_output_tests.py - -- - --testdir "${TEST_SRC_DIR}/compositor/file_output/" - --outdir "${TEST_OUT_DIR}/compositor_vulkan/file_output" + endforeach() + add_blender_test( + compositor_metal_file_output + --python ${CMAKE_CURRENT_LIST_DIR}/compositor_file_output_tests.py + -- + --testdir "${TEST_SRC_DIR}/compositor/file_output/" + --outdir "${TEST_OUT_DIR}/compositor_metal/file_output" + --gpu-backend metal + ) + endif() + if(WITH_VULKAN_BACKEND) + foreach(comp_test ${compositor_tests}) + add_render_test( + compositor_vulkan_${comp_test} + ${CMAKE_CURRENT_LIST_DIR}/compositor_render_tests.py + --testdir "${TEST_SRC_DIR}/compositor/${comp_test}" + --outdir "${TEST_OUT_DIR}/compositor_vulkan" --gpu-backend vulkan ) - endif() + endforeach() + add_blender_test( + compositor_vulkan_file_output + --python ${CMAKE_CURRENT_LIST_DIR}/compositor_file_output_tests.py + -- + --testdir "${TEST_SRC_DIR}/compositor/file_output/" + --outdir "${TEST_OUT_DIR}/compositor_vulkan/file_output" + --gpu-backend vulkan + ) endif() endif() -set(geo_node_tests - attributes - curve_primitives - curves - curves/interpolate_curves - foreach_geometry_element_zone - geometry - grease_pencil - instance - repeat_zone - mesh_primitives - mesh - mesh/extrude - mesh/split_edges - mesh/triangulate - points - texture - utilities - vector -) +# ------------------------------------------------------------------------------ +# GEOMETRY NODE TESTS +# ------------------------------------------------------------------------------ -if(WITH_GMP) - list(APPEND geo_node_tests mesh/boolean) -endif() +if(TEST_SRC_DIR_EXISTS) + set(geo_node_tests + attributes + curve_primitives + curves + curves/interpolate_curves + foreach_geometry_element_zone + geometry + grease_pencil + instance + repeat_zone + mesh_primitives + mesh + mesh/extrude + mesh/split_edges + mesh/triangulate + points + texture + utilities + vector + ) -if(WITH_OPENVDB) - list(APPEND geo_node_tests volume) -endif() + if(WITH_GMP) + list(APPEND geo_node_tests mesh/boolean) + endif() -if(WITH_OPENSUBDIV) - list(APPEND geo_node_tests mesh/subdivision_tests) -endif() + if(WITH_OPENVDB) + list(APPEND geo_node_tests volume) + endif() -foreach(geo_node_test ${geo_node_tests}) - if(EXISTS "${TEST_SRC_DIR}/modeling/geometry_nodes/${geo_node_test}/") + if(WITH_OPENSUBDIV) + list(APPEND geo_node_tests mesh/subdivision_tests) + endif() + + foreach(geo_node_test ${geo_node_tests}) file(GLOB files "${TEST_SRC_DIR}/modeling/geometry_nodes/${geo_node_test}/*.blend") foreach(file ${files}) get_filename_component(filename ${file} NAME_WE) @@ -1019,16 +1055,8 @@ foreach(geo_node_test ${geo_node_tests}) --python ${TEST_PYTHON_DIR}/geo_node_test.py ) endforeach() - else() - message(STATUS - "Directory named ${TEST_SRC_DIR}/modeling/geometry_nodes/${geo_node_test}/ " - "Not Found, disabling test." - ) - endif() -endforeach() + endforeach() - -if(EXISTS "${TEST_SRC_DIR}/modeling/geometry_nodes/simulation/") file(GLOB files "${TEST_SRC_DIR}/modeling/geometry_nodes/simulation/*.blend") foreach(file ${files}) get_filename_component(filename ${file} NAME_WE) @@ -1038,42 +1066,40 @@ if(EXISTS "${TEST_SRC_DIR}/modeling/geometry_nodes/simulation/") --python ${TEST_PYTHON_DIR}/geo_node_sim_test.py ) endforeach() -else() - message(STATUS - "Directory named ${TEST_SRC_DIR}/modeling/geometry_nodes/simulation/ " - "Not found, disabling tests." +endif() + +# ------------------------------------------------------------------------------ +# SCREENSHOT TESTS +# ------------------------------------------------------------------------------ + +if(WITH_GPU_RENDER_TESTS AND TEST_SRC_DIR_EXISTS) + set(render_tests ) -endif() -if(WITH_GPU_RENDER_TESTS) - if(NOT OPENIMAGEIO_TOOL) - message(STATUS "Disabling screenshot tests because OIIO oiiotool does not exist") - else() - set(render_tests - ) - - if(USE_EXPERIMENTAL_TESTS) - # The viewport tests are flakey and difficult to keep up to date for use - # in a CI environment due to constantly changing UI, but may still be helpful - # for local development. - # - # Additionally, they do not currently succeed in an ASAN build. (2025-01-29) - list(APPEND render_tests viewport) - endif() - - foreach(render_test ${render_tests}) - add_render_test( - screenshot_${render_test} - ${CMAKE_CURRENT_LIST_DIR}/ui_screenshot_tests.py - --testdir "${TEST_SRC_DIR}/screenshot/${render_test}" - --outdir "${TEST_OUT_DIR}/screenshot" - ) - endforeach() + if(USE_EXPERIMENTAL_TESTS) + # The viewport tests are flakey and difficult to keep up to date for use + # in a CI environment due to constantly changing UI, but may still be helpful + # for local development. + # + # Additionally, they do not currently succeed in an ASAN build. (2025-01-29) + list(APPEND render_tests viewport) endif() + + foreach(render_test ${render_tests}) + add_render_test( + screenshot_${render_test} + ${CMAKE_CURRENT_LIST_DIR}/ui_screenshot_tests.py + --testdir "${TEST_SRC_DIR}/screenshot/${render_test}" + --outdir "${TEST_OUT_DIR}/screenshot" + ) + endforeach() endif() +# ------------------------------------------------------------------------------ +# I/O TESTS +# ------------------------------------------------------------------------------ -if(WITH_ALEMBIC) +if(WITH_ALEMBIC AND TEST_SRC_DIR_EXISTS) find_package_wrapper(Alembic) if(NOT ALEMBIC_FOUND) message(FATAL_ERROR "Alembic is enabled but cannot be found") @@ -1097,7 +1123,7 @@ if(WITH_ALEMBIC) ) endif() -if(WITH_USD) +if(WITH_USD AND TEST_SRC_DIR_EXISTS) add_blender_test( io_usd_export --python ${CMAKE_CURRENT_LIST_DIR}/bl_usd_export_test.py @@ -1112,15 +1138,17 @@ if(WITH_USD) ) endif() -add_blender_test_io( - io_fbx_import - --python ${CMAKE_CURRENT_LIST_DIR}/io_fbx_import_test.py - -- - --testdir "${TEST_SRC_DIR}/io_tests/fbx" - --outdir "${TEST_OUT_DIR}/io_fbx" -) +if(TEST_SRC_DIR_EXISTS) + add_blender_test_io( + io_fbx_import + --python ${CMAKE_CURRENT_LIST_DIR}/io_fbx_import_test.py + -- + --testdir "${TEST_SRC_DIR}/io_tests/fbx" + --outdir "${TEST_OUT_DIR}/io_fbx" + ) +endif() -if(WITH_IO_WAVEFRONT_OBJ) +if(WITH_IO_WAVEFRONT_OBJ AND TEST_SRC_DIR_EXISTS) add_blender_test_io( io_obj_import --python ${CMAKE_CURRENT_LIST_DIR}/io_obj_import_test.py @@ -1130,7 +1158,7 @@ if(WITH_IO_WAVEFRONT_OBJ) ) endif() -if(WITH_IO_PLY) +if(WITH_IO_PLY AND TEST_SRC_DIR_EXISTS) add_blender_test_io( io_ply_import --python ${CMAKE_CURRENT_LIST_DIR}/io_ply_import_test.py @@ -1140,7 +1168,7 @@ if(WITH_IO_PLY) ) endif() -if(WITH_IO_STL) +if(WITH_IO_STL AND TEST_SRC_DIR_EXISTS) add_blender_test_io( io_stl_import --python ${CMAKE_CURRENT_LIST_DIR}/io_stl_import_test.py @@ -1150,7 +1178,7 @@ if(WITH_IO_STL) ) endif() -if(WITH_CODEC_FFMPEG) +if(WITH_CODEC_FFMPEG AND TEST_SRC_DIR_EXISTS) add_python_test( ffmpeg ${CMAKE_CURRENT_LIST_DIR}/ffmpeg_tests.py @@ -1159,9 +1187,7 @@ if(WITH_CODEC_FFMPEG) ) endif() -if(NOT OPENIMAGEIO_TOOL) - message(STATUS "Disabling ImBuf image format tests because OIIO oiiotool does not exist") -else() +if(TEST_SRC_DIR_EXISTS AND TEST_OPENIMAGEIO_TOOL_EXISTS) set(OPTIONAL_FORMATS "") if(WITH_IMAGE_CINEON) set(OPTIONAL_FORMATS "${OPTIONAL_FORMATS} CINEON") @@ -1199,10 +1225,9 @@ endif() # ------------------------------------------------------------------------------ # SEQUENCER RENDER TESTS +# ------------------------------------------------------------------------------ -if(NOT OPENIMAGEIO_TOOL) - message(STATUS "Disabling sequencer render tests because OIIO oiiotool does not exist") -else() +if(TEST_SRC_DIR_EXISTS) set(render_tests effects filter @@ -1224,36 +1249,36 @@ endif() # ------------------------------------------------------------------------------ # SCULPTING TESTS +# ------------------------------------------------------------------------------ -add_blender_test( - bl_sculpt_operators - --python ${CMAKE_CURRENT_LIST_DIR}/bl_sculpt.py - -- - --testdir "${TEST_SRC_DIR}/sculpting" -) +if(TEST_SRC_DIR_EXISTS) + add_blender_test( + bl_sculpt_operators + --python ${CMAKE_CURRENT_LIST_DIR}/bl_sculpt.py + -- + --testdir "${TEST_SRC_DIR}/sculpting" + ) +endif() -if(WITH_GPU_MESH_PAINT_TESTS) - if(NOT OPENIMAGEIO_TOOL) - message(STATUS "Disabling sculpting render tests because OIIO oiiotool does not exist") - else() - set(render_tests - brushes +if(WITH_GPU_MESH_PAINT_TESTS AND TEST_SRC_DIR_EXISTS) + set(render_tests + brushes + ) + + foreach(render_test ${render_tests}) + add_render_test( + sculpt_render_${render_test} + ${CMAKE_CURRENT_LIST_DIR}/sculpt_brush_render_tests.py + --testdir "${TEST_SRC_DIR}/sculpting/${render_test}" + --outdir "${TEST_OUT_DIR}/sculpting" ) - - foreach(render_test ${render_tests}) - add_render_test( - sculpt_render_${render_test} - ${CMAKE_CURRENT_LIST_DIR}/sculpt_brush_render_tests.py - --testdir "${TEST_SRC_DIR}/sculpting/${render_test}" - --outdir "${TEST_OUT_DIR}/sculpting" - ) - endforeach() - endif() + endforeach() endif() # ------------------------------------------------------------------------------ # Headless GUI Tests +# ------------------------------------------------------------------------------ if(WITH_UI_TESTS) # This could be generated with: @@ -1288,13 +1313,39 @@ if(WITH_UI_TESTS) endif() -add_subdirectory(collada) +# ------------------------------------------------------------------------------ +# COLLADA Tests +# ------------------------------------------------------------------------------ -# TODO: disabled for now after collection unification -# add_subdirectory(view_layer) +if(TEST_SRC_DIR_EXISTS) + function(collada_test module test_name blend_file) + add_blender_test( + bf_io_collada_${module}_${test_name} + ${TEST_SRC_DIR}/collada/${module}/${blend_file} + --python ${CMAKE_CURRENT_LIST_DIR}/${module}/test_${module}_${test_name}.py -- + --testdir ${TEST_SRC_DIR}/collada/${module} + ) + endfunction() + + # Tests are disabled because they only work on Windows + # Tests will be redone completely to work reliable + # + # collada_test(mesh simple mesh_simple.blend) + # collada_test(animation simple suzannes_parent_inverse.blend) +endif() + +# ------------------------------------------------------------------------------ +# VIEW LAYER Tests +# ------------------------------------------------------------------------------ + +if(TEST_SRC_DIR_EXISTS) + # TODO: disabled for now after collection unification + # add_subdirectory(view_layer) +endif() # ------------------------------------------------------------------------------ # Linux Release sainty checks +# ------------------------------------------------------------------------------ if(WITH_LINUX_OFFICIAL_RELEASE_TESTS) get_filename_component(release_root_folder ${TEST_BLENDER_EXE} DIRECTORY) diff --git a/tests/python/collada/CMakeLists.txt b/tests/python/collada/CMakeLists.txt deleted file mode 100644 index 595ff5f8e48..00000000000 --- a/tests/python/collada/CMakeLists.txt +++ /dev/null @@ -1,72 +0,0 @@ -# SPDX-FileCopyrightText: 2018-2023 Blender Authors -# -# SPDX-License-Identifier: GPL-2.0-or-later - -# --env-system-scripts allows to run without the install target. - -# Use '--write-blend=/tmp/test.blend' to view output - -# Some tests are interesting but take too long to run -# and don't give deterministic results -set(USE_EXPERIMENTAL_TESTS FALSE) - -set(TEST_SRC_DIR ${CMAKE_SOURCE_DIR}/tests/data) -set(TEST_OUT_DIR ${CMAKE_BINARY_DIR}/tests) - -# ugh, any better way to do this on testing only? -execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${TEST_OUT_DIR}) - -# if(NOT IS_DIRECTORY ${TEST_SRC_DIR}) -# message(FATAL_ERROR "CMake test directory not found!") -# endif() - -# all calls to blender use this -if(APPLE) - if(${CMAKE_GENERATOR} MATCHES "Xcode") - set(TEST_BLENDER_EXE_PARAMS - --background - --factory-startup - --debug-memory - --debug-exit-on-error - ) - else() - set(TEST_BLENDER_EXE_PARAMS - --background - --factory-startup - --debug-memory - --debug-exit-on-error - --env-system-scripts ${CMAKE_SOURCE_DIR}/scripts - ) - endif() -else() - set(TEST_BLENDER_EXE_PARAMS - --background - --factory-startup - --debug-memory - --debug-exit-on-error - --env-system-scripts ${CMAKE_SOURCE_DIR}/scripts - ) -endif() - -# for testing with valgrind prefix: valgrind --track-origins=yes --error-limit=no -# set(TEST_BLENDER_EXE_BARE ${TEST_BLENDER_EXE}) -# set(TEST_BLENDER_EXE ${TEST_BLENDER_EXE} ${TEST_BLENDER_EXE_PARAMS} ) - -# ------------------------------------------------------------------------------ -# GENERAL PYTHON CORRECTNESS TESTS -macro(COLLADA_TEST module test_name blend_file) - add_test( - NAME bf_io_collada_${module}_${test_name} - COMMAND "$" - ${TEST_BLENDER_EXE_PARAMS} - ${TEST_SRC_DIR}/collada/${module}/${blend_file} - --python ${CMAKE_CURRENT_LIST_DIR}/${module}/test_${module}_${test_name}.py -- - --testdir ${TEST_SRC_DIR}/collada/${module} - ) -endmacro() - -# Tests are disabled because they only work on Windows -# Tests will be redone completely to work reliable -# -# collada_test(mesh simple mesh_simple.blend) -# collada_test(animation simple suzannes_parent_inverse.blend)