diff --git a/.cmake/Modules/Gcov.cmake b/.cmake/Modules/Gcov.cmake new file mode 100644 index 0000000..a9e69a9 --- /dev/null +++ b/.cmake/Modules/Gcov.cmake @@ -0,0 +1,26 @@ + +if (NOT DEFINED ENV{GCOV}) + find_program(GCOV_EXECUTABLE gcov) +else() + find_program(GCOV_EXECUTABLE $ENV{GCOV}) +endif() + +#file(GLOB_RECURSE GCNO_FILES "${CMAKE_CURRENT_BINARY_DIR}/*.gcno") +if (WIN32) + file(GLOB_RECURSE GCDA_FILES "${COV_PATH}\\*.gcda") +else () + file(GLOB_RECURSE GCDA_FILES "${COV_PATH}/*.gcda") +endif () + +#execute_process( +# COMMAND ${GCOV_EXECUTABLE} -lcp ${GCNO_FILES} +# WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +#) + +foreach (GCDA ${GCDA_FILES}) + get_filename_component(DIR ${GCDA} PATH) + execute_process( + COMMAND ${GCOV_EXECUTABLE} -lcp -o ${DIR} ${GCDA} + WORKING_DIRECTORY ${COV_PATH} + ) +endforeach () diff --git a/.travis.yml b/.travis.yml index dd3282b..10e19f4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,7 +30,8 @@ script: - make criterion_tests - make test after_success: -- make coveralls +- make gcov +- bash <(curl -s https://codecov.io/bash) after_failure: - cat Testing/Temporary/LastTest.log samples/*.{out,err} ../samples/tests/*.{out,err} env: diff --git a/CMakeLists.txt b/CMakeLists.txt index fb1f647..8fead66 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -170,6 +170,13 @@ install(TARGETS criterion add_custom_target(criterion_tests) +add_custom_target(gcov + "${CMAKE_COMMAND}" + -DSOURCE_FILES="${SOURCE_FILES}" + -DCOV_PATH="${CMAKE_CURRENT_BINARY_DIR}" + -P "${CMAKE_MODULE_PATH}/Gcov.cmake" +) + enable_testing() add_subdirectory(samples) add_subdirectory(test) diff --git a/README.md b/README.md index 791881c..28f15f5 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![Unix Build Status](https://travis-ci.org/Snaipe/Criterion.svg?branch=bleeding)](https://travis-ci.org/Snaipe/Criterion) [![Windows Build Status](https://ci.appveyor.com/api/projects/status/github/Snaipe/Criterion?svg=true&branch=bleeding)](https://ci.appveyor.com/project/Snaipe/Criterion/branch/bleeding) -[![Coverage Status](https://coveralls.io/repos/Snaipe/Criterion/badge.svg?branch=bleeding)](https://coveralls.io/r/Snaipe/Criterion?branch=bleeding) +[![Coverage Status](https://img.shields.io/codecov/c/github/Snaipe/Criterion/bleeding.svg)](https://codecov.io/github/Snaipe/Criterion?branch=bleeding) [![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](https://github.com/Snaipe/Criterion/blob/master/LICENSE) [![Version](https://img.shields.io/github/tag/Snaipe/Criterion.svg?label=version&style=flat)](https://github.com/Snaipe/Criterion/releases)