Skip to content

Commit cc5f405

Browse files
committed
Problem: no build/tests with DRAFT
Solution: added initial test case
1 parent 68cbb9e commit cc5f405

File tree

5 files changed

+32
-3
lines changed

5 files changed

+32
-3
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ matrix:
3939
packages:
4040
- g++-7
4141
env:
42-
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7" BUILD_TYPE=cmake ZMQ_VERSION=4.2.5
42+
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7" BUILD_TYPE=cmake ZMQ_VERSION=4.2.5 DRAFT=1
4343

4444
sudo: required
4545

CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,18 @@ if (ZeroMQ_FOUND AND (NOT TARGET libzmq OR NOT TARGET libzmq-static))
1919
message(FATAL_ERROR "ZeroMQ version not supported!")
2020
endif()
2121

22+
if (EXISTS "${SOURCE_DIR}/.git")
23+
OPTION (ENABLE_DRAFTS "Build and install draft classes and methods" ON)
24+
else ()
25+
OPTION (ENABLE_DRAFTS "Build and install draft classes and methods" OFF)
26+
endif ()
27+
IF (ENABLE_DRAFTS)
28+
ADD_DEFINITIONS (-DZMQ_BUILD_DRAFT_API)
29+
set (pkg_config_defines "-DZMQ_BUILD_DRAFT_API=1")
30+
ELSE (ENABLE_DRAFTS)
31+
set (pkg_config_defines "")
32+
ENDIF (ENABLE_DRAFTS)
33+
2234
message(STATUS "cppzmq v${CPPZMQ_VERSION}")
2335

2436
set(CPPZMQ_HEADERS

ci_build.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
set -x
44
set -e
55

6+
if [ "$DRAFT" = "1" ] ; then
7+
# if we enable drafts during the libzmq cmake build, the pkgconfig
8+
# data should set ZMQ_BUILD_DRAFT_API in dependent builds, but this
9+
# does not appear to work (TODO)
10+
export ZEROMQ_CMAKE_FLAGS="-DENABLE_DRAFTS=ON"
11+
fi
12+
613
install_zeromq() {
714
pushd .
815

@@ -14,7 +21,7 @@ install_zeromq() {
1421

1522
mkdir build
1623
cd build
17-
cmake ..
24+
cmake .. ${ZEROMQ_CMAKE_FLAGS}
1825
sudo make -j4 install
1926

2027
popd
@@ -29,7 +36,7 @@ if [ "${ZMQ_VERSION}" != "" ] ; then install_zeromq ; fi
2936
pushd .
3037
mkdir build
3138
cd build
32-
cmake ..
39+
cmake .. ${ZEROMQ_CMAKE_FLAGS}
3340
cmake --build .
3441
sudo make -j4 install
3542
make test ARGS="-V"

tests/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ add_executable(
2424
unit_tests
2525
context.cpp
2626
socket.cpp
27+
poller.cpp
2728
)
2829

2930
target_link_libraries(

tests/poller.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include <gtest/gtest.h>
2+
#include <zmq.hpp>
3+
4+
#if defined(ZMQ_CPP11) && defined(ZMQ_BUILD_DRAFT_API)
5+
TEST(poller, create_destroy)
6+
{
7+
zmq::poller_t context;
8+
}
9+
#endif

0 commit comments

Comments
 (0)