refactor: rm unneed macro to flatten code coverage logic
This commit is contained in:
committed by
Chris Rizzitello
parent
922ad66aff
commit
c8e1e4f38f
@ -30,7 +30,32 @@ macro(configure_libs)
|
||||
configure_openssl()
|
||||
|
||||
option(ENABLE_COVERAGE "Enable test coverage" OFF)
|
||||
configure_coverage()
|
||||
if(ENABLE_COVERAGE)
|
||||
message(STATUS "Enabling code coverage")
|
||||
include(cmake/CodeCoverage.cmake)
|
||||
append_coverage_compiler_flags()
|
||||
set(test_exclude subprojects/* build/* src/test/*)
|
||||
set(test_src ${PROJECT_SOURCE_DIR}/src)
|
||||
|
||||
# Apparently solves the bug in gcov where it returns negative counts and confuses gcovr.
|
||||
# > Got negative hit value in gcov line 'branch 2 taken -1' caused by a bug in gcov tool
|
||||
# Bug report: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68080
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-update=atomic")
|
||||
|
||||
setup_target_for_coverage_gcovr_xml(
|
||||
NAME coverage-integtests
|
||||
EXECUTABLE integtests
|
||||
BASE_DIRECTORY ${test_src}
|
||||
EXCLUDE ${test_exclude}
|
||||
)
|
||||
|
||||
setup_target_for_coverage_gcovr_xml(
|
||||
NAME coverage-unittests
|
||||
EXECUTABLE unittests
|
||||
BASE_DIRECTORY ${test_src}
|
||||
EXCLUDE ${test_exclude}
|
||||
)
|
||||
endif()
|
||||
|
||||
endmacro()
|
||||
|
||||
@ -372,42 +397,3 @@ macro(configure_openssl)
|
||||
endif()
|
||||
|
||||
endmacro()
|
||||
|
||||
macro(configure_coverage)
|
||||
|
||||
if(ENABLE_COVERAGE)
|
||||
message(STATUS "Enabling code coverage")
|
||||
include(cmake/CodeCoverage.cmake)
|
||||
append_coverage_compiler_flags()
|
||||
set(test_exclude subprojects/* build/* src/test/*)
|
||||
set(test_src ${PROJECT_SOURCE_DIR}/src)
|
||||
|
||||
# Apparently solves the bug in gcov where it returns negative counts and confuses gcovr.
|
||||
# > Got negative hit value in gcov line 'branch 2 taken -1' caused by a bug in gcov tool
|
||||
# Bug report: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68080
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-update=atomic")
|
||||
|
||||
setup_target_for_coverage_gcovr_xml(
|
||||
NAME
|
||||
coverage-integtests
|
||||
EXECUTABLE
|
||||
integtests
|
||||
BASE_DIRECTORY
|
||||
${test_src}
|
||||
EXCLUDE
|
||||
${test_exclude})
|
||||
|
||||
setup_target_for_coverage_gcovr_xml(
|
||||
NAME
|
||||
coverage-unittests
|
||||
EXECUTABLE
|
||||
unittests
|
||||
BASE_DIRECTORY
|
||||
${test_src}
|
||||
EXCLUDE
|
||||
${test_exclude})
|
||||
|
||||
else()
|
||||
message(STATUS "Code coverage is disabled")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
Reference in New Issue
Block a user