Tests: run suites instead of individual test cases

Group all tests of a test suite into a single test command invocation.
This reduces the number of invocations by `ctest` by an order of
magnitude.

Since rB56aa5b0d8c6b663, `bin/tests/blender_test` was run for every
individual test. Having over a 1000 tests made testing slower than
necessary. Individual tests can still be run if desired by invocation of
`bin/tests/blender_test --gtest_filter=suitename.testname`.

NOTE: For this commit to have an immediate effect, it may be necessary
to remove the `tests` and `Testing` directories and some CMake files
from your build directory and rebuild. Run `ctest -N` to see the list of
tests; there should be less than 200.

Reviewed By: sergey, LazyDodo, sebbas

Maniphest Tasks: T83222

Differential Revision: https://developer.blender.org/D9649
This commit is contained in:
Sybren A. Stüvel
2021-01-11 11:29:30 +01:00
parent 63cea2b793
commit 54f8a5dd73
6 changed files with 82 additions and 406 deletions

View File

@@ -71,36 +71,3 @@ elseif(APPLE)
endif()
unset(_test_libs)
# This runs the blender_test executable with `--gtest_list_tests`, then
# exposes those tests individually to the ctest runner.
# See https://cmake.org/cmake/help/v3.18/module/GoogleTest.html
#
# We have our own modified copy of this CMake module.
include(GTest)
set(_GOOGLETEST_DISCOVER_TESTS_SCRIPT
${CMAKE_SOURCE_DIR}/build_files/cmake/Modules/GTestAddTests.cmake
)
if(APPLE)
set(_test_release_dir ${TEST_INSTALL_DIR}/Blender.app/Contents/Resources/${BLENDER_VERSION})
else()
if(WIN32 OR WITH_INSTALL_PORTABLE)
set(_test_release_dir ${TEST_INSTALL_DIR}/${BLENDER_VERSION})
else()
set(_test_release_dir ${TEST_INSTALL_DIR}/share/blender/${BLENDER_VERSION})
endif()
endif()
gtest_discover_tests(blender_test
WORKING_DIRECTORY "${TEST_INSTALL_DIR}"
# So that it will run after the install phase that will copy the required libraries
DISCOVERY_MODE PRE_TEST
# So that unit tests know where to find files:
EXTRA_ARGS
--test-assets-dir "${CMAKE_SOURCE_DIR}/../lib/tests"
--test-release-dir "${_test_release_dir}"
)
unset(_test_release_dir)