From 10b89a2594e5eb83de0b05b424b2bc9797bbc223 Mon Sep 17 00:00:00 2001 From: jgoppert Date: Thu, 12 Nov 2015 00:18:18 -0500 Subject: [PATCH] Switching coverage upload mechanism. --- .gitmodules | 3 --- .travis.yml | 12 ++++++------ CMakeLists.txt | 38 ++++++++++---------------------------- cmake/coveralls-cmake | 1 - test/CMakeLists.txt | 5 +++-- 5 files changed, 19 insertions(+), 40 deletions(-) delete mode 100644 .gitmodules delete mode 160000 cmake/coveralls-cmake diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 37bc2b63dd..0000000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "cmake/coveralls-cmake"] - path = cmake/coveralls-cmake - url = https://github.com/JoakimSoderberg/coveralls-cmake.git diff --git a/.travis.yml b/.travis.yml index e647d7a405..2a374a0b53 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,14 +1,14 @@ language: c sudo: false +install: + - pip install --user cpp-coveralls script: - - mkdir -p build - - cd build - - cmake -DCOVERAGE=ON -DCOVERALLS_UPLOAD=ON -DCMAKE_BUILD_TYPE=Debug .. + - cmake -DCMAKE_BUILD_TYPE=Profile . - make - make check_format - - ctest - - ctest -V - - make coveralls + - make test +after_success: + - cpp-coveralls env: global: - export COVERALLS_SERVICE_NAME=travis-ci diff --git a/CMakeLists.txt b/CMakeLists.txt index f22119ba5b..639f9b19e2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,16 +6,21 @@ set(VERSION_PATCH "0") project(matrix CXX) -option(COVERAGE "Enable code coverage" OFF) -option(COVERALLS_UPLOAD "Upload the generated coveralls json" OFF) - if (NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build type" FORCE) message(STATUS "set build type to ${CMAKE_BUILD_TYPE}") endif() +set_property(CACHE CMAKE_BUILD_TYPE PROPERTY + STRINGS "Debug;Release;RelWithDebInfo;MinSizeRel;Profile") -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} - ${CMAKE_SOURCE_DIR}/cmake/coveralls-cmake/cmake) +set(CMAKE_CXX_FLAGS_PROFILE + ${CMAKE_CXX_FLAGS_DEBUG} + --coverage + -fno-inline + -fno-inline-small-functions + -fno-default-inline + ) +string(REPLACE ";" " " CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_PROFILE}") set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} @@ -39,19 +44,6 @@ set(CMAKE_CXX_FLAGS -Wcast-align -Werror ) - -if (COVERAGE) - set(COVERALLS ON) - list(APPEND CMAKE_CXX_FLAGS - -fno-inline - -fno-inline-small-functions - -fno-default-inline - --coverage - ) - include(Coveralls) - coveralls_turn_on_coverage() -endif() - string(REPLACE ";" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") enable_testing() @@ -60,16 +52,6 @@ include_directories(${CMAKE_SOURCE_DIR}) file(GLOB_RECURSE COV_SRCS matrix/*.hpp matrix/*.cpp) -# Setup the coveralls target and tell it to gather -# coverage data for all the lib sources. -if (COVERALLS) - coveralls_setup( - "${COV_SRCS}" - ${COVERALLS_UPLOAD} - "${CMAKE_SOURCE_DIR}/cmake/coveralls-cmake/cmake" - ) -endif() - add_subdirectory(test) set(astyle_exe ${CMAKE_BINARY_DIR}/astyle/src/bin/astyle) diff --git a/cmake/coveralls-cmake b/cmake/coveralls-cmake deleted file mode 160000 index 2d53ce3dea..0000000000 --- a/cmake/coveralls-cmake +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 2d53ce3deaea087b2df778c09fe2590763661547 diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 5f4557dd83..76357d890c 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -23,13 +23,14 @@ foreach(test_name ${tests}) add_dependencies(test_build ${test_name}) endforeach() -if (COVERAGE) +if (${CMAKE_BUILD_TYPE} STREQUAL "Profile") add_custom_target(coverage + COMMAND ${CMAKE_CTEST_COMMAND} COMMAND lcov --capture --directory . --output-file coverage.info COMMAND genhtml coverage.info --output-directory out COMMAND x-www-browser out/index.html WORKING_DIRECTORY ${CMAKE_BUILD_DIR} - DEPENDS coveralls test_build + DEPENDS test_build ) endif()