🔨 working on #953

This commit is contained in:
Niels Lohmann 2018-02-09 21:30:15 +01:00
parent 83db7876c5
commit 0111f3187e
No known key found for this signature in database
GPG key ID: 7F3CEA63AE251B69
3 changed files with 7 additions and 4 deletions

View file

@ -99,10 +99,10 @@ matrix:
before_script: before_script:
- pip install --user cpp-coveralls - pip install --user cpp-coveralls
after_success: after_success:
- coveralls --build-root test --include single_header/nlohmann --gcov 'gcov-4.9' --gcov-options '\-lp' - coveralls --build-root test --include include/nlohmann --gcov 'gcov-4.9' --gcov-options '\-lp'
env: env:
- COMPILER=g++-4.9 - COMPILER=g++-4.9
- CMAKE_OPTIONS=-DJSON_Coverage=ON - CMAKE_OPTIONS=-DJSON_Coverage=ON -DJSON_MultipleHeader=ON
# Coverity (only for branch coverity_scan) # Coverity (only for branch coverity_scan)

View file

@ -81,7 +81,7 @@ clean:
coverage: coverage:
mkdir build_coverage mkdir build_coverage
cd build_coverage ; CXX=g++-5 cmake .. -GNinja -DJSON_Coverage=ON cd build_coverage ; CXX=g++-5 cmake .. -GNinja -DJSON_Coverage=ON -DJSON_MultipleHeaders=ON
cd build_coverage ; ninja cd build_coverage ; ninja
cd build_coverage ; ctest -j10 cd build_coverage ; ctest -j10
cd build_coverage ; ninja lcov_html cd build_coverage ; ninja lcov_html

View file

@ -40,11 +40,14 @@ if(JSON_Coverage)
string(REGEX MATCH "^[0-9]+" GCC_VERSION "${CMAKE_CXX_COMPILER_VERSION}") string(REGEX MATCH "^[0-9]+" GCC_VERSION "${CMAKE_CXX_COMPILER_VERSION}")
find_program(GCOV_BIN NAMES gcov-${GCC_VERSION} gcov HINTS ${COMPILER_PATH}) 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)
# add target to collect coverage information and generate HTML file # add target to collect coverage information and generate HTML file
# (filter script from https://stackoverflow.com/a/43726240/266378) # (filter script from https://stackoverflow.com/a/43726240/266378)
add_custom_target(lcov_html 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 --gcov-tool ${GCOV_BIN} --rc lcov_branch_coverage=1
COMMAND lcov -e json.info ${CMAKE_SOURCE_DIR}/single_include/nlohmann/json.hpp --output-file json.info.filtered --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 ${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 COMMAND genhtml --title "JSON for Modern C++" --legend --demangle-cpp --output-directory html --show-details --branch-coverage json.info.filtered.noexcept
COMMENT "Generating HTML report test/html/index.html" COMMENT "Generating HTML report test/html/index.html"