Allow automatic tests discovery

This commit is contained in:
Pesc0
2023-07-11 15:50:25 +02:00
committed by wwmayer
parent bf0b19c175
commit 9cf678407c
3 changed files with 15 additions and 0 deletions

1
.gitignore vendored
View File

@@ -44,6 +44,7 @@ install_manifest.txt
OpenSCAD_rc.py
tags
/CMakeUserPresets.json
Testing
# crowdin file
src/Tools/freecad.zip

View File

@@ -107,6 +107,8 @@ if(MSVC AND FREECAD_LIBPACK_USE AND LIBPACK_FOUND)
endif()
if (ENABLE_DEVELOPER_TESTS)
include(CTest)
enable_testing()
add_subdirectory(tests)
endif()

View File

@@ -77,8 +77,10 @@ add_executable(Mesh_tests_run)
add_executable(Part_tests_run)
add_executable(Points_tests_run)
add_executable(Sketcher_tests_run)
add_subdirectory(lib)
add_subdirectory(src)
target_include_directories(Tests_run PUBLIC
${Python3_INCLUDE_DIRS}
${XercesC_INCLUDE_DIRS}
@@ -89,3 +91,13 @@ target_link_libraries(Tests_run
${Google_Tests_LIBS}
FreeCADApp
)
include(GoogleTest)
# discovers tests by asking the compiled test executable to enumerate its tests
set(CMAKE_GTEST_DISCOVER_TESTS_DISCOVERY_MODE PRE_TEST)
gtest_discover_tests(Tests_run)
gtest_discover_tests(Material_tests_run)
gtest_discover_tests(Mesh_tests_run)
gtest_discover_tests(Part_tests_run)
gtest_discover_tests(Points_tests_run)
gtest_discover_tests(Sketcher_tests_run)