[Bf-blender-cvs] [4764362ebb9] master: Fix GTests failing on Windows buildbot

Brecht Van Lommel noreply at git.blender.org
Sat Sep 7 23:06:43 CEST 2019


Commit: 4764362ebb9184eef03a3e7d77234ed973f9c43f
Author: Brecht Van Lommel
Date:   Sat Sep 7 22:48:21 2019 +0200
Branches: master
https://developer.blender.org/rB4764362ebb9184eef03a3e7d77234ed973f9c43f

Fix GTests failing on Windows buildbot

Run these tests from the install directory so they can find dlls.

===================================================================

M	build_files/cmake/Modules/GTestTesting.cmake
M	tests/CMakeLists.txt
M	tests/python/CMakeLists.txt

===================================================================

diff --git a/build_files/cmake/Modules/GTestTesting.cmake b/build_files/cmake/Modules/GTestTesting.cmake
index 091220bb0e4..1c98a6456b8 100644
--- a/build_files/cmake/Modules/GTestTesting.cmake
+++ b/build_files/cmake/Modules/GTestTesting.cmake
@@ -53,7 +53,7 @@ macro(BLENDER_SRC_GTEST_EX NAME SRC EXTRA_LIBS DO_ADD_TEST)
                           RUNTIME_OUTPUT_DIRECTORY_RELEASE "${TESTS_OUTPUT_DIR}"
                           RUNTIME_OUTPUT_DIRECTORY_DEBUG   "${TESTS_OUTPUT_DIR}")
     if(${DO_ADD_TEST})
-      add_test(NAME ${TARGET_NAME} COMMAND ${TESTS_OUTPUT_DIR}/${TARGET_NAME} WORKING_DIRECTORY $<TARGET_FILE_DIR:blender>)
+      add_test(NAME ${TARGET_NAME} COMMAND ${TESTS_OUTPUT_DIR}/${TARGET_NAME} WORKING_DIRECTORY ${TEST_INSTALL_DIR})
 
       # Don't fail tests on leaks since these often happen in external libraries
       # that we can't fix.
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 93bebaed4b2..7d8a1390628 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -1,4 +1,33 @@
 
+# Always run tests from install path, so all required scripts and libraries
+# are available and we are testing the actual installation layout.
+#
+# Getting the install path of the executable is somewhat involved, as there are
+# no direct CMake generator expressions to get the install paths of executables.
+if(GENERATOR_IS_MULTI_CONFIG)
+  string(REPLACE "\${BUILD_TYPE}" "$<CONFIG>" TEST_INSTALL_DIR ${CMAKE_INSTALL_PREFIX})
+else()
+  string(REPLACE "\${BUILD_TYPE}" "" TEST_INSTALL_DIR ${CMAKE_INSTALL_PREFIX})
+endif()
+
+# Path to Blender and Python executables for all platforms.
+if(MSVC)
+  set(TEST_BLENDER_EXE ${TEST_INSTALL_DIR}/blender.exe)
+  set(TEST_PYTHON_EXE "${TEST_INSTALL_DIR}/${BLENDER_VERSION_MAJOR}.${BLENDER_VERSION_MINOR}/python/bin/python$<$<CONFIG:Debug>:_d>")
+elseif(APPLE)
+  set(TEST_BLENDER_EXE ${TEST_INSTALL_DIR}/Blender.app/Contents/MacOS/Blender)
+  set(TEST_PYTHON_EXE)
+else()
+  set(TEST_BLENDER_EXE ${TEST_INSTALL_DIR}/blender)
+  set(TEST_PYTHON_EXE)
+endif()
+
+# For testing with Valgrind
+# set(TEST_BLENDER_EXE valgrind --track-origins=yes --error-limit=no ${TEST_BLENDER_EXE})
+
+# Standard Blender arguments for running tests.
+set(TEST_BLENDER_EXE_PARAMS --background -noaudio --factory-startup)
+
 # Python CTests
 if(WITH_BLENDER AND WITH_PYTHON)
   add_subdirectory(python)
diff --git a/tests/python/CMakeLists.txt b/tests/python/CMakeLists.txt
index 28029430673..2c9f91cca8e 100644
--- a/tests/python/CMakeLists.txt
+++ b/tests/python/CMakeLists.txt
@@ -32,34 +32,6 @@ file(MAKE_DIRECTORY ${TEST_OUT_DIR}/io_tests)
 #~      message(FATAL_ERROR "CMake test directory not found!")
 #~  endif()
 
-# Blender arguments for tests.
-set(TEST_BLENDER_EXE_PARAMS --background -noaudio --factory-startup)
-
-# Always run tests from install path, so all required scripts and libraries
-# are available and we are testing the actual installation layout.
-#
-# Getting the install path of the executable is somewhat involved, as there are
-# no direct CMake generator expressions to get the install paths of executables.
-if(GENERATOR_IS_MULTI_CONFIG)
-  string(REPLACE "\${BUILD_TYPE}" "$<CONFIG>" TEST_INSTALL_DIR ${CMAKE_INSTALL_PREFIX})
-else()
-  string(REPLACE "\${BUILD_TYPE}" "" TEST_INSTALL_DIR ${CMAKE_INSTALL_PREFIX})
-endif()
-
-if(MSVC)
-  set(TEST_BLENDER_EXE ${TEST_INSTALL_DIR}/blender.exe)
-  set(TEST_PYTHON_EXE "${TEST_INSTALL_DIR}/${BLENDER_VERSION_MAJOR}.${BLENDER_VERSION_MINOR}/python/bin/python$<$<CONFIG:Debug>:_d>")
-elseif(APPLE)
-  set(TEST_BLENDER_EXE ${TEST_INSTALL_DIR}/Blender.app/Contents/MacOS/Blender)
-  set(TEST_PYTHON_EXE)
-else()
-  set(TEST_BLENDER_EXE ${TEST_INSTALL_DIR}/blender)
-  set(TEST_PYTHON_EXE)
-endif()
-
-# For testing with Valgrind
-# set(TEST_BLENDER_EXE valgrind --track-origins=yes --error-limit=no ${TEST_BLENDER_EXE})
-
 # Run Blender command with parameters.
 function(add_blender_test testname)
   add_test(



More information about the Bf-blender-cvs mailing list