From a8dee2ed90a845f6880c064a898a02fea6d08cdb Mon Sep 17 00:00:00 2001 From: Pesc0 Date: Tue, 11 Jul 2023 15:50:25 +0200 Subject: [PATCH] Allow automatic tests discovery --- .gitignore | 1 + CMakeLists.txt | 2 ++ tests/CMakeLists.txt | 12 ++++++++++++ 3 files changed, 15 insertions(+) diff --git a/.gitignore b/.gitignore index cfd22615fd..2a65e1125e 100644 --- a/.gitignore +++ b/.gitignore @@ -44,6 +44,7 @@ install_manifest.txt OpenSCAD_rc.py tags /CMakeUserPresets.json +Testing # crowdin file src/Tools/freecad.zip diff --git a/CMakeLists.txt b/CMakeLists.txt index 6e25357391..e800f9d917 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index f3b605fe99..012f4ba363 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -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) \ No newline at end of file