2016-07-25 22:09:58 +00:00
|
|
|
# test suite
|
|
|
|
|
2016-07-25 19:37:48 +00:00
|
|
|
include_directories(
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}
|
2016-08-01 03:52:12 +00:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}
|
|
|
|
${CAIRO_INCLUDE_DIRS})
|
2016-07-25 19:37:48 +00:00
|
|
|
|
|
|
|
set(testsuite_SOURCES
|
|
|
|
harness.cpp
|
|
|
|
request/line_segment/test.cpp)
|
|
|
|
|
|
|
|
add_executable(solvespace_testsuite
|
|
|
|
${testsuite_SOURCES})
|
|
|
|
|
|
|
|
target_link_libraries(solvespace_testsuite
|
2016-07-25 22:09:58 +00:00
|
|
|
solvespace_headless
|
|
|
|
${COVERAGE_LIBRARY})
|
2016-07-25 19:37:48 +00:00
|
|
|
|
|
|
|
add_custom_target(solvespace-test ALL
|
|
|
|
COMMAND $<TARGET_FILE:solvespace_testsuite>
|
|
|
|
COMMENT "Testing SolveSpace"
|
|
|
|
VERBATIM)
|
2016-07-25 22:09:58 +00:00
|
|
|
|
|
|
|
# coverage reports
|
|
|
|
|
|
|
|
if(ENABLE_COVERAGE)
|
|
|
|
set(LCOV_FLAGS -q --rc lcov_branch_coverage=1 --rc lcov_excl_line=ssassert)
|
2016-08-01 05:33:09 +00:00
|
|
|
set(LCOV_FLAGS ${LCOV_FLAGS} --gcov-tool ${GCOV})
|
2016-07-25 22:09:58 +00:00
|
|
|
set(LCOV_COLLECT -c -b ${CMAKE_SOURCE_DIR}/src -d ${CMAKE_BINARY_DIR}/src --no-external)
|
|
|
|
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/coverage_base.info
|
|
|
|
COMMAND ${LCOV} ${LCOV_FLAGS} ${LCOV_COLLECT}
|
|
|
|
-o ${CMAKE_BINARY_DIR}/coverage_base.info -i
|
|
|
|
DEPENDS solvespace_testsuite
|
|
|
|
COMMENT "Importing baseline coverage data"
|
|
|
|
VERBATIM)
|
|
|
|
|
|
|
|
add_custom_target(solvespace-coverage ALL
|
|
|
|
COMMAND ${LCOV} ${LCOV_FLAGS} ${LCOV_COLLECT}
|
|
|
|
-o ${CMAKE_BINARY_DIR}/coverage_test.info
|
|
|
|
COMMAND ${LCOV} ${LCOV_FLAGS}
|
|
|
|
-o ${CMAKE_BINARY_DIR}/coverage_full.info
|
|
|
|
-a ${CMAKE_BINARY_DIR}/coverage_base.info
|
|
|
|
-a ${CMAKE_BINARY_DIR}/coverage_test.info
|
|
|
|
COMMAND ${LCOV} ${LCOV_FLAGS} --summary
|
|
|
|
${CMAKE_BINARY_DIR}/coverage_full.info
|
|
|
|
COMMAND ${GENHTML} -q --branch-coverage --demangle-cpp --legend
|
|
|
|
${CMAKE_BINARY_DIR}/coverage_full.info
|
|
|
|
-o ${CMAKE_BINARY_DIR}/coverage/
|
|
|
|
-t "SolveSpace testbench"
|
|
|
|
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/coverage_base.info
|
|
|
|
DEPENDS solvespace-test
|
|
|
|
COMMENT "Generating coverage report"
|
|
|
|
VERBATIM)
|
|
|
|
endif()
|