| … | … | @@ -106,14 +106,6 @@ ELSE (JSONCPP_FOUND) |
| 106 | 106 | ENDIF (JSONCPP_FOUND) |
| 107 | 107 | |
| 108 | 108 | |
| 109 | | # ---------------------------------------------------------- |
| 110 | | # Needed for unit tests |
| 111 | | |
| 112 | | FIND_PACKAGE(Cxxtest) |
| 113 | | IF (NOT CXXTEST_FOUND) |
| 114 | | MESSAGE(STATUS "CxxTest missing: needed for unit tests.") |
| 115 | | ENDIF (NOT CXXTEST_FOUND) |
| 116 | | |
| 117 | 109 | # ---------------------------------------------------------- |
| 118 | 110 | # Guile Python and Cython |
| 119 | 111 | |
| … | … | @@ -161,36 +153,10 @@ ADD_CUSTOM_TARGET(examples |
| 161 | 153 | COMMENT "Building examples" |
| 162 | 154 | ) |
| 163 | 155 | |
| 164 | | IF (CXXTEST_FOUND) |
| 165 | | ENABLE_TESTING() |
| 166 | | ADD_CUSTOM_TARGET(tests) |
| 167 | | ADD_SUBDIRECTORY(tests EXCLUDE_FROM_ALL) |
| 168 | | IF (CMAKE_BUILD_TYPE STREQUAL "Coverage") |
| 169 | | # doing coverage stuff while running tests if this is the Coverage build |
| 170 | | ADD_CUSTOM_TARGET(check |
| 171 | | # TODO lcov should be found by cmake first |
| 172 | | # TODO set it up so that we can pick to run coverage per test, or |
| 173 | | # combined across all tests (the latter is MUCH faster). Use a define? |
| 174 | | # There is coverage specific stuff in AddCxxTest.cmake now... |
| 175 | | WORKING_DIRECTORY tests |
| 176 | | COMMAND ${CMAKE_CTEST_COMMAND} --force-new-ctest-process --output-on-failure $(ARGS) |
| 177 | | |
| 178 | | # This script combines the coverage analysis of each test, |
| 179 | | # then creates html in tests/lcov |
| 180 | | # Note: this should now be run separately... |
| 181 | | #COMMAND ${PROJECT_SOURCE_DIR}/scripts/combine_lcov.sh |
| 182 | | COMMENT "Running tests with coverage..." |
| 183 | | ) |
| 184 | | ELSE (CMAKE_BUILD_TYPE STREQUAL "Coverage") |
| 185 | | # If this is a build with coverage enabled then test normally |
| 186 | | ADD_CUSTOM_TARGET(check |
| 187 | | DEPENDS tests |
| 188 | | WORKING_DIRECTORY tests |
| 189 | | COMMAND ${CMAKE_CTEST_COMMAND} --force-new-ctest-process --output-on-failure $(ARGS) |
| 190 | | COMMENT "Running tests..." |
| 191 | | ) |
| 192 | | ENDIF (CMAKE_BUILD_TYPE STREQUAL "Coverage") |
| 193 | | ENDIF (CXXTEST_FOUND) |
| 156 | # ---------------------------------------------------------- |
| 157 | # Unit tests |
| 158 | INCLUDE(OpenCogTestOptions) |
| 159 | OPENCOG_SETUP_TESTING() |
| 194 | 160 | |
| 195 | 161 | ADD_CUSTOM_TARGET(cscope |
| 196 | 162 | COMMAND find opencog examples tests -name '*.cc' -o -name '*.h' -o -name '*.cxxtest' -o -name '*.scm' > ${CMAKE_SOURCE_DIR}/cscope.files |