[Cycles/MSVC/Testing] Fix broken test code.
[blender.git] / tests / python / CMakeLists.txt
index a29b612e0efb56b7876eaf76a9fc26ea5e9b6304..4b5666e9b5a5c5a3fce42d1fea0fcd2f8f5c20d5 100644 (file)
@@ -399,24 +399,28 @@ endif()
 
 if(WITH_CYCLES)
        if(OPENIMAGEIO_IDIFF AND EXISTS "${TEST_SRC_DIR}/cycles/ctests/shader")
-               add_test(cycles_reports_test
-                       ${CMAKE_CURRENT_LIST_DIR}/cycles_render_tests.py
-                       -blender "${TEST_BLENDER_EXE_BARE}"
-                       -testdir "${TEST_SRC_DIR}/cycles/ctests/reports"
-                       -idiff "${OPENIMAGEIO_IDIFF}"
-               )
-               add_test(cycles_render_test
-                       ${CMAKE_CURRENT_LIST_DIR}/cycles_render_tests.py
-                       -blender "${TEST_BLENDER_EXE_BARE}"
-                       -testdir "${TEST_SRC_DIR}/cycles/ctests/render"
-                       -idiff "${OPENIMAGEIO_IDIFF}"
-               )
-               add_test(cycles_shaders_test
-                       ${CMAKE_CURRENT_LIST_DIR}/cycles_render_tests.py
-                       -blender "${TEST_BLENDER_EXE_BARE}"
-                       -testdir "${TEST_SRC_DIR}/cycles/ctests/shader"
-                       -idiff "${OPENIMAGEIO_IDIFF}"
-               )
+               macro(add_cycles_render_test subject)
+                       if(MSVC)
+                               add_test(NAME cycles_${subject}_test
+                                       COMMAND
+                                               "$<TARGET_FILE_DIR:blender>/${BLENDER_VERSION_MAJOR}.${BLENDER_VERSION_MINOR}/python/bin/python$<$<CONFIG:Debug>:_d>"
+                                               ${CMAKE_CURRENT_LIST_DIR}/cycles_render_tests.py
+                                       -blender "$<TARGET_FILE:blender>"
+                                       -testdir "${TEST_SRC_DIR}/cycles/ctests/${subject}"
+                                       -idiff "${OPENIMAGEIO_IDIFF}"
+                               )
+                       else()
+                               add_test(cycles_${subject}_test
+                                        ${CMAKE_CURRENT_LIST_DIR}/cycles_render_tests.py
+                                       -blender "${TEST_BLENDER_EXE_BARE}"
+                                       -testdir "${TEST_SRC_DIR}/cycles/ctests/${subject}"
+                                       -idiff "${OPENIMAGEIO_IDIFF}"
+                               )
+                       endif()
+               endmacro()      
+               add_cycles_render_test(reports)
+               add_cycles_render_test(render)
+               add_cycles_render_test(shader)
        else()
                MESSAGE(STATUS "Disabling Cycles tests because tests folder does not exist")
        endif()