Skip to content
Snippets Groups Projects
Commit 620f24fc authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Fixed tests running for coverage and added llvm support

parent d11d637e
No related branches found
No related tags found
No related merge requests found
......@@ -151,13 +151,24 @@ if("${CMAKE_BUILD_TYPE}" STREQUAL "Coverage")
message(FATAL_ERROR "gcovr not found, cannot perform coverage.")
endif()
set(GCOVR_OPTIONS --object-directory="${PASTIS_BINARY_DIR}" -r "${PASTIS_SOURCE_DIR}/src" -e "${PASTIS_SOURCE_DIR}/src/experimental" -e "${PASTIS_SOURCE_DIR}/src/main.cpp")
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
string(REPLACE "clang++" "llvm-cov" LLVM_COV "${CMAKE_CXX_COMPILER}")
if(NOT EXISTS "${LLVM_COV}")
message(FATAL_ERROR "could not find ${LLVM_COV}, cannot perform coverage (using g++ for coverage is recommended).")
endif()
set(GCOVR_EXTRA "--gcov-executable=${LLVM_COV} gcov")
endif()
set(GCOVR_OPTIONS --object-directory="${PASTIS_BINARY_DIR}" -r "${PASTIS_SOURCE_DIR}/src" -e "${PASTIS_SOURCE_DIR}/src/experimental" -e "${PASTIS_SOURCE_DIR}/src/main.cpp" ${GCOVR_EXTRA})
add_custom_target(coverage
ALL
# COMMAND ${unit_test_EXECUTABLE}
COMMAND ctest -j ${PROCESSOR_COUNT}
COMMAND ${GCOVR} ${GCOVR_OPTIONS}
DEPENDS unit_tests pastis
COMMENT "Running gcovr to build coverage report."
USES_TERMINAL
)
add_custom_target(coverage-report
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment