mirror of
https://github.com/zeromq/libzmq.git
synced 2025-03-01 10:57:59 +01:00
Merge pull request #4028 from sigiesec/test-coverage
Some improvements to the test coverage job
This commit is contained in:
commit
e7974c3b72
10
.travis.yml
10
.travis.yml
@ -44,12 +44,18 @@ matrix:
|
||||
- env: BUILD_TYPE=default CURVE=tweetnacl IPv6=ON
|
||||
os: linux
|
||||
dist: precise
|
||||
- env: BUILD_TYPE=coverage CURVE=tweetnacl DRAFT=enabled
|
||||
- env: BUILD_TYPE=coverage CURVE=tweetnacl GSSAPI=enabled PGM=enabled NORM=enabled TIPC=enabled IPv6=ON TLS=enabled DRAFT=enabled
|
||||
os: linux
|
||||
dist: xenial
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- sourceline: 'deb http://download.opensuse.org/repositories/network:/messaging:/zeromq:/git-stable/xUbuntu_18.04/ ./'
|
||||
key_url: 'http://download.opensuse.org/repositories/network:/messaging:/zeromq:/git-stable/xUbuntu_18.04/Release.key'
|
||||
packages:
|
||||
- libkrb5-dev
|
||||
- libnorm-dev
|
||||
- libpgm-dev
|
||||
- libgnutls28-dev
|
||||
- lcov
|
||||
- env: BUILD_TYPE=valgrind CURVE=tweetnacl DRAFT=enabled TLS=enabled
|
||||
os: linux
|
||||
|
@ -5,28 +5,12 @@ 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}")
|
||||
source ../../config.sh
|
||||
set_config_opts
|
||||
|
||||
CONFIG_OPTS+=("--enable-code-coverage")
|
||||
|
||||
if [ -z $CURVE ]; then
|
||||
CMAKE_OPTS+=("-DENABLE_CURVE=OFF")
|
||||
elif [ $CURVE == "libsodium" ]; then
|
||||
CMAKE_OPTS+=("-DWITH_LIBSODIUM=ON")
|
||||
|
||||
if ! ((command -v dpkg-query >/dev/null 2>&1 && dpkg-query --list libsodium-dev >/dev/null 2>&1) || \
|
||||
(command -v brew >/dev/null 2>&1 && brew ls --versions libsodium >/dev/null 2>&1)); then
|
||||
git clone --depth 1 -b stable git://github.com/jedisct1/libsodium.git
|
||||
( cd libsodium; ./autogen.sh; ./configure --prefix=$BUILD_PREFIX; make install)
|
||||
fi
|
||||
fi
|
||||
|
||||
pip install --user cpp-coveralls
|
||||
|
||||
# Build, check, and install from local source
|
||||
( cd ../..; ./autogen.sh && ./configure "${CONFIG_OPTS[@]}" && make VERBOSE=1 -j5 check && coveralls --exclude tests --exclude src/tweetnacl.c --exclude src/tweetnacl.h --build-root . --gcov-options '\-lp') || exit 1
|
||||
( cd ../..; ./autogen.sh && ./configure "${CONFIG_OPTS[@]}" && make VERBOSE=1 -j5 check && coveralls --include src --exclude src/tweetnacl.c --exclude src/tweetnacl.h --build-root . --gcov-options '\-lp') || exit 1
|
||||
|
67
ci_build.sh
67
ci_build.sh
@ -7,71 +7,8 @@ if [ $BUILD_TYPE = "default" ]; then
|
||||
mkdir tmp
|
||||
BUILD_PREFIX=$PWD/tmp
|
||||
|
||||
CONFIG_OPTS=()
|
||||
CONFIG_OPTS+=("CFLAGS=-g")
|
||||
CONFIG_OPTS+=("CPPFLAGS=-I${BUILD_PREFIX}/include")
|
||||
CONFIG_OPTS+=("CXXFLAGS=-g")
|
||||
CONFIG_OPTS+=("LDFLAGS=-L${BUILD_PREFIX}/lib")
|
||||
CONFIG_OPTS+=("PKG_CONFIG_PATH=${BUILD_PREFIX}/lib/pkgconfig")
|
||||
CONFIG_OPTS+=("--prefix=${BUILD_PREFIX}")
|
||||
CHECK="distcheck"
|
||||
|
||||
if [ -n "$ADDRESS_SANITIZER" ] && [ "$ADDRESS_SANITIZER" = "enabled" ]; then
|
||||
CONFIG_OPTS+=("--enable-address-sanitizer=yes")
|
||||
# distcheck does an out-of-tree build, and the fuzzer tests use a hard-coded relative path for simplicity
|
||||
CHECK="check"
|
||||
git clone --depth 1 https://github.com/zeromq/libzmq-fuzz-corpora.git tests/libzmq-fuzz-corpora
|
||||
fi
|
||||
|
||||
if [ "$USE_NSS" = "yes" ]; then
|
||||
CONFIG_OPTS+=("--with-nss")
|
||||
fi
|
||||
|
||||
if [ -z "$CURVE" ]; then
|
||||
CONFIG_OPTS+=("--disable-curve")
|
||||
elif [ "$CURVE" = "libsodium" ]; then
|
||||
CONFIG_OPTS+=("--with-libsodium=yes")
|
||||
|
||||
if ! ((command -v dpkg-query >/dev/null 2>&1 && dpkg-query --list libsodium-dev >/dev/null 2>&1) || \
|
||||
(command -v brew >/dev/null 2>&1 && brew ls --versions libsodium >/dev/null 2>&1)); then
|
||||
git clone --depth 1 -b stable git://github.com/jedisct1/libsodium.git
|
||||
( cd libsodium; ./autogen.sh; ./configure --prefix=$BUILD_PREFIX; make install)
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$GSSAPI" ] && [ "$GSSAPI" = "enabled" ]; then
|
||||
CONFIG_OPTS+=("--with-libgssapi_krb5=yes")
|
||||
fi
|
||||
|
||||
if [ -n "$PGM" ] && [ "$PGM" = "enabled" ]; then
|
||||
CONFIG_OPTS+=("--with-pgm=yes")
|
||||
fi
|
||||
|
||||
if [ -n "$NORM" ] && [ "$NORM" = "enabled" ]; then
|
||||
CONFIG_OPTS+=("--with-norm=yes")
|
||||
fi
|
||||
|
||||
if [ -n "$TIPC" ] && [ "$TIPC" = "enabled" ]; then
|
||||
sudo modprobe tipc
|
||||
fi
|
||||
|
||||
if [ -n "$POLLER" ]; then
|
||||
CONFIG_OPTS+=("--with-poller=${POLLER}")
|
||||
fi
|
||||
|
||||
if [ -n "$TLS" ] && [ "$TLS" = "enabled" ]; then
|
||||
CONFIG_OPTS+=("--with-tls=yes")
|
||||
fi
|
||||
|
||||
if [ -z "$DRAFT" ] || [ "$DRAFT" = "disabled" ]; then
|
||||
CONFIG_OPTS+=("--enable-drafts=no")
|
||||
elif [ "$DRAFT" = "enabled" ]; then
|
||||
CONFIG_OPTS+=("--enable-drafts=yes")
|
||||
fi
|
||||
|
||||
if [ -n "$FORCE_98" ] && [ "$FORCE_98" = "enabled" ]; then
|
||||
CONFIG_OPTS+=("--enable-force-CXX98-compat=yes")
|
||||
fi
|
||||
source config.sh
|
||||
set_config_opts
|
||||
|
||||
# Build and check this project
|
||||
(
|
||||
|
69
config.sh
Normal file
69
config.sh
Normal file
@ -0,0 +1,69 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
function set_config_opts() {
|
||||
CONFIG_OPTS=()
|
||||
CONFIG_OPTS+=("CFLAGS=-g")
|
||||
CONFIG_OPTS+=("CPPFLAGS=-I${BUILD_PREFIX}/include")
|
||||
CONFIG_OPTS+=("CXXFLAGS=-g")
|
||||
CONFIG_OPTS+=("LDFLAGS=-L${BUILD_PREFIX}/lib")
|
||||
CONFIG_OPTS+=("PKG_CONFIG_PATH=${BUILD_PREFIX}/lib/pkgconfig")
|
||||
CONFIG_OPTS+=("--prefix=${BUILD_PREFIX}")
|
||||
CHECK="distcheck"
|
||||
|
||||
if [ -n "$ADDRESS_SANITIZER" ] && [ "$ADDRESS_SANITIZER" = "enabled" ]; then
|
||||
CONFIG_OPTS+=("--enable-address-sanitizer=yes")
|
||||
# distcheck does an out-of-tree build, and the fuzzer tests use a hard-coded relative path for simplicity
|
||||
CHECK="check"
|
||||
git clone --depth 1 https://github.com/zeromq/libzmq-fuzz-corpora.git tests/libzmq-fuzz-corpora
|
||||
fi
|
||||
|
||||
if [ "$USE_NSS" = "yes" ]; then
|
||||
CONFIG_OPTS+=("--with-nss")
|
||||
fi
|
||||
|
||||
if [ -z "$CURVE" ]; then
|
||||
CONFIG_OPTS+=("--disable-curve")
|
||||
elif [ "$CURVE" = "libsodium" ]; then
|
||||
CONFIG_OPTS+=("--with-libsodium=yes")
|
||||
|
||||
if ! ((command -v dpkg-query >/dev/null 2>&1 && dpkg-query --list libsodium-dev >/dev/null 2>&1) || \
|
||||
(command -v brew >/dev/null 2>&1 && brew ls --versions libsodium >/dev/null 2>&1)); then
|
||||
git clone --depth 1 -b stable git://github.com/jedisct1/libsodium.git
|
||||
( cd libsodium; ./autogen.sh; ./configure --prefix=$BUILD_PREFIX; make install)
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$GSSAPI" ] && [ "$GSSAPI" = "enabled" ]; then
|
||||
CONFIG_OPTS+=("--with-libgssapi_krb5=yes")
|
||||
fi
|
||||
|
||||
if [ -n "$PGM" ] && [ "$PGM" = "enabled" ]; then
|
||||
CONFIG_OPTS+=("--with-pgm=yes")
|
||||
fi
|
||||
|
||||
if [ -n "$NORM" ] && [ "$NORM" = "enabled" ]; then
|
||||
CONFIG_OPTS+=("--with-norm=yes")
|
||||
fi
|
||||
|
||||
if [ -n "$TIPC" ] && [ "$TIPC" = "enabled" ]; then
|
||||
sudo modprobe tipc
|
||||
fi
|
||||
|
||||
if [ -n "$POLLER" ]; then
|
||||
CONFIG_OPTS+=("--with-poller=${POLLER}")
|
||||
fi
|
||||
|
||||
if [ -n "$TLS" ] && [ "$TLS" = "enabled" ]; then
|
||||
CONFIG_OPTS+=("--with-tls=yes")
|
||||
fi
|
||||
|
||||
if [ -z "$DRAFT" ] || [ "$DRAFT" = "disabled" ]; then
|
||||
CONFIG_OPTS+=("--enable-drafts=no")
|
||||
elif [ "$DRAFT" = "enabled" ]; then
|
||||
CONFIG_OPTS+=("--enable-drafts=yes")
|
||||
fi
|
||||
|
||||
if [ -n "$FORCE_98" ] && [ "$FORCE_98" = "enabled" ]; then
|
||||
CONFIG_OPTS+=("--enable-force-CXX98-compat=yes")
|
||||
fi
|
||||
}
|
@ -76,7 +76,7 @@ zmq::ws_listener_t::ws_listener_t (io_thread_t *io_thread_,
|
||||
#ifdef ZMQ_HAVE_WSS
|
||||
if (_wss) {
|
||||
int rc = gnutls_certificate_allocate_credentials (&_tls_cred);
|
||||
assert (rc == GNUTLS_E_SUCCESS);
|
||||
zmq_assert (rc == GNUTLS_E_SUCCESS);
|
||||
|
||||
gnutls_datum_t cert = {(unsigned char *) options_.wss_cert_pem.c_str (),
|
||||
(unsigned int) options_.wss_cert_pem.length ()};
|
||||
@ -84,7 +84,7 @@ zmq::ws_listener_t::ws_listener_t (io_thread_t *io_thread_,
|
||||
(unsigned int) options_.wss_key_pem.length ()};
|
||||
rc = gnutls_certificate_set_x509_key_mem (_tls_cred, &cert, &key,
|
||||
GNUTLS_X509_FMT_PEM);
|
||||
assert (rc == GNUTLS_E_SUCCESS);
|
||||
zmq_assert (rc == GNUTLS_E_SUCCESS);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -310,7 +310,7 @@ void zmq::ws_listener_t::create_engine (fd_t fd_)
|
||||
wss_engine_t (fd_, options, endpoint_pair, _address, false, _tls_cred,
|
||||
std::string ());
|
||||
#else
|
||||
assert (false);
|
||||
zmq_assert (false);
|
||||
#endif
|
||||
else
|
||||
engine = new (std::nothrow)
|
||||
|
@ -39,7 +39,7 @@ static int verify_certificate_callback (gnutls_session_t session)
|
||||
hostname = (const char *) gnutls_session_get_ptr (session);
|
||||
|
||||
int rc = gnutls_certificate_verify_peers3 (session, hostname, &status);
|
||||
assert (rc >= 0);
|
||||
zmq_assert (rc >= 0);
|
||||
|
||||
if (status != 0) {
|
||||
// TODO: somehow log the error
|
||||
@ -68,7 +68,7 @@ zmq::wss_engine_t::wss_engine_t (fd_t fd_,
|
||||
if (client_) {
|
||||
// TODO: move to session_base, to allow changing the socket options between connect calls
|
||||
rc = gnutls_certificate_allocate_credentials (&_tls_client_cred);
|
||||
assert (rc == 0);
|
||||
zmq_assert (rc == 0);
|
||||
|
||||
if (options_.wss_trust_system)
|
||||
gnutls_certificate_set_x509_system_trust (_tls_client_cred);
|
||||
@ -79,14 +79,14 @@ zmq::wss_engine_t::wss_engine_t (fd_t fd_,
|
||||
(unsigned int) options_.wss_trust_pem.length ()};
|
||||
rc = gnutls_certificate_set_x509_trust_mem (
|
||||
_tls_client_cred, &trust, GNUTLS_X509_FMT_PEM);
|
||||
assert (rc >= 0);
|
||||
zmq_assert (rc >= 0);
|
||||
}
|
||||
|
||||
gnutls_certificate_set_verify_function (_tls_client_cred,
|
||||
verify_certificate_callback);
|
||||
|
||||
rc = gnutls_init (&_tls_session, GNUTLS_CLIENT | GNUTLS_NONBLOCK);
|
||||
assert (rc == GNUTLS_E_SUCCESS);
|
||||
zmq_assert (rc == GNUTLS_E_SUCCESS);
|
||||
|
||||
if (!hostname_.empty ())
|
||||
gnutls_server_name_set (_tls_session, GNUTLS_NAME_DNS,
|
||||
@ -98,16 +98,16 @@ zmq::wss_engine_t::wss_engine_t (fd_t fd_,
|
||||
|
||||
rc = gnutls_credentials_set (_tls_session, GNUTLS_CRD_CERTIFICATE,
|
||||
_tls_client_cred);
|
||||
assert (rc == GNUTLS_E_SUCCESS);
|
||||
zmq_assert (rc == GNUTLS_E_SUCCESS);
|
||||
} else {
|
||||
assert (tls_server_cred_);
|
||||
zmq_assert (tls_server_cred_);
|
||||
|
||||
rc = gnutls_init (&_tls_session, GNUTLS_SERVER | GNUTLS_NONBLOCK);
|
||||
assert (rc == GNUTLS_E_SUCCESS);
|
||||
zmq_assert (rc == GNUTLS_E_SUCCESS);
|
||||
|
||||
rc = gnutls_credentials_set (_tls_session, GNUTLS_CRD_CERTIFICATE,
|
||||
tls_server_cred_);
|
||||
assert (rc == GNUTLS_E_SUCCESS);
|
||||
zmq_assert (rc == GNUTLS_E_SUCCESS);
|
||||
}
|
||||
|
||||
gnutls_set_default_priority (_tls_session);
|
||||
|
Loading…
x
Reference in New Issue
Block a user