Problem: no build/tests with DRAFT

Solution: added initial test case
This commit is contained in:
Simon Giesecke 2018-04-03 16:30:58 +02:00
parent 68cbb9e57c
commit cc5f4050dc
5 changed files with 32 additions and 3 deletions

View File

@ -39,7 +39,7 @@ matrix:
packages:
- g++-7
env:
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7" BUILD_TYPE=cmake ZMQ_VERSION=4.2.5
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7" BUILD_TYPE=cmake ZMQ_VERSION=4.2.5 DRAFT=1
sudo: required

View File

@ -19,6 +19,18 @@ if (ZeroMQ_FOUND AND (NOT TARGET libzmq OR NOT TARGET libzmq-static))
message(FATAL_ERROR "ZeroMQ version not supported!")
endif()
if (EXISTS "${SOURCE_DIR}/.git")
OPTION (ENABLE_DRAFTS "Build and install draft classes and methods" ON)
else ()
OPTION (ENABLE_DRAFTS "Build and install draft classes and methods" OFF)
endif ()
IF (ENABLE_DRAFTS)
ADD_DEFINITIONS (-DZMQ_BUILD_DRAFT_API)
set (pkg_config_defines "-DZMQ_BUILD_DRAFT_API=1")
ELSE (ENABLE_DRAFTS)
set (pkg_config_defines "")
ENDIF (ENABLE_DRAFTS)
message(STATUS "cppzmq v${CPPZMQ_VERSION}")
set(CPPZMQ_HEADERS

View File

@ -3,6 +3,13 @@
set -x
set -e
if [ "$DRAFT" = "1" ] ; then
# if we enable drafts during the libzmq cmake build, the pkgconfig
# data should set ZMQ_BUILD_DRAFT_API in dependent builds, but this
# does not appear to work (TODO)
export ZEROMQ_CMAKE_FLAGS="-DENABLE_DRAFTS=ON"
fi
install_zeromq() {
pushd .
@ -14,7 +21,7 @@ install_zeromq() {
mkdir build
cd build
cmake ..
cmake .. ${ZEROMQ_CMAKE_FLAGS}
sudo make -j4 install
popd
@ -29,7 +36,7 @@ if [ "${ZMQ_VERSION}" != "" ] ; then install_zeromq ; fi
pushd .
mkdir build
cd build
cmake ..
cmake .. ${ZEROMQ_CMAKE_FLAGS}
cmake --build .
sudo make -j4 install
make test ARGS="-V"

View File

@ -24,6 +24,7 @@ add_executable(
unit_tests
context.cpp
socket.cpp
poller.cpp
)
target_link_libraries(

9
tests/poller.cpp Normal file
View File

@ -0,0 +1,9 @@
#include <gtest/gtest.h>
#include <zmq.hpp>
#if defined(ZMQ_CPP11) && defined(ZMQ_BUILD_DRAFT_API)
TEST(poller, create_destroy)
{
zmq::poller_t context;
}
#endif