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

Merge branch 'develop' into feature/language

parents 24e89d4a 55da1f84
No related branches found
No related tags found
1 merge request!37Feature/language
...@@ -289,7 +289,7 @@ add_subdirectory(tests) ...@@ -289,7 +289,7 @@ add_subdirectory(tests)
enable_testing() enable_testing()
add_custom_target(run_unit_tests add_custom_target(run_unit_tests
COMMAND ${CMAKE_CTEST_COMMAND} -j ${PROCESSOR_COUNT} COMMAND ${CMAKE_CTEST_COMMAND}
DEPENDS unit_tests mpi_unit_tests DEPENDS unit_tests mpi_unit_tests
COMMENT "Executing unit tests." COMMENT "Executing unit tests."
) )
...@@ -335,6 +335,31 @@ if("${CMAKE_BUILD_TYPE}" STREQUAL "Coverage") ...@@ -335,6 +335,31 @@ if("${CMAKE_BUILD_TYPE}" STREQUAL "Coverage")
message(FATAL_ERROR "Cannot find a proper gcov tool, cannot perform coverage.") message(FATAL_ERROR "Cannot find a proper gcov tool, cannot perform coverage.")
endif() endif()
find_program(FASTCOV fastcov fastcov.py)
if (FASTCOV AND (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "9"))
add_custom_target(coverage
ALL # in coverage mode we do coverage!
# Run tests
COMMAND ${CMAKE_CTEST_COMMAND}
COMMAND ${FASTCOV} -q --gcov "${GCOV_BIN}"
--include "${PUGS_SOURCE_DIR}/src"
--exclude "${PUGS_SOURCE_DIR}/src/main.cpp"
--exclude "${PUGS_SOURCE_DIR}/src/utils/BacktraceManager.*"
--lcov -o coverage.info -n
COMMAND ${LCOV} --gcov "${GCOV_BIN}" --list coverage.info
DEPENDS unit_tests mpi_unit_tests
COMMENT "Running test coverage."
WORKING_DIRECTORY "${PUGS_BINARY_DIR}"
)
else()
add_custom_target(coverage add_custom_target(coverage
ALL # in coverage mode we do coverage! ALL # in coverage mode we do coverage!
# Cleanup previously generated profiling data # Cleanup previously generated profiling data
...@@ -343,7 +368,7 @@ if("${CMAKE_BUILD_TYPE}" STREQUAL "Coverage") ...@@ -343,7 +368,7 @@ if("${CMAKE_BUILD_TYPE}" STREQUAL "Coverage")
# This way the percentage of total lines covered will always be correct, even when not all source code files were loaded during the test(s) # This way the percentage of total lines covered will always be correct, even when not all source code files were loaded during the test(s)
COMMAND ${LCOV} -q --gcov "${GCOV_BIN}" --base-directory "${PUGS_BINARY_DIR}/src" --directory "${PUGS_BINARY_DIR}" --capture --initial --output-file coverage_base.info COMMAND ${LCOV} -q --gcov "${GCOV_BIN}" --base-directory "${PUGS_BINARY_DIR}/src" --directory "${PUGS_BINARY_DIR}" --capture --initial --output-file coverage_base.info
# Run tests # Run tests
COMMAND ${CMAKE_CTEST_COMMAND} -j ${PROCESSOR_COUNT} COMMAND ${CMAKE_CTEST_COMMAND}
# Collect data from executions # Collect data from executions
COMMAND ${LCOV} --gcov "${GCOV_BIN}" --base-directory "${PUGS_BINARY_DIR}/src" --directory "${PUGS_BINARY_DIR}" --capture --output-file coverage_ctest.info COMMAND ${LCOV} --gcov "${GCOV_BIN}" --base-directory "${PUGS_BINARY_DIR}/src" --directory "${PUGS_BINARY_DIR}" --capture --output-file coverage_ctest.info
# Combine base and ctest results # Combine base and ctest results
...@@ -354,7 +379,7 @@ if("${CMAKE_BUILD_TYPE}" STREQUAL "Coverage") ...@@ -354,7 +379,7 @@ if("${CMAKE_BUILD_TYPE}" STREQUAL "Coverage")
# Remove unwanted stuff # Remove unwanted stuff
COMMAND ${LCOV} --gcov "${GCOV_BIN}" --remove coverage_extract.info --output-file coverage.info COMMAND ${LCOV} --gcov "${GCOV_BIN}" --remove coverage_extract.info --output-file coverage.info
'${PUGS_SOURCE_DIR}/src/main.cpp' '${PUGS_SOURCE_DIR}/src/main.cpp'
'${PUGS_SOURCE_DIR}/utils/BacktraceManager.*' '${PUGS_SOURCE_DIR}/src/utils/BacktraceManager.*'
COMMAND ${LCOV} --gcov "${GCOV_BIN}" --list coverage.info COMMAND ${LCOV} --gcov "${GCOV_BIN}" --list coverage.info
...@@ -362,6 +387,7 @@ if("${CMAKE_BUILD_TYPE}" STREQUAL "Coverage") ...@@ -362,6 +387,7 @@ if("${CMAKE_BUILD_TYPE}" STREQUAL "Coverage")
COMMENT "Running test coverage." COMMENT "Running test coverage."
WORKING_DIRECTORY "${PUGS_BINARY_DIR}" WORKING_DIRECTORY "${PUGS_BINARY_DIR}"
) )
endif()
find_program(GENHTML genhtml) find_program(GENHTML genhtml)
if(NOT GENHTML) if(NOT GENHTML)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment