Switching coverage upload mechanism.

This commit is contained in:
jgoppert 2015-11-12 00:18:18 -05:00
parent 787606b6b8
commit 10b89a2594
5 changed files with 19 additions and 40 deletions

3
.gitmodules vendored
View File

@ -1,3 +0,0 @@
[submodule "cmake/coveralls-cmake"]
path = cmake/coveralls-cmake
url = https://github.com/JoakimSoderberg/coveralls-cmake.git

View File

@ -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

View File

@ -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)

@ -1 +0,0 @@
Subproject commit 2d53ce3deaea087b2df778c09fe2590763661547

View File

@ -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()