Skip to content

Commit

Permalink
Merge branch 'feature/coverage_multi' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
nlohmann committed Feb 9, 2018
2 parents 83db787 + 74675dd commit 2dda87c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ matrix:
before_script:
- pip install --user cpp-coveralls
after_success:
- coveralls --build-root test --include single_header/nlohmann --gcov 'gcov-4.9' --gcov-options '\-lp'
- coveralls --build-root test --include single_include/nlohmann --gcov 'gcov-4.9' --gcov-options '\-lp'
env:
- COMPILER=g++-4.9
- CMAKE_OPTIONS=-DJSON_Coverage=ON
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ clean:

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 ; ctest -j10
cd build_coverage ; ninja lcov_html
Expand Down
5 changes: 4 additions & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,14 @@ if(JSON_Coverage)
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)

# 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 -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 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"
Expand Down

0 comments on commit 2dda87c

Please sign in to comment.