From c1de36a0a5a74e31507fb675fcdb10910968739d Mon Sep 17 00:00:00 2001 From: Alexey Sokolov Date: Tue, 25 Aug 2015 22:35:33 +0100 Subject: [PATCH] Enable test coverage in travis+coveralls --- .travis.yml | 13 +++++++++++++ README.md | 1 + 2 files changed, 14 insertions(+) diff --git a/.travis.yml b/.travis.yml index 6c964a59..3013ce68 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,7 @@ env: - BUILD_TYPE=normal - BUILD_TYPE=asan - BUILD_TYPE=tsan + - BUILD_TYPE=cov global: - secure: "i2f2UVDnyHT/9z0U3XvgTj8eDERvnc1Wk7HpseEjb75JwGzqn/2R+RKHmoSrwK3hFgij2IMxZL19XtHFwMz9t5A/huAAKD74KMMI/QpeZEJ/sjT3CTLcE9HEVDdJOjc7dfLRxb2hZtgvx8clZIMrpeUdPhci8openff30KvXVbg=" matrix: @@ -18,10 +19,14 @@ matrix: env: BUILD_TYPE=asan - os: osx env: BUILD_TYPE=tsan + - os: osx + env: BUILD_TYPE=cov - compiler: gcc env: BUILD_TYPE=asan - compiler: gcc env: BUILD_TYPE=tsan + - compiler: gcc + env: BUILD_TYPE=cov - os: osx compiler: gcc include: @@ -34,6 +39,7 @@ before_install: - if [[ "$BUILD_TYPE" == "normal" ]]; then export CFGFLAGS= MYCXXFLAGS= MYLDFLAGS=; fi - if [[ "$BUILD_TYPE" == "asan" ]]; then export CFGFLAGS=--enable-debug MYCXXFLAGS="-fsanitize=address -O1 -fno-omit-frame-pointer -fno-optimize-sibling-calls -fPIE" MYLDFLAGS="-fsanitize=address -pie"; fi - if [[ "$BUILD_TYPE" == "tsan" ]]; then export CFGFLAGS=--enable-debug MYCXXFLAGS="-fsanitize=thread -O1 -fPIE" MYLDFLAGS="-fsanitize=thread -pie"; fi + - if [[ "$BUILD_TYPE" == "cov" ]]; then export CFGFLAGS=--enable-debug MYCXXFLAGS=--coverage MYLDFLAGS=--coverage; fi # UBSan randomly crashes clang, and very often :( # CFGFLAGS=--enable-debug MYCXXFLAGS="-fsanitize=undefined -O1 -fPIE -fno-sanitize-recover" MYLDFLAGS="-fsanitize=undefined -pie -fno-sanitize-recover" - if [[ "$TRAVIS_REPO_SLUG" == "znc/znc" && "$TRAVIS_PULL_REQUEST" == "false" && "$TRAVIS_BRANCH" == "master" ]]; then openssl aes-256-cbc -d -in .travis-github.enc -out ~/znc-docs-key -k ${SECRET_KEY}; fi @@ -49,6 +55,7 @@ install: - if [[ "$TRAVIS_OS_NAME" == "linux" && "$CXX" == "g++" ]]; then sudo apt-get install g++-4.8; fi - if [[ "$TRAVIS_OS_NAME" == "linux" && "$CXX" == "g++" ]]; then export CXX="g++-4.8" CC="gcc-4.8"; fi - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export CFGFLAGS="$CFGFLAGS --with-gtest=/usr/src/gtest"; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" && "$BUILD_TYPE" == "cov" ]]; then sudo apt-get install lcov; gem install coveralls-lcov; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then sw_vers; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then sysctl -a | grep cpu; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then sysctl -a | grep mem; fi @@ -79,6 +86,12 @@ after_success: else echo "Not leader" fi + - | + if [[ "$BUILD_TYPE" == "cov" ]]; then + lcov --directory . --capture --output-file coverage.info + lcov --remove coverage.info '/usr/*' 'test/*' --output-file coverage.info + coveralls-lcov coverage.info + fi notifications: irc: channels: diff --git a/README.md b/README.md index 5f8a37d5..930c27be 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ [![Travis Build Status](https://travis-ci.org/znc/znc.svg?branch=master)](https://travis-ci.org/znc/znc) [![AppVeyor Build status](https://ci.appveyor.com/api/projects/status/7danes7dj5h2iv4p/branch/master?svg=true)](https://ci.appveyor.com/project/DarthGandalf/znc/branch/master) [![Bountysource](https://www.bountysource.com/badge/tracker?tracker_id=1759)](https://www.bountysource.com/trackers/1759-znc?utm_source=1759&utm_medium=shield&utm_campaign=TRACKER_BADGE) +[![Coverage Status](https://coveralls.io/repos/znc/znc/badge.svg?branch=master&service=github)](https://coveralls.io/github/znc/znc?branch=master) ## Table of contents