diff options
author | Julian Eisel <julian@blender.org> | 2020-06-05 14:09:31 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2020-06-05 14:09:31 +0300 |
commit | 920a58d9b6d667894cf166cbbd25e4c2fbd238ea (patch) | |
tree | 7ca5a9da640753b5e070c439ac3bdd14dfad92cf /tests/CMakeLists.txt | |
parent | c94b6209861ca7cc3985b53474feed7d94c0221a (diff) | |
parent | a1d55bdd530390e58c51abe9707b8d3b0ae3e861 (diff) |
Merge branch 'master' into wm-drag-drop-rewritewm-drag-drop-rewrite
Diffstat (limited to 'tests/CMakeLists.txt')
-rw-r--r-- | tests/CMakeLists.txt | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 94b6e49181c..0ee3b500fdf 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -14,20 +14,37 @@ 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>") + set(_default_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) + set(_default_test_python_exe ${PYTHON_EXECUTABLE}) else() - set(TEST_BLENDER_EXE ${TEST_INSTALL_DIR}/blender) - set(TEST_PYTHON_EXE) + if(WITH_INSTALL_PORTABLE) + set(TEST_BLENDER_EXE ${TEST_INSTALL_DIR}/blender) + else() + set(TEST_BLENDER_EXE ${TEST_INSTALL_DIR}/bin/blender) + endif() + set(_default_test_python_exe ${PYTHON_EXECUTABLE}) endif() +# The installation directory's Python is the best one to use. However, it can only be there after the install step, +# which means that Python will never be there on a fresh system. To suit different needs, the user can pass +# -DTEST_PYTHON_EXE=/path/to/python to CMake. +if (NOT TEST_PYTHON_EXE) + set(TEST_PYTHON_EXE ${_default_test_python_exe}) + message(STATUS "Tests: Using Python executable: ${TEST_PYTHON_EXE}") +elseif(NOT EXISTS ${TEST_PYTHON_EXE}) + message(FATAL_ERROR "Tests: TEST_PYTHON_EXE ${TEST_PYTHON_EXE} does not exist") +endif() +unset(_default_test_python_exe) + + # 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) +# Specify exit code so that if a Python script error happens, the test fails. +set(TEST_BLENDER_EXE_PARAMS --background -noaudio --factory-startup --python-exit-code 1) # Python CTests if(WITH_BLENDER AND WITH_PYTHON) |