Skip to content
Permalink
Browse files

Enable coverage reports for Travis builds

Changes required:
- switch Travis builds to gcc, using O0 for build speed
- enable a debug build
- enable coverage report for ctest on Travis (sent to dash)
  • Loading branch information
nyalldawson committed Jan 26, 2015
1 parent e0adf89 commit 34d5394409cd39a7953bd169ffdc36a618641ce3
Showing with 16 additions and 9 deletions.
  1. +2 −2 .travis.yml
  2. +5 −5 CMakeLists.txt
  3. +9 −2 qgis-test-travis.ctest
@@ -1,7 +1,7 @@
language: cpp

compiler:
- clang
- gcc

cache: apt

@@ -18,7 +18,7 @@ before_install:
install:
- mkdir build
- cd build
- cmake -DWITH_SERVER=ON -DWITH_STAGED_PLUGINS=OFF -DWITH_GRASS=OFF \
- cmake -DWITH_SERVER=ON -DWITH_STAGED_PLUGINS=OFF -DWITH_GRASS=OFF -DENABLE_COVERAGE=ON.. \
-DSUPPRESS_QT_WARNINGS=ON -DENABLE_MODELTEST=ON -DWITH_QWTPOLAR=OFF ..

script: xvfb-run ctest -V -E 'Atlas|atlas|PyQgsPalLabelingCanvas|PyQgsPalLabelingServer|qgis_wcsprovidertest' -S ../qgis-test-travis.ctest --output-on-failure
@@ -414,11 +414,11 @@ ENDIF(MSVC)

IF(ENABLE_COVERAGE)
INCLUDE("cmake/modules/coverage/CodeCoverage.cmake")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage --coverage")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage --coverage")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage --coverage")
SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage --coverage")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage --coverage")
SETUP_TARGET_FOR_COVERAGE(qgis_coverage ctest coverage)
ENDIF(ENABLE_COVERAGE)

@@ -7,15 +7,21 @@ SET( CTEST_CMAKE_GENERATOR "Unix Makefiles" )
SET (CTEST_CMAKE_COMMAND "cmake" )
SET (CTEST_BUILD_COMMAND "/usr/bin/make -j2 -i -k" )
SET (CTEST_SITE "travis-ci.org" )
SET (CTEST_COVERAGE_COMMAND "/usr/bin/gcov" )
SET (CTEST_CUSTOM_COVERAGE_EXCLUDE "\(.*/tests/.*|.*\\.cxx|.*\\.sip|.*/sip_.*|.*/ui_.*|.*/qwtpolar.*\)\$" )
IF ($ENV{TRAVIS_PULL_REQUEST} STREQUAL "false")
# No pull request
SET (CTEST_BUILD_NAME "$ENV{TRAVIS_BRANCH} ($ENV{TRAVIS_COMMIT})")
ELSE()
SET (CTEST_BUILD_NAME "PR: $ENV{TRAVIS_PULL_REQUEST} / $ENV{TRAVIS_BRANCH} ($ENV{TRAVIS_COMMIT})")
ENDIF()
SET (CTEST_BUILD_CONFIGURATION "Release")

SET (CTEST_BUILD_CONFIGURATION "Debug")

SET(CMAKE_CXX_FLAGS_COVERAGE "-g -O0 --coverage -fprofile-arcs -ftest-coverage" )
SET(CMAKE_C_FLAGS_COVERAGE "-g -O0 --coverage -fprofile-arcs -ftest-coverage")
SET(CMAKE_EXE_LINKER_FLAGS_COVERAGE "--coverage -fprofile-arcs -ftest-coverage")
SET(CMAKE_SHARED_LINKER_FLAGS_COVERAGE "--coverage -fprofile-arcs -ftest-coverage" )

SET (INITIAL_CACHE "
BUILDNAME:STRING=${CTEST_BUILD_NAME}
SITE:STRING=${CTEST_SITE}
@@ -36,6 +42,7 @@ IF(NOT ${BUILDRES} EQUAL 0)
MESSAGE( FATAL_ERROR "Build failed." )
ENDIF(NOT ${BUILDRES} EQUAL 0)
ctest_test (BUILD "${CTEST_BINARY_DIRECTORY}" PARALLEL_LEVEL 2 RETURN_VALUE TESTRES)
ctest_coverage( BUILD "${CMAKE_BINARY_DIR}")
IF(NOT ${TESTRES} EQUAL 0)
ctest_submit ()
MESSAGE( FATAL_ERROR "Test failed." )

0 comments on commit 34d5394

Please sign in to comment.
You can’t perform that action at this time.