From d91ac0269f49ea4f25fa3c367df002848955cd83 Mon Sep 17 00:00:00 2001 From: herbert koelman Date: Sat, 8 Jun 2019 12:33:08 +0200 Subject: [PATCH 1/9] refs #114 @1h Home: https://coveralls.io More [here](https://github.com/eddyxu/cpp-coveralls) and [here](https://docs.coveralls.io) --- .travis.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.travis.yml b/.travis.yml index 5068377..1dea9f9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,10 @@ dist: xenial language: cpp compiler: gcc +# install things for coverall.io +before_install: + - pip install --user cpp-coveralls + # Run travis on these branches only... branches: only: @@ -24,3 +28,7 @@ script: - mkdir cmake-build - cd cmake-build && cmake .. - make all test + +# create coveralls.io report +after_success: + - coveralls --exclude lib --exclude tests --gcov-options '\-lp' From 8210d627a45e43ac8889a3721227f790e7d2749b Mon Sep 17 00:00:00 2001 From: herbert koelman Date: Sat, 8 Jun 2019 13:45:15 +0200 Subject: [PATCH 2/9] refs #115 @2h - new CMake option GCOV - added compiler option --coverage - added library gcov to test porgram builds --- .travis.yml | 2 +- CMakeLists.txt | 6 ++++++ tests/CMakeLists.txt | 16 ++++++++++------ 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1dea9f9..9e1137a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,7 +26,7 @@ addons: script: - mkdir cmake-build - - cd cmake-build && cmake .. + - cd cmake-build && cmake -DGCOV=yes .. - make all test # create coveralls.io report diff --git a/CMakeLists.txt b/CMakeLists.txt index 5c65ff5..2ed3f5c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,12 @@ project( VERSION 2.2.2 DESCRIPTION "Simple C++ logger (${GIT_LOG})") +option(GCOV "Activate GCOV options") +if (GCOV AND ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")) + message(STATUS "Setting GCOV compiler options") + add_compile_options(--coverage) +endif() + #find_package(Git CONFIG) #find_package(Conan) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 25bbf92..e01fac5 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,22 +1,26 @@ # Load and compile GTest # Aliases: GTest::GTest, GTest::gtest_main, GMock::GMock +if (GCOV AND ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")) + set(GCOV_LIB gcov) +endif() + add_executable(logger_tests logger_tests.cpp) -target_link_libraries(logger_tests GTest::GTest cpp-logger-static GTest::gtest_main) +target_link_libraries(logger_tests GTest::GTest cpp-logger-static GTest::gtest_main ${GCOV_LIB}) add_executable(facility_tests facility_tests.cpp) -target_link_libraries(facility_tests GTest::GTest GMock::GMock cpp-logger-static GTest::gtest_main) +target_link_libraries(facility_tests GTest::GTest GMock::GMock cpp-logger-static GTest::gtest_main ${GCOV_LIB}) add_executable(exception_tests exception_tests.cpp) -target_link_libraries(exception_tests GTest::GTest GMock::GMock cpp-logger-static GTest::gtest_main) +target_link_libraries(exception_tests GTest::GTest GMock::GMock cpp-logger-static GTest::gtest_main ${GCOV_LIB}) add_executable(sink_tests sink_tests.cpp) -target_link_libraries(sink_tests GTest::GTest GMock::GMock cpp-logger-static GTest::gtest_main) +target_link_libraries(sink_tests GTest::GTest GMock::GMock cpp-logger-static GTest::gtest_main ${GCOV_LIB}) add_executable(logger_performance_tests logger_performance_tests.cpp) -target_link_libraries(logger_performance_tests GTest::GTest cpp-logger-static GTest::gtest_main) +target_link_libraries(logger_performance_tests GTest::GTest cpp-logger-static GTest::gtest_main ${GCOV_LIB}) add_test(NAME logger_tests COMMAND logger_tests) add_test(NAME facility_tests COMMAND facility_tests) add_test(NAME exception_tests COMMAND facility_tests) -add_test(NAME sink_tests COMMAND sink_tests) \ No newline at end of file +add_test(NAME sink_tests COMMAND sink_tests) From 0111272b04a4efa83de69d0e0a4e9cdeba3900e8 Mon Sep 17 00:00:00 2001 From: herbert koelman Date: Sat, 8 Jun 2019 14:04:11 +0200 Subject: [PATCH 3/9] refs #114 @1h - excluded googletest related directorties 4 --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9e1137a..63bd512 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,4 +31,6 @@ script: # create coveralls.io report after_success: - - coveralls --exclude lib --exclude tests --gcov-options '\-lp' + - coveralls --exclude googletest-build --exclude googletest-download --exclude googletest-src --exclude lib --exclude tests --gcov-options '\-lp' + + From 0d2a8ae650210662dd050dfba4f03f33808009cc Mon Sep 17 00:00:00 2001 From: herbert koelman Date: Sat, 8 Jun 2019 14:17:39 +0200 Subject: [PATCH 4/9] refs #114 i- removed tests exclude --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 63bd512..604b547 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,6 +31,6 @@ script: # create coveralls.io report after_success: - - coveralls --exclude googletest-build --exclude googletest-download --exclude googletest-src --exclude lib --exclude tests --gcov-options '\-lp' + - coveralls --exclude googletest-build --exclude googletest-download --exclude googletest-src --exclude lib --gcov-options '\-lp' From 4ff7fc87a3a94ae1b6bdfa685a171ea41ed4d327 Mon Sep 17 00:00:00 2001 From: herbert koelman Date: Sat, 8 Jun 2019 14:32:20 +0200 Subject: [PATCH 5/9] refs #114 - trying to let coverall find my stuff (documentation is not very good) --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 604b547..b77df6b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,6 +31,6 @@ script: # create coveralls.io report after_success: - - coveralls --exclude googletest-build --exclude googletest-download --exclude googletest-src --exclude lib --gcov-options '\-lp' + - coveralls --root CMakeFiles --exclude googletest-build --exclude googletest-download --exclude googletest-src --exclude lib --gcov-options '\-m \-lp' From 3d7f8dc1ffbcad69be160a7e76f110c942fa0dfb Mon Sep 17 00:00:00 2001 From: herbert koelman Date: Sat, 8 Jun 2019 14:55:14 +0200 Subject: [PATCH 6/9] refs #114 still no cigar --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b77df6b..3fe95e4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,6 +31,6 @@ script: # create coveralls.io report after_success: - - coveralls --root CMakeFiles --exclude googletest-build --exclude googletest-download --exclude googletest-src --exclude lib --gcov-options '\-m \-lp' + - echo "PWD: `pwd`" && coveralls --root . -E ".*gtest.*" -E ".*googletest.*" -E ".*CMakeFiles.*" From 36cd52eaafdc137f3a6d94f4f326e150ebb7272d Mon Sep 17 00:00:00 2001 From: herbert koelman Date: Sat, 8 Jun 2019 15:02:04 +0200 Subject: [PATCH 7/9] refs #114 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3fe95e4..2e0dcad 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,6 +31,6 @@ script: # create coveralls.io report after_success: - - echo "PWD: `pwd`" && coveralls --root . -E ".*gtest.*" -E ".*googletest.*" -E ".*CMakeFiles.*" + - coveralls --root . -E ".*gtest.*" -E ".*googletest.*" -E ".*CMakeFiles.*" && echo "PWD: `pwd`" From 5f8d44565fff60c8cc31abe0c3c9dc2f4e3657ef Mon Sep 17 00:00:00 2001 From: herbert koelman Date: Sat, 8 Jun 2019 15:44:21 +0200 Subject: [PATCH 8/9] refs #114 Travis is not running anymore !! I'm afraid that all this travis and coveralls things are dead !! --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2e0dcad..3c25a48 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,6 +31,7 @@ script: # create coveralls.io report after_success: - - coveralls --root . -E ".*gtest.*" -E ".*googletest.*" -E ".*CMakeFiles.*" && echo "PWD: `pwd`" + - pwd + - coveralls --root CMakeFiles/cpp-logger-static.dir/ From 7e8e7c0968aa8f6a025c5f2ed1ca09b41918d98c Mon Sep 17 00:00:00 2001 From: herbert koelman Date: Sat, 8 Jun 2019 15:52:33 +0200 Subject: [PATCH 9/9] fixes #114 #115 > **WARN** coveralls really sucks, I'm giving up and will find another provider --- .travis.yml | 1 - CMakeLists.txt | 10 +++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3c25a48..84f0bfb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,7 +31,6 @@ script: # create coveralls.io report after_success: - - pwd - coveralls --root CMakeFiles/cpp-logger-static.dir/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 2ed3f5c..5eb1a7a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,9 +10,13 @@ project( DESCRIPTION "Simple C++ logger (${GIT_LOG})") option(GCOV "Activate GCOV options") -if (GCOV AND ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")) - message(STATUS "Setting GCOV compiler options") - add_compile_options(--coverage) +if (GCOV ) + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + message(STATUS "Setting GCOV compiler options") + add_compile_options(--coverage) + else() + message(SEND_ERROR "The GCOV option is only supported when using GNU...") + endif() endif() #find_package(Git CONFIG)