From a05b6b476e00421ef7de2133244242a93adf9a9b Mon Sep 17 00:00:00 2001 From: Soonho Kong Date: Thu, 26 Sep 2013 22:24:24 -0700 Subject: [PATCH] fix(testcov): install lcov and include testcov only when it's on --- .travis.yml | 6 ++++++ src/CMakeLists.txt | 9 +++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index d11b4b866..2ffd957e0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -116,6 +116,12 @@ install: sudo apt-get -qq install python python-pip; sudo pip install dropbox; fi + - if [[ $TESTCOV == ON ]]; then + wget http://downloads.sourceforge.net/ltp/lcov-1.10.tar.gz; + tar xvfz lcov-1.10.tar.gz; + cp -v lcov-1.10/bin/{lcov,genpng,gendesc,genhtml,geninfo} /usr/bin/; + rm -rf lcov-1.10.tar.gz lcov-1.10; + fi before_script: - if [[ $LEANREPO == BLESSED && $TRIGGER_BB == TRUE ]]; then diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 91dda4bd0..672f99540 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -35,8 +35,10 @@ set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g") # Test coverage if("${TESTCOV}" MATCHES "ON") + include(CodeCoverage) message(STATUS "Enable test-coverage") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -fprofile-arcs -ftest-coverage") + setup_target_for_coverage(cov ${LEAN_SOURCE_DIR}/../script/run_tests.sh coverage) endif() # Compiler-specific C++11 activation. @@ -154,9 +156,4 @@ file(GLOB_RECURSE LEAN_SOURCES ${LEAN_SOURCE_DIR}/[A-Za-z]*.cpp ${LEAN_SOURCE_DIR}/[A-Za-z]*.h) add_style_check_target(style "${LEAN_SOURCES}") -add_test(NAME style_check - COMMAND ${LEAN_SOURCE_DIR}/cmake/Modules/cpplint.py ${LEAN_SOURCES}) - -# Include Code Coverage -include(CodeCoverage) -setup_target_for_coverage(cov ${LEAN_SOURCE_DIR}/../script/run_tests.sh coverage) +add_test(NAME style_check COMMAND ${LEAN_SOURCE_DIR}/cmake/Modules/cpplint.py ${LEAN_SOURCES})