🔨 relaxed requirements to coverage
This commit is contained in:
parent
b21c04c938
commit
2f9095ddab
2 changed files with 8 additions and 8 deletions
2
Makefile
2
Makefile
|
@ -76,7 +76,7 @@ check-fast:
|
|||
coverage:
|
||||
rm -fr build_coverage
|
||||
mkdir build_coverage
|
||||
cd build_coverage ; CXX=$(COMPILER_DIR)/g++ cmake .. -GNinja -DJSON_Coverage=ON -DJSON_MultipleHeaders=ON
|
||||
cd build_coverage ; CXX=g++-8 cmake .. -GNinja -DJSON_Coverage=ON -DJSON_MultipleHeaders=ON
|
||||
cd build_coverage ; ninja
|
||||
cd build_coverage ; ctest -E '.*_default' -j10
|
||||
cd build_coverage ; ninja lcov_html
|
||||
|
|
|
@ -27,17 +27,17 @@ endif()
|
|||
|
||||
if(JSON_Coverage)
|
||||
message(STATUS "Building test suite with coverage information")
|
||||
if(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
message(FATAL_ERROR "JSON_Coverage requires GCC.")
|
||||
endif()
|
||||
#if(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
# message(FATAL_ERROR "JSON_Coverage requires GCC.")
|
||||
#endif()
|
||||
|
||||
# enable profiling
|
||||
set(CMAKE_CXX_FLAGS "--coverage -g -O0 -fprofile-arcs -ftest-coverage")
|
||||
|
||||
# from https://github.com/RWTH-HPC/CMake-codecov/blob/master/cmake/FindGcov.cmake
|
||||
get_filename_component(COMPILER_PATH "${CMAKE_CXX_COMPILER}" PATH)
|
||||
string(REGEX MATCH "^[0-9]+" GCC_VERSION "${CMAKE_CXX_COMPILER_VERSION}")
|
||||
find_program(GCOV_BIN NAMES gcov-${GCC_VERSION} gcov HINTS ${COMPILER_PATH})
|
||||
#get_filename_component(COMPILER_PATH "${CMAKE_CXX_COMPILER}" PATH)
|
||||
#string(REGEX MATCH "^[0-9]+" GCC_VERSION "${CMAKE_CXX_COMPILER_VERSION}")
|
||||
#find_program(GCOV_BIN NAMES gcov-${GCC_VERSION} gcov HINTS ${COMPILER_PATH})
|
||||
|
||||
# collect all source files from the chosen include dir
|
||||
file(GLOB_RECURSE SOURCE_FILES ${NLOHMANN_JSON_INCLUDE_BUILD_DIR}*.hpp)
|
||||
|
@ -45,7 +45,7 @@ if(JSON_Coverage)
|
|||
# add target to collect coverage information and generate HTML file
|
||||
# (filter script from https://stackoverflow.com/a/43726240/266378)
|
||||
add_custom_target(lcov_html
|
||||
COMMAND lcov --directory . --capture --output-file json.info --gcov-tool ${GCOV_BIN} --rc lcov_branch_coverage=1
|
||||
COMMAND lcov --directory . --capture --output-file json.info --rc lcov_branch_coverage=1
|
||||
COMMAND lcov -e json.info ${SOURCE_FILES} --output-file json.info.filtered --rc lcov_branch_coverage=1
|
||||
COMMAND ${CMAKE_SOURCE_DIR}/test/thirdparty/imapdl/filterbr.py json.info.filtered > json.info.filtered.noexcept
|
||||
COMMAND genhtml --title "JSON for Modern C++" --legend --demangle-cpp --output-directory html --show-details --branch-coverage json.info.filtered.noexcept
|
||||
|
|
Loading…
Reference in a new issue