Skip to content
This repository has been archived by the owner on Apr 17, 2019. It is now read-only.

Fix coverage generation on macOS #2153

Merged
merged 2 commits into from Mar 22, 2019
Merged

Fix coverage generation on macOS #2153

merged 2 commits into from Mar 22, 2019

Conversation

neewy
Copy link
Contributor

@neewy neewy commented Mar 7, 2019

Description of the Change

Now СMake scripts delete from coverage report:

  • tests
  • Xcode libraries
  • build and external files

Benefits

More precise coverage data

Possible Drawbacks

None

Usage Examples or Tests [optional]

cmake -H. -Bbuild -DCOVERAGE=ON;
cmake --build build -- -j8;
cmake --build build --target coverage.init.info;
cd build;
ctest .;
cd ..;
cmake --build build --target coverage.info;
genhtml ./build/reports/coverage.info --output-directory out

Alternate Designs [optional]

Signed-off-by: Nikolay Yushkevich <n.yushkevich@hotmail.com>
@neewy neewy changed the base branch from master to develop March 7, 2019 13:10
@neewy
Copy link
Contributor Author

neewy commented Mar 11, 2019

Tested on macOS Mojave and Ubuntu 16.04 (report available here https://0x0.st/zH3p.gz) @lebdron

@neewy neewy requested review from MBoldyrev and removed request for igor-egorov March 11, 2019 09:56
Copy link
Contributor

@lebdron lebdron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check the suggestion. ${CMAKE_SOURCE_DIR}/build/* is definitely not portable, because any other name for build directory can be specified.

CMakeLists.txt Outdated
@@ -60,7 +60,7 @@ if(COVERAGE)
add_custom_target(coverage.info
COMMAND ${LCOV_PROGRAM} --config-file ${LCOV_CONFIG_FILE} -o ${PROJECT_BINARY_DIR}/reports/coverage.info -c -d ${PROJECT_BINARY_DIR}
COMMAND ${LCOV_PROGRAM} --config-file ${LCOV_CONFIG_FILE} -o ${PROJECT_BINARY_DIR}/reports/coverage.info -a ${PROJECT_BINARY_DIR}/reports/coverage.init.info -a ${PROJECT_BINARY_DIR}/reports/coverage.info
COMMAND ${LCOV_PROGRAM} --config-file ${LCOV_CONFIG_FILE} -o ${PROJECT_BINARY_DIR}/reports/coverage.info -r ${PROJECT_BINARY_DIR}/reports/coverage.info '/usr*' '${CMAKE_SOURCE_DIR}/external/*' '${CMAKE_SOURCE_DIR}/schema/*'
COMMAND ${LCOV_PROGRAM} --config-file ${LCOV_CONFIG_FILE} -o ${PROJECT_BINARY_DIR}/reports/coverage.info -r ${PROJECT_BINARY_DIR}/reports/coverage.info '/usr*' '/Library/Developer/CommandLineTools/*' '${CMAKE_SOURCE_DIR}/build/*' '${CMAKE_SOURCE_DIR}/external/*' '${CMAKE_SOURCE_DIR}/test/*' '${CMAKE_SOURCE_DIR}/schema/*'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/hyperledger/iroha/blob/f6888739cb7f7ffc9416daacdb36a4822195df83/cmake/dependencies.cmake#L5
https://github.com/hyperledger/iroha/blob/4e9fac8b79e0ddfb72c1e12b05b6331660f7e261/shared_model/CMakeLists.txt#L36

Suggested change
COMMAND ${LCOV_PROGRAM} --config-file ${LCOV_CONFIG_FILE} -o ${PROJECT_BINARY_DIR}/reports/coverage.info -r ${PROJECT_BINARY_DIR}/reports/coverage.info '/usr*' '/Library/Developer/CommandLineTools/*' '${CMAKE_SOURCE_DIR}/build/*' '${CMAKE_SOURCE_DIR}/external/*' '${CMAKE_SOURCE_DIR}/test/*' '${CMAKE_SOURCE_DIR}/schema/*'
COMMAND ${LCOV_PROGRAM} --config-file ${LCOV_CONFIG_FILE} -o ${PROJECT_BINARY_DIR}/reports/coverage.info -r ${PROJECT_BINARY_DIR}/reports/coverage.info '/usr*' '/Library/Developer/CommandLineTools/*' '${PROJECT_BINARY_DIR}/*' '${CMAKE_BINARY_DIR}/*' '${CMAKE_SOURCE_DIR}/test/*'

Signed-off-by: Nikolay Yushkevich <n.yushkevich@hotmail.com>
@neewy neewy requested a review from lebdron March 14, 2019 15:51
@neewy neewy merged commit 002bd98 into develop Mar 22, 2019
@neewy neewy deleted the fix/coverage-count branch March 22, 2019 06:58
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants