]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Integrate coveralls 790/head
authorAndrew Lewis <nerf@judo.za.org>
Tue, 2 Aug 2016 14:18:29 +0000 (15:18 +0100)
committerAndrew Lewis <nerf@judo.za.org>
Tue, 2 Aug 2016 14:18:29 +0000 (15:18 +0100)
CMakeLists.txt
circle.yml

index dd931fb83254d76ab33a5351ea32ebe269e34523..802aa5a4e514a60244dba8eff997959c247362a0 100644 (file)
@@ -61,6 +61,7 @@ OPTION(ENABLE_HYPERSCAN    "Enable hyperscan for fast regexp processing [default
 OPTION(ENABLE_FANN         "Enable fann for neural network plugin [default: OFF]" OFF)
 OPTION(ENABLE_PCRE2        "Enable pcre2 instead of pcre  [default: OFF]"         OFF)
 OPTION(ENABLE_JEMALLOC     "Build rspamd with jemalloc allocator  [default: OFF]" OFF)
+OPTION(ENABLE_COVERAGE     "Build rspamd with code coverage options [default: OFF]" OFF)
 
 INCLUDE(FindArch.cmake)
 TARGET_ARCHITECTURE(ARCH)
@@ -823,6 +824,12 @@ IF(NOT CMAKE_C_OPT_FLAGS)
        ENDIF(ENABLE_OPTIMIZATION MATCHES "ON")
 ENDIF(NOT CMAKE_C_OPT_FLAGS)
 
+IF(ENABLE_COVERAGE)
+       SET(CMAKE_C_OPT_FLAGS "-g -O0 -fno-strict-aliasing")
+       SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage -fprofile-arcs -ftest-coverage")
+       SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage -fprofile-arcs -ftest-coverage")
+ENDIF(ENABLE_COVERAGE)
+
 SET(CMAKE_C_FLAGS "${CMAKE_C_OPT_FLAGS} ${CMAKE_C_FLAGS} ${CMAKE_C_WARN_FLAGS}")
 
 ADD_DEFINITIONS(-DHAVE_CONFIG_H)
index c08a8d5e4bd3ae722d39db00f1dfc3aab0d20318..3d0243877f0a1c59c3f51704e480d772fee4191a 100644 (file)
@@ -1,14 +1,18 @@
 dependencies:
     pre:
       - sudo apt-get update -qq
-      - sudo apt-get install -qq cmake gcc libevent-dev libglib2.0-dev libgmime-2.6-dev libluajit-5.1-dev liblua5.1-0-dev libmagic-dev libpcre3-dev libsqlite3-dev libssl-dev make python-dev ragel redis-server
+      - sudo apt-get install -qq cmake gcc lcov libevent-dev libglib2.0-dev libgmime-2.6-dev libluajit-5.1-dev liblua5.1-0-dev libmagic-dev libpcre3-dev libsqlite3-dev libssl-dev make python-dev ragel redis-server
+      - gem install coveralls-lcov
       - sudo pip install psutil
       - sudo pip install robotframework
 
 test:
   override:
-    - cmake . -DCMAKE_INSTALL_PREFIX=./_install
+    - cmake . -DENABLE_COVERAGE=ON -DCMAKE_INSTALL_PREFIX=./_install
     - cmake --build . --target install
     - sudo robot test/functional/cases
+    - lcov -b . -d . -c --output-file coverage.info
+    - ln -s src/ragel .
+    - coveralls-lcov -t ${COVERALLS_REPO_TOKEN} coverage.info
   post:
     - for i in output.xml log.html report.html; do mv $i $CIRCLE_ARTIFACTS; done