Commit 96c9e4aa authored by Constantin Rack's avatar Constantin Rack

Merge pull request #1851 from bluca/gcov

Add code coverage to build system and CI
parents 22cb66d8 1ac71c3c
......@@ -12,6 +12,12 @@ env:
- BUILD_TYPE=cmake CURVE=tweetnacl
- BUILD_TYPE=default CURVE=libsodium
- BUILD_TYPE=default
- BUILD_TYPE=coverage CURVE=tweetnacl
matrix:
exclude:
- env: BUILD_TYPE=coverage CURVE=tweetnacl
os: osx
sudo: false
......@@ -21,6 +27,7 @@ addons:
- kubuntu-backports
packages:
- cmake
- lcov
before_install:
- if [ $TRAVIS_OS_NAME == "osx" ] ; then brew update; brew install binutils ; fi
......
......@@ -273,9 +273,10 @@ endif
endif
endif
src_libzmq_la_CPPFLAGS =
src_libzmq_la_CXXFLAGS = @LIBZMQ_EXTRA_CXXFLAGS@
src_libzmq_la_LIBADD =
src_libzmq_la_CPPFLAGS = $(CODE_COVERAGE_CPPFLAGS)
src_libzmq_la_CFLAGS = $(CODE_COVERAGE_CFLAGS)
src_libzmq_la_CXXFLAGS = @LIBZMQ_EXTRA_CXXFLAGS@ $(CODE_COVERAGE_CXXFLAGS)
src_libzmq_la_LIBADD = $(CODE_COVERAGE_LDFLAGS)
if USE_LIBSODIUM
src_libzmq_la_CPPFLAGS += ${sodium_CFLAGS}
......@@ -760,6 +761,8 @@ MAINTAINERCLEANFILES = \
$(srcdir)/configure \
`find "$(srcdir)" -type f -name Makefile.in -print`
@CODE_COVERAGE_RULES@
dist-hook:
-rm $(distdir)/src/platform.hpp
@if test -d "$(srcdir)/.git"; \
......
......@@ -2,6 +2,7 @@
[![Build Status](https://travis-ci.org/zeromq/libzmq.png?branch=master)](https://travis-ci.org/zeromq/libzmq)
[![Build status](https://ci.appveyor.com/api/projects/status/e2ks424yrs1un3wt?svg=true)](https://ci.appveyor.com/project/zeromq/libzmq)
[![Coverage Status](https://coveralls.io/repos/github/zeromq/libzmq/badge.svg?branch=master)](https://coveralls.io/github/zeromq/libzmq?branch=master)
## Welcome
......
#!/usr/bin/env bash
set -x
mkdir tmp
BUILD_PREFIX=$PWD/tmp
CONFIG_OPTS=()
CONFIG_OPTS+=("CFLAGS=-I${BUILD_PREFIX}/include")
CONFIG_OPTS+=("CPPFLAGS=-I${BUILD_PREFIX}/include")
CONFIG_OPTS+=("CXXFLAGS=-I${BUILD_PREFIX}/include")
CONFIG_OPTS+=("LDFLAGS=-L${BUILD_PREFIX}/lib")
CONFIG_OPTS+=("PKG_CONFIG_PATH=${BUILD_PREFIX}/lib/pkgconfig")
CONFIG_OPTS+=("--prefix=${BUILD_PREFIX}")
CONFIG_OPTS+=("--enable-code-coverage")
if [ -z $CURVE ]; then
CMAKE_OPTS+=("-DENABLE_CURVE=OFF")
elif [ $CURVE == "libsodium" ]; then
CMAKE_OPTS+=("-DWITH_LIBSODIUM=ON")
git clone --depth 1 -b stable git://github.com/jedisct1/libsodium.git
( cd libsodium; ./autogen.sh; ./configure --prefix=$BUILD_PREFIX; make install)
fi
pip install --user cpp-coveralls
# Build, check, and install from local source
( cd ../..; ./autogen.sh && ./configure "${CONFIG_OPTS[@]}" && make -j5 && make check && coveralls --exclude tests --gcov-options '\-lp') || exit 1
......@@ -16,6 +16,7 @@ AM_INIT_AUTOMAKE(foreign subdir-objects tar-ustar dist-zip)
m4_pattern_allow([AC_PROG_CC_C99])
m4_include([m4/ax_check_compile_flag.m4])
m4_include([m4/ax_cxx_compile_stdcxx_11.m4])
m4_include([m4/ax_code_coverage.m4])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
# This lets us use PACKAGE_VERSION in Makefiles
......@@ -50,6 +51,7 @@ AC_PROG_CC
AX_CHECK_COMPILE_FLAG([-std=gnu11], [CFLAGS+=" -std=gnu11"], [AC_PROG_CC_C99])
AC_PROG_CXX
AX_CXX_COMPILE_STDCXX_11([ext], [optional])
AX_CODE_COVERAGE
AM_PROG_CC_C_O
AC_PROG_SED
AC_PROG_AWK
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment