Unverified Commit d60ed2d6 authored by Simon Giesecke's avatar Simon Giesecke Committed by GitHub

Merge pull request #3301 from bluca/tests

Problems: some tests still use hard-coded TCP ports, wrong usage of CPPFLAGS, missing NEWS, no way to force C++98 builds and CI for it
parents f3fde849 4a0b6c6c
...@@ -100,6 +100,7 @@ test_reqrep_device_tipc ...@@ -100,6 +100,7 @@ test_reqrep_device_tipc
test_reqrep_tipc test_reqrep_tipc
test_router_handover test_router_handover
test_router_mandatory_tipc test_router_mandatory_tipc
test_router_notify
test_shutdown_stress_tipc test_shutdown_stress_tipc
test_sub_forward_tipc test_sub_forward_tipc
test_term_endpoint_tipc test_term_endpoint_tipc
...@@ -133,8 +134,7 @@ test_radio_dish ...@@ -133,8 +134,7 @@ test_radio_dish
test_udp test_udp
test_scatter_gather test_scatter_gather
test_socketopt_hwm test_socketopt_hwm
test_use_fd_ipc test_use_fd
test_use_fd_tcp
test_pub_invert_matching test_pub_invert_matching
test_dgram test_dgram
test_base85 test_base85
...@@ -144,6 +144,7 @@ test_zmq_poll_fd ...@@ -144,6 +144,7 @@ test_zmq_poll_fd
test_reconnect_ivl test_reconnect_ivl
test_address_tipc test_address_tipc
test_app_meta test_app_meta
test_security_gssapi
test_security_zap test_security_zap
test_socket_null test_socket_null
test_xpub_verbose test_xpub_verbose
...@@ -166,12 +167,14 @@ remote_lat ...@@ -166,12 +167,14 @@ remote_lat
remote_thr remote_thr
inproc_lat inproc_lat
inproc_thr inproc_thr
benchmark_radix_tree
!local_lat/ !local_lat/
!local_thr/ !local_thr/
!remote_lat/ !remote_lat/
!remote_thr/ !remote_thr/
!inproc_lat/ !inproc_lat/
!inproc_thr/ !inproc_thr/
!benchmark_radix_tree/
doc/*.1 doc/*.1
doc/*.3 doc/*.3
doc/*.7 doc/*.7
......
...@@ -111,6 +111,19 @@ matrix: ...@@ -111,6 +111,19 @@ matrix:
os: linux os: linux
- env: BUILD_TYPE=default POLLER=select - env: BUILD_TYPE=default POLLER=select
os: linux os: linux
- env: CXX=clang++ BUILD_TYPE=default CURVE=libsodium GSSAPI=enabled PGM=enabled NORM=enabled FORCE_98=enabled
os: linux
compiler: clang
addons:
apt:
sources:
- sourceline: 'deb http://download.opensuse.org/repositories/network:/messaging:/zeromq:/git-stable/xUbuntu_14.04/ ./'
key_url: 'http://download.opensuse.org/repositories/network:/messaging:/zeromq:/git-stable/xUbuntu_14.04/Release.key'
packages:
- libkrb5-dev
- libnorm-dev
- libpgm-dev
- libsodium-dev
sudo: false sudo: false
......
...@@ -51,6 +51,15 @@ ...@@ -51,6 +51,15 @@
on local listening sockets for UDP multicast sockets (ZMQ_RADIO). on local listening sockets for UDP multicast sockets (ZMQ_RADIO).
See doc/zmq_setsockopt.txt and doc/zmq_getsockopt.txt for details. See doc/zmq_setsockopt.txt and doc/zmq_getsockopt.txt for details.
* New perf tool, perf/benchmark_radix_tree, to measure the performance of the
different internal implementations of the trie algorithm used to track
subscriptions. Requires a compiler that supports C++11.
* New autoconf flag "--enable-force-CXX98-compat" which will force -std=gnu++98
and, if the compiler supports them (clang++ at the moment), it will also add
-Wc++98-compat -Wc++98-compat-pedantic so that compatibility with C++98 can
be tested.
* Many, many coding style, duplication and static analysis improvements. * Many, many coding style, duplication and static analysis improvements.
* Many, many improvements to the CMake build system, especially on Windows. * Many, many improvements to the CMake build system, especially on Windows.
......
...@@ -62,6 +62,10 @@ if [ $BUILD_TYPE == "default" ]; then ...@@ -62,6 +62,10 @@ if [ $BUILD_TYPE == "default" ]; then
CONFIG_OPTS+=("--enable-drafts=yes") CONFIG_OPTS+=("--enable-drafts=yes")
fi fi
if [ -n "$FORCE_98" ] && [ "$FORCE_98" == "enabled" ]; then
CONFIG_OPTS+=("--enable-force-CXX98-compat=yes")
fi
# Build and check this project # Build and check this project
( (
./autogen.sh && ./autogen.sh &&
......
...@@ -58,7 +58,6 @@ ZMQ_ORIG_CXXFLAGS="${CXXFLAGS:-none}" ...@@ -58,7 +58,6 @@ ZMQ_ORIG_CXXFLAGS="${CXXFLAGS:-none}"
AC_PROG_CC AC_PROG_CC
AX_CHECK_COMPILE_FLAG([-std=gnu11], [CFLAGS+=" -std=gnu11"], [AC_PROG_CC_C99]) AX_CHECK_COMPILE_FLAG([-std=gnu11], [CFLAGS+=" -std=gnu11"], [AC_PROG_CC_C99])
AC_PROG_CXX AC_PROG_CXX
AX_CXX_COMPILE_STDCXX_11([ext], [optional])
AX_CODE_COVERAGE AX_CODE_COVERAGE
AM_PROG_CC_C_O AM_PROG_CC_C_O
AC_PROG_SED AC_PROG_SED
...@@ -76,6 +75,17 @@ AC_LIBTOOL_WIN32_DLL ...@@ -76,6 +75,17 @@ AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL AC_PROG_LIBTOOL
AX_VALGRIND_CHECK AX_VALGRIND_CHECK
AC_ARG_ENABLE([force-CXX98-compat],
[AS_HELP_STRING([--enable-force-CXX98-compat], [force C++98 build [default=disabled]])])
if test "x$enable_force_CXX98_compat" = "xyes"; then
AC_LANG_PUSH([C++])
AX_CHECK_COMPILE_FLAG([-std=gnu++98], [CXXFLAGS+=" -std=gnu++98"], [])
AX_CHECK_COMPILE_FLAG([-Wc++98-compat -Wc++98-compat-pedantic], [CXXFLAGS+=" -Wc++98-compat"], [])
AC_LANG_POP([C++])
else
AX_CXX_COMPILE_STDCXX_11([ext], [optional])
fi
# Check whether to build a with debug symbols # Check whether to build a with debug symbols
LIBZMQ_CHECK_ENABLE_DEBUG LIBZMQ_CHECK_ENABLE_DEBUG
...@@ -158,7 +168,8 @@ libzmq_on_gnu="no" ...@@ -158,7 +168,8 @@ libzmq_on_gnu="no"
libzmq_on_debian_kfreebsd="no" libzmq_on_debian_kfreebsd="no"
# Set some default features required by ZeroMQ code # Set some default features required by ZeroMQ code
CPPFLAGS="-D_REENTRANT -D_THREAD_SAFE -Wno-long-long $CPPFLAGS" CPPFLAGS="-D_REENTRANT -D_THREAD_SAFE $CPPFLAGS"
CXXFLAGS="-Wno-long-long $CXXFLAGS"
# Will be used to add flags to pkg-config useful when apps want to statically link # Will be used to add flags to pkg-config useful when apps want to statically link
PKGCFG_LIBS_PRIVATE="" PKGCFG_LIBS_PRIVATE=""
...@@ -188,7 +199,8 @@ case "${host_os}" in ...@@ -188,7 +199,8 @@ case "${host_os}" in
;; ;;
*solaris*) *solaris*)
# Define on Solaris to enable all library features # Define on Solaris to enable all library features
CPPFLAGS="-Wno-sign-compare -D_PTHREADS $CPPFLAGS" CPPFLAGS="-D_PTHREADS $CPPFLAGS"
CXXFLAGS="-Wno-sign-compare $CXXFLAGS"
AC_DEFINE(ZMQ_HAVE_SOLARIS, 1, [Have Solaris OS]) AC_DEFINE(ZMQ_HAVE_SOLARIS, 1, [Have Solaris OS])
AC_CHECK_LIB(socket, socket) AC_CHECK_LIB(socket, socket)
AC_CHECK_LIB(nsl, gethostbyname) AC_CHECK_LIB(nsl, gethostbyname)
...@@ -602,14 +614,14 @@ AM_CONDITIONAL(HAVE_VMCI, test "x$have_vmci_ext" != "xno") ...@@ -602,14 +614,14 @@ AM_CONDITIONAL(HAVE_VMCI, test "x$have_vmci_ext" != "xno")
AC_LANG_PUSH([C++]) AC_LANG_PUSH([C++])
# Check how to enable -Wall # Check how to enable -Wall
LIBZMQ_LANG_WALL([CPPFLAGS="$libzmq_cv_[]_AC_LANG_ABBREV[]_wall_flag $CPPFLAGS"]) LIBZMQ_LANG_WALL([CXXFLAGS="$libzmq_cv_[]_AC_LANG_ABBREV[]_wall_flag $CXXFLAGS"])
if test "x$libzmq_werror" = "xyes" -a "x$libzmq_cv_[]_AC_LANG_ABBREV[]_sun_studio_compiler" != "xyes"; then if test "x$libzmq_werror" = "xyes" -a "x$libzmq_cv_[]_AC_LANG_ABBREV[]_sun_studio_compiler" != "xyes"; then
LIBZMQ_LANG_WERROR([CPPFLAGS="$libzmq_cv_[]_AC_LANG_ABBREV[]_werror_flag $CPPFLAGS"]) LIBZMQ_LANG_WERROR([CXXFLAGS="$libzmq_cv_[]_AC_LANG_ABBREV[]_werror_flag $CXXFLAGS"])
fi fi
if test "x$libzmq_pedantic" = "xyes"; then if test "x$libzmq_pedantic" = "xyes"; then
LIBZMQ_LANG_STRICT([CPPFLAGS="$libzmq_cv_[]_AC_LANG_ABBREV[]_strict_flag $CPPFLAGS"]) LIBZMQ_LANG_STRICT([CXXFLAGS="$libzmq_cv_[]_AC_LANG_ABBREV[]_strict_flag $CXXFLAGS"])
fi fi
AC_LANG_POP([C++]) AC_LANG_POP([C++])
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
*/ */
#include "testutil.hpp" #include "testutil.hpp"
#include "testutil_unity.hpp"
#include <unity.h> #include <unity.h>
...@@ -43,6 +44,7 @@ void test_app_meta_reqrep () ...@@ -43,6 +44,7 @@ void test_app_meta_reqrep ()
void *ctx; void *ctx;
zmq_msg_t msg; zmq_msg_t msg;
void *rep_sock, *req_sock; void *rep_sock, *req_sock;
char connect_address[MAX_SOCKET_STRING];
const char *req_hello = "X-hello:hello"; const char *req_hello = "X-hello:hello";
const char *req_connection = "X-connection:primary"; const char *req_connection = "X-connection:primary";
const char *req_z85 = "X-bin:009c6"; const char *req_z85 = "X-bin:009c6";
...@@ -84,8 +86,8 @@ void test_app_meta_reqrep () ...@@ -84,8 +86,8 @@ void test_app_meta_reqrep ()
TEST_ASSERT_EQUAL_INT (-1, rc); TEST_ASSERT_EQUAL_INT (-1, rc);
} }
rc = zmq_bind (rep_sock, "tcp://127.0.0.1:5555"); test_bind (rep_sock, "tcp://127.0.0.1:*", connect_address,
TEST_ASSERT_EQUAL_INT (0, rc); sizeof (connect_address));
l = 0; l = 0;
rc = zmq_setsockopt (req_sock, ZMQ_LINGER, &l, sizeof (l)); rc = zmq_setsockopt (req_sock, ZMQ_LINGER, &l, sizeof (l));
...@@ -101,7 +103,7 @@ void test_app_meta_reqrep () ...@@ -101,7 +103,7 @@ void test_app_meta_reqrep ()
rc = zmq_setsockopt (req_sock, ZMQ_METADATA, req_z85, strlen (req_z85)); rc = zmq_setsockopt (req_sock, ZMQ_METADATA, req_z85, strlen (req_z85));
TEST_ASSERT_EQUAL_INT (0, rc); TEST_ASSERT_EQUAL_INT (0, rc);
rc = zmq_connect (req_sock, "tcp://127.0.0.1:5555"); rc = zmq_connect (req_sock, connect_address);
TEST_ASSERT_EQUAL_INT (0, rc); TEST_ASSERT_EQUAL_INT (0, rc);
rc = zmq_msg_init_size (&msg, 1); rc = zmq_msg_init_size (&msg, 1);
......
...@@ -151,13 +151,15 @@ void test_router_notify_helper (int opt_notify) ...@@ -151,13 +151,15 @@ void test_router_notify_helper (int opt_notify)
size_t opt_more_length = sizeof (opt_more); size_t opt_more_length = sizeof (opt_more);
int opt_events; int opt_events;
size_t opt_events_length = sizeof (opt_events); size_t opt_events_length = sizeof (opt_events);
char connect_address[MAX_SOCKET_STRING];
// valid values // valid values
TEST_ASSERT_SUCCESS_ERRNO (zmq_setsockopt ( TEST_ASSERT_SUCCESS_ERRNO (zmq_setsockopt (
router, ZMQ_ROUTER_NOTIFY, &opt_notify, sizeof (opt_notify))); router, ZMQ_ROUTER_NOTIFY, &opt_notify, sizeof (opt_notify)));
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (router, ENDPOINT_0)); test_bind (router, "tcp://127.0.0.1:*", connect_address,
sizeof (connect_address));
void *dealer = test_context_socket (ZMQ_DEALER); void *dealer = test_context_socket (ZMQ_DEALER);
const char *dealer_routing_id = "X"; const char *dealer_routing_id = "X";
...@@ -166,7 +168,7 @@ void test_router_notify_helper (int opt_notify) ...@@ -166,7 +168,7 @@ void test_router_notify_helper (int opt_notify)
zmq_setsockopt (dealer, ZMQ_ROUTING_ID, dealer_routing_id, 1)); zmq_setsockopt (dealer, ZMQ_ROUTING_ID, dealer_routing_id, 1));
// dealer connects // dealer connects
TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (dealer, ENDPOINT_0)); TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (dealer, connect_address));
// connection notification msg // connection notification msg
if (opt_notify & ZMQ_NOTIFY_CONNECT) { if (opt_notify & ZMQ_NOTIFY_CONNECT) {
...@@ -188,7 +190,7 @@ void test_router_notify_helper (int opt_notify) ...@@ -188,7 +190,7 @@ void test_router_notify_helper (int opt_notify)
TEST_ASSERT_EQUAL (0, opt_more); TEST_ASSERT_EQUAL (0, opt_more);
// dealer disconnects // dealer disconnects
TEST_ASSERT_SUCCESS_ERRNO (zmq_disconnect (dealer, ENDPOINT_0)); TEST_ASSERT_SUCCESS_ERRNO (zmq_disconnect (dealer, connect_address));
// need one more process_commands() (???) // need one more process_commands() (???)
msleep (SETTLE_TIME); msleep (SETTLE_TIME);
...@@ -234,6 +236,7 @@ void test_handshake_fail () ...@@ -234,6 +236,7 @@ void test_handshake_fail ()
void *router = test_context_socket (ZMQ_ROUTER); void *router = test_context_socket (ZMQ_ROUTER);
int opt_timeout = 200; int opt_timeout = 200;
int opt_notify = ZMQ_NOTIFY_CONNECT | ZMQ_NOTIFY_DISCONNECT; int opt_notify = ZMQ_NOTIFY_CONNECT | ZMQ_NOTIFY_DISCONNECT;
char connect_address[MAX_SOCKET_STRING];
// valid values // valid values
TEST_ASSERT_SUCCESS_ERRNO (zmq_setsockopt ( TEST_ASSERT_SUCCESS_ERRNO (zmq_setsockopt (
...@@ -242,15 +245,16 @@ void test_handshake_fail () ...@@ -242,15 +245,16 @@ void test_handshake_fail ()
TEST_ASSERT_SUCCESS_ERRNO (zmq_setsockopt ( TEST_ASSERT_SUCCESS_ERRNO (zmq_setsockopt (
router, ZMQ_RCVTIMEO, &opt_timeout, sizeof (opt_timeout))); router, ZMQ_RCVTIMEO, &opt_timeout, sizeof (opt_timeout)));
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (router, ENDPOINT_0)); test_bind (router, "tcp://127.0.0.1:*", connect_address,
sizeof (connect_address));
// send something on raw tcp // send something on raw tcp
void *stream = test_context_socket (ZMQ_STREAM); void *stream = test_context_socket (ZMQ_STREAM);
TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (stream, ENDPOINT_0)); TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (stream, connect_address));
send_string_expect_success (stream, "not-a-handshake", 0); send_string_expect_success (stream, "not-a-handshake", 0);
TEST_ASSERT_SUCCESS_ERRNO (zmq_disconnect (stream, ENDPOINT_0)); TEST_ASSERT_SUCCESS_ERRNO (zmq_disconnect (stream, connect_address));
test_context_socket_close (stream); test_context_socket_close (stream);
// no notification delivered // no notification delivered
...@@ -271,6 +275,7 @@ void test_error_during_multipart () ...@@ -271,6 +275,7 @@ void test_error_during_multipart ()
* message, and delivert the notification as a new message. * message, and delivert the notification as a new message.
*/ */
char connect_address[MAX_SOCKET_STRING];
char long_str[128] = {0}; char long_str[128] = {0};
memset (long_str, '*', sizeof (long_str) - 1); memset (long_str, '*', sizeof (long_str) - 1);
...@@ -285,7 +290,8 @@ void test_error_during_multipart () ...@@ -285,7 +290,8 @@ void test_error_during_multipart ()
TEST_ASSERT_SUCCESS_ERRNO (zmq_setsockopt ( TEST_ASSERT_SUCCESS_ERRNO (zmq_setsockopt (
router, ZMQ_MAXMSGSIZE, &opt_maxmsgsize, sizeof (opt_maxmsgsize))); router, ZMQ_MAXMSGSIZE, &opt_maxmsgsize, sizeof (opt_maxmsgsize)));
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (router, ENDPOINT_0)); test_bind (router, "tcp://127.0.0.1:*", connect_address,
sizeof (connect_address));
// setup dealer // setup dealer
...@@ -295,7 +301,7 @@ void test_error_during_multipart () ...@@ -295,7 +301,7 @@ void test_error_during_multipart ()
TEST_ASSERT_SUCCESS_ERRNO ( TEST_ASSERT_SUCCESS_ERRNO (
zmq_setsockopt (dealer, ZMQ_ROUTING_ID, dealer_routing_id, 1)); zmq_setsockopt (dealer, ZMQ_ROUTING_ID, dealer_routing_id, 1));
TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (dealer, ENDPOINT_0)); TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (dealer, connect_address));
// send multipart message, the 2nd part causes a disconnect. // send multipart message, the 2nd part causes a disconnect.
......
...@@ -59,6 +59,7 @@ struct test_events_t : zmq::i_poll_events ...@@ -59,6 +59,7 @@ struct test_events_t : zmq::i_poll_events
fd (fd_), fd (fd_),
poller (poller_) poller (poller_)
{ {
(void)fd;
} }
virtual void in_event () virtual void in_event ()
......
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