Commit Graph

832 Commits

Author SHA1 Message Date
somdoron
c4d0146f2c problem: udp doesn't enforce correct usage of bind/connect
solution: enforce that dish and gram can only bind and radio can only
connect
2016-05-16 13:34:38 +03:00
somdoron
6db8f1e74b problem: test is using connect with dgram, dgram only support bind 2016-05-16 12:18:30 +03:00
Bitiquinho
23b3403fa5 Remove printf and add asserts on test 2016-05-15 15:37:33 -03:00
Bitiquinho
977e700893 Fix Copyright range 2016-05-15 15:37:33 -03:00
Bitiquinho
da14bb4bc2 Added ZMQ_DGRAM tests to build (Makefile.am and CMakeLists.txt) 2016-05-15 15:37:33 -03:00
Bitiquinho
94c53e541d Added test for ZMQ_DGRAM socket type (unicast and multicast) 2016-05-15 15:37:33 -03:00
Constantin Rack
bd66cfe6f8 Merge pull request #1991 from hitstergtd/x-testcov-zmq-2
Problem: zmq_poller_destroy can segfault
2016-05-14 08:17:41 +02:00
Joe Eli McIlvain
71ba7df781 Merge pull request #1987 from hitstergtd/x-reduce-cliserv-sends
Problem: test send count too high for AppVeyor CI environment
2016-05-12 20:15:08 -07:00
hitstergtd
e82e4ea13e Problem: test send count too high for AppVeyor
Solution:
Reduce send count so that the test does not timeout on AppVeyor CI
environment and older Windows boxes.
2016-05-13 04:04:08 +01:00
hitstergtd
477cc1cb12 Problem: zmq_poller_destroy parameter checking
Solution:
- Add checks for **poller_p_ to ensure that we do not segfault when either it
  or the value within it are NULL
- Add tests for the above and increase error state coverage
2016-05-12 18:09:59 +01:00
hitstergtd
4842b6bd81 Problem: No coverage for ctx termination errors
Solution:
- Add error state coverage for zmq_ctx_term(), zmq_term() and
  zmq_ctx_shutdown(); zmq_ctx_destroy() is already covered since it only
  calls zmq_ctx_term()
- Add coverage for zmq_term()
2016-05-12 17:47:08 +01:00
Erik Hugne
f81ef1bc72 tipc: add support for address domain suffix
The TIPC protocol bindings in ZeroMQ defaults to a lookup domain
of 1.0.0 to prevent 'closest first' search, and instead always
do round robin if several sockets in the network or node have
the same name published. In retrospect, this might have been a
bad idea because it won't work on standalone configurations.
We solve this by allowing an optional domain suffix to be provided
in the address, and 0.0.0 should be used in that case, or if the
TIPC address range in the cluster configuration is defined to some
other value. Domain suffixes are only relevant for connecting
addresses.

Signed-off-by: Erik Hugne <erik.hugne@gmail.com>
2016-05-11 21:54:25 +02:00
hitstergtd
206771afd2 Problem: Not all ancillary API methods tested
Solution:
- Add file for testing ancillary API methods and any misc internal machinery
- Add tests for zmq_version(3) and zmq_strerror(3)
- Add test file into gitignore, Autotools and CMake build files
- Increase test coverage

Note:
MSVC solution files have not been updated.
2016-05-08 18:25:03 +01:00
Doron Somech
be741f604a problem: timers test is flapping on windows 2016-05-05 14:24:47 +03:00
Doron Somech
a747f72450 problem:closed poller still associated with socket 2016-05-05 13:50:33 +03:00
somdoron
50c2f7af8f fix sndbuf/rcvbuf tests 2016-05-03 19:46:34 +03:00
Luca Boccassi
6de24c190a Problem: scatter/gather are not yet stable APIs
Solution: mark them as DRAFT APIs
2016-05-02 21:47:05 +01:00
Luca Boccassi
caaf66c32c Problem: radio/dish are not yet stable APIs
Solution: mark them as DRAFT APIs
2016-05-02 21:47:05 +01:00
Luca Boccassi
32a1ef85a8 Problem: zmq_timers* are not yet stable APIs
Solution: mark them as DRAFT APIs
2016-05-02 21:47:05 +01:00
Luca Boccassi
738968082b Problem: zmq_poller* are not yet stable APIs
Solution: mark them as DRAFT APIs
2016-05-02 21:47:05 +01:00
Luca Boccassi
7e700f1e73 Problem: client/server are not yet stable APIs
Solution: mark them as DRAFT APIs
2016-05-02 21:47:05 +01:00
Luca Boccassi
064cd1fbfb Problem: no support for DRAFT API in build systems
Solution: add support for --enable-drafts/ENABLE_DRAFTS=ON in
Autools and CMake.
2016-05-02 21:47:05 +01:00
Luca Boccassi
f0a34e0ff5 Problem: test_poller/use_fd_ipc/tcp use draft API
Solution: only use ZMQ_SERVER/CLIENT if the defines are available.
2016-05-02 21:46:47 +01:00
Luca Boccassi
c293618ae8 Problem: testutil.hpp includes platform.hpp last
Solution: before including internal headers, include platform.hpp
so that the build time options are correctly applied to the included
headers.
2016-05-02 20:00:53 +01:00
hitstergtd
40dbbe342e Problem: bounce() arguments reversed
Solution:
Put them in the right order to quiet Coverity.

Found by:
Coverity Scan
2016-05-01 21:40:08 +01:00
hitstergtd
e4539778a4 Problem: multiple issues with sendiov/recviov
Solution:
- Add check for the [count] parameter in zmq_sendiov() and zmq_recviov()
- Use and add test for zmq_sendiov() in tests/test_iov.cpp
- Add error state tests for zmq_sendiov() in tests/test_iov.cpp
- Add error state tests for zmq_recviov() in tests/test_iov.cpp
- Cleanup tests/test_iov.cpp for style, consistency and clarity
- Generally improve test coverage for both API methods

Hat-tip:
@somdoron, @bluca
2016-05-01 19:41:50 +01:00
Luca Boccassi
95acb29bfb Merge pull request #1934 from somdoron/master
problem: no documentation for Radio-dish and UDP
2016-04-29 10:40:56 +01:00
somdoron
34d5028ea8 allow specify binding address on radio with udp 2016-04-29 12:17:17 +03:00
hitstergtd
8872809337 Problem: XPUB test broken since #1566 on Windows
Solution:
- Adjust test_xpub_proxy_unsubscribe_disconnect() to support different
  protocol types
- Exclude the IPC tests on Windows and OpenVMS

H/T: @somdoron
2016-04-24 16:56:06 +01:00
Doron Somech
0655ed2e0e fix test unbind wildcard 2016-04-23 22:30:10 +03:00
Doron Somech
0934bc784d fix test term endpoint 2016-04-23 22:30:09 +03:00
Luca Boccassi
a93600309f Problem: assertion in test_xpub_manual is swapped
Solution: check that both pointers passed as arguments to
test_missing_subscription are non-NULL, instead of the opposite.
2016-04-23 18:16:49 +01:00
hitstergtd
ff02862171 Problem: XPUB test broken on Windows since #1569
Solution:
- Adjust test_subscriptions() to support different protocol types
- Run TCP and IPC tests everywhere but on Windows and OpenVMS
2016-04-23 16:18:38 +01:00
hitstergtd
7f0e380c05 Problem: LD search path warnings if using Clang
Solution: PR #1906 did not solve this problem properly; subsequent Travis CI
indicated that the issue happens with Clang/LLVM, so make sure to fix the
issue by detecting if Cmake CMake is using Clang for building the tests.
2016-04-21 22:32:15 +01:00
Luca Boccassi
5178251587 Problem: test_ipc_wildcard is ran on Windows
Solution: move it to the unix-only section of Makefile.am and
tests/CMakeLists.txt since it uses Unix IPC sockets.
2016-04-21 14:17:10 +01:00
Doron Somech
d6a57ad589 Merge pull request #1912 from hitstergtd/hitstergtd-testsrcfd-win-fix
Problem: ZMQ_SRCFD test does not work on Windows
2016-04-21 15:38:05 +03:00
hitstergtd
e8aeb3686d Problem: ZMQ_SRCFD test does not work on Windows
Solution: add Winsock specific assertions, since getpeername() should will
return SOCKET_ERROR (-1) and WSAGetLastError() will be set to WSAENOTSOCK
2016-04-21 13:24:02 +01:00
Hitster GTD
99763cce41 Merge pull request #1909 from somdoron/master
problem: push-pull socket types are not thread safe
2016-04-21 12:54:04 +01:00
somdoron
e6dae56c6e Scatter-Gather socket types 2016-04-21 14:50:58 +03:00
Luca Boccassi
ea294afd8b Problem: CMake does not check for TIPC support
Solution: add macro in ZMQSourceRunChecks.cmake and optionally
include the TIPC sources if the support is available.
More importantly, only run the TIPC tests if the support is there.
2016-04-21 11:33:20 +01:00
hitstergtd
846b2ba174 Problem: Linker search path warnings on OS X
Problem:
A per-test Linker search path was added in commit a911fa4 to CMakeLists.txt as
part of fixing Windows builds. Whilst this is silently ignored by ld(1) on
Linux, it doesn't settle well with OS X. Spurious warnings are generated about
missing directories leading to convoluted build logs.

Solution:
Make per-Test LINK_DIRECTORIES() conditional for non-Apple platforms.
2016-04-19 12:38:16 +01:00
Luca Boccassi
c8211bf320 Problem: can't unbind with bound addr with IPv6
Solution: try to resolve the TCP endpoint passed by the user in the
zmq_unbind call before giving up, if it doesn't match.
This fixes a breakage in the API, where after a call to
zmq_bind(s, "tcp://127.0.0.1:9999") with IPv6 enabled on s would
result in the call to zmq_unbind(s, "tcp://127.0.0.1:9999") failing.
Add more test cases to increase coverage on all combinations of TCP
endpoints.
2016-04-18 18:43:36 +01:00
Luca Boccassi
ac0e97e5dc Problem: can't test if IPv6 is available in tests
Solution: add helper function is_ipv6_available to testutil.hpp to
test if IPv6 is available on the building platform.
This function will try to open and bind a socket to ::1:*, as it's
the ultimate way of knowing if, at least on the loopback, IPv6 is
enabled.
2016-04-18 18:43:36 +01:00
hitstergtd
e09eb0db6f Problem: comment not well formed in CMakeLists.txt
Solution: fix comment
2016-04-18 16:33:34 +01:00
hitstergtd
9a9bfb6443 Problem: test_udp does not release resources properly
Solution:
- call zmq_msg_close() if there is an error
- call free() to release resources if there is an error (CWE-404)
2016-04-18 14:44:54 +01:00
hitstergtd
307bd952bc Make all Linux-specific tests conditional
Move tests specific to Linux under a platform conditional thereby eliminating
unnecessary builds and fixing "make test" on Mac OS X and possibly other
non-Linux systems.

Tests specific to Linux:
    - abstract namespace support for AF_UNIX sockets
    - TIPC support (AF_TIPC)

Test success rate jumps from 90% to 100% on Mac OS X after this change.
2016-04-14 23:44:17 +01:00
Constantin Rack
3f77cf5a2f Merge pull request #1892 from bluca/solaris_fixes 2016-04-13 05:18:12 +02:00
Luca Boccassi
a01baba38b Problem: test_use_fd_tcp does not work on Solaris
Solution: pass a struct addrinfo hint to getaddrinfo with a hint
about the address family to avoid a failure.
2016-04-13 00:32:19 +01:00
Patrik Wenger
621c965fae Problem: tricky return value from zmq::socket_poller_t::wait when poller is empty
Solution: return -1 (no event) instead of 0 (event)

For some reason, this just returns 0 if there are no sockets registered
on the poller. Usually this would mean there has been an event. So the
caller would have to check the return value AND the event, or write code
that takes the number of registered sockets into consideration.

By returning -1 and setting errno = ETIMEDOUT like in the usual timeout
cases, it's more consistent and convenient.

Test case included.
2016-04-12 20:11:50 +02:00
Satyajit Padalkar
e3016b66bd Fix tests/test_many_sockets.cpp 2016-04-07 23:41:09 -04:00
Frederic Tregon
625b618776 Fixed ZMQ_REQ_CORRELATE (see pull request #1730)
Problem: Since pull request #1730 was merged, protocol for REQ socket is
checked at the session level and this check does not take into account
the possibility of a request_id being part of the message. Thus the option
ZMQ_REQ_CORRELATE would no longer work.
This is now fixed: the possiblity of a 4 bytes integer being present
before the delimiter frame is taken into account (whether or not this
breaks the REQ/REP RFC is another issue).
2016-04-02 18:36:29 +02:00
Frederic Tregon
e45dfe3bc7 Fixed issue #1695 (ZMQ_REQ_CORRELATE)
Problem: when using ZMQ_REQ_RELAXED + ZMQ_REQ_CORRELATE and two 'send' are
executed in a row and no server is available at the time of the sends,
then the internal request_id used to identify messages gets corrupted and
the two messages end up with the same request_id. The correlation no
longer works in that case and you may end up with the wrong message.

Solution: make a copy of the request_id instance member before sending it
down the pipe.
2016-03-20 20:38:18 +01:00
Pieter Hintjens
340eb52165 Merge pull request #1847 from bluca/test_large_msg
Problem: test_large_msg requires 2GB of free RAM
2016-03-18 09:41:42 +01:00
Pete LaDow
075de03d1c Use FILENAME_MAX to determine BUFSIZE when getting socket path. 2016-03-17 15:12:57 -07:00
Luca Boccassi
15fd419f22 Problem: test_large_msg requires 2GB of free RAM
Solution: remove temporarily until proper message limits have been
implemented, then a more granular test case can be added without
such high requirements which are problematic in embedded environment,
build systems, VMs and CI systems
2016-03-16 21:47:58 +00:00
Luca Boccassi
11917f850a Problem: IPC wildcard test broken on OSX
Solution: increase path buffer length to 73
2016-03-14 22:39:34 +00:00
Suudy
b6080a798c Updated handling of Unix Domain Sockets, make use of temporary directories, and cleanup afterward. Fix test_term_endpoint handling of optvallen 2016-03-14 12:17:49 -07:00
Osiris
cd1dfb4092 Problem: CMakelist missing support for Windows Precompiled headers
Solution: Add precompiled flags to CMakeList.txt for faster compiles
+ bonus - removed compilation warning on Windows by adding
	 add_definitions (-D_WINSOCK_DEPRECATED_NO_WARNINGS)
2016-03-06 06:23:26 -06:00
Osiris
1c9cec227d Problem: Tests do no build in Windows environment
Solution: Modified CMakelist.txt to build correctly for Windows
- corrected CMake required version to make sure it builds in
  Ubuntu 14.04 LTS with no warnings.
2016-03-05 14:01:21 -06:00
Osiris
a911fa41b8 Problem: Tests do no build in Windows environment
Solution: Modified CMakelist.txt to build correctly for Windows
2016-03-05 11:23:23 -06:00
Pieter Hintjens
5b7bf7509f Problem: can't be sure crypto_box always returns 0
Libsodium has started returning -1 in some cases.

Solution: allow and handle error returns from these calls.

Fixes #1831
2016-03-01 15:01:23 +01:00
Luca Boccassi
facb512105 Problem: SETTLE_TIME is too short on slow systems
Solution: increase SETTLE_TIME from 50ms to 300ms to avoid failing on
slower environments like through Valgrind on slow VMs.
2016-02-13 18:17:36 +00:00
Luca Boccassi
217f6c438e Problem: tests README does not document msleep
Solution: suggest to use the common approach of msleep (SETTLE_TIME)
after a connect if necessary, rather than reimplementing a different
way.
2016-02-13 18:04:25 +00:00
Luca Boccassi
706c3b7c4b Problem: test_shutdown_stress_tipc broken on OSX/Cmake
Solution: include pthread.h in testutil.hpp, removed from
test_shutdown_stress_tipc in an earlier commit
2016-02-13 18:01:03 +00:00
Luca Boccassi
cb41201880 Problem: various tests fail in slow environments
Solution: add msleep (SETTLE_TIME) to test_immediate, test_spec_rep
and test_spec_router after the sockets are created and connected to
avoid failing when running in slower environment like through
Valgrind in underpowered VMs.
2016-02-13 18:01:03 +00:00
Luca Boccassi
4a84f8a02e Problem: tests use various sleep patterns to wait
Solution: use msleep (SETTLE_TIME) everywhere when waiting for the
connections/sockets to be settled instead of a variety of patterns
and functions to make tests more coherent.
2016-02-13 18:01:03 +00:00
Luca Boccassi
955b51dfd2 Problem: test_msg_ffn uses unitialised memory
Solution: memset temporary buffer before use to reduce Valgrind noise
2016-02-13 16:28:48 +00:00
Luca Boccassi
240190131c Problem: test_srcfd uses unitialised memory
Solution: memset temporary buffer before use to reduce Valgrind noise
2016-02-13 15:39:30 +00:00
Luca Boccassi
302c7bee50 Problem: test_fork does not clean up at exit
Solution: close socket and destroy context to reduce Valgrind noise
2016-02-13 11:35:51 +00:00
Luca Boccassi
f87888f80c Problem: test_router_mandatory_hwm uses unitialised memory
Solution: memset temporary buffer before use to reduce Valgrind noise
2016-02-13 11:35:51 +00:00
Luca Boccassi
cffc653535 Problem: test_pre_allocated_fd_tcp leaks addrinfo
Solution: free addrinfo to reduce Valgrind noise
2016-02-13 11:35:51 +00:00
Luca Boccassi
05ad915265 Problem: test_term_endpoint does not clean up at exit
Solution: close socket and destroy context to reduce Valgrind noise
2016-02-13 11:35:51 +00:00
Luca Boccassi
f8f8043222 Problem: test_msg_ffn uses unitialised memory
Solution: pass correct size to memcmp to avoid reading uninitialised
areas of the buffer.
2016-02-13 11:35:51 +00:00
Luca Boccassi
e177512c82 Problem: test_system does not clean up at exit
Solution: close socket and destroy context to reduce Valgrind noise
2016-02-13 11:35:51 +00:00
Pieter Hintjens
9c0d176d68 Problem: tests don't build on Windows
There were numerous small issues with test cases:

- some lacked the right source file header
- some were not portable at all
- some were using internal libzmq APIs (headers)

Solution: fixed and cleaned up.
2016-02-12 16:12:44 +01:00
Pieter Hintjens
bbcc79d188 Problem: tests don't build on Windows
There were numerous small issues with test cases:

- some lacked the right source file header
- some were not portable at all
- some were using internal libzmq APIs (headers)

Solution: fixed and cleaned up.
2016-02-12 15:48:37 +01:00
Pieter Hintjens
06acd76a21 Problem: people don't know how to write test cases
Solution: document the minimum rules in README.md
2016-02-12 15:48:37 +01:00
Pieter Hintjens
8230c0d396 Problem: gyp does not build tests
Solution: it's a lot of work to define the tests in project.gyp
so I did this using gsl to generate the JSON, from a small XML
list of the test cases.

To keep this, and the hundreds of .mk files, away from the root
directory, I've moved the gyp files into builds/gyp, where you
would run them.

It all seems to work now. Next up, OS/X and Windows :)
2016-02-12 11:31:38 +01:00
Pieter Hintjens
b49a60410a Problem: use of libsodium vs. tweetnacl is confused
It's unclear which we need and in the source code, conditional code
treats tweetnacl as a subclass of libsodium, which is inaccurate.

Solution: redesign the configure/cmake API for this:

* tweetnacl is present by default and cannot be enabled
* libsodium can be enabled using --with-libsodium, which replaces
  the built-in tweetnacl
* CURVE encryption can be disabled entirely using --enable-curve=no

The macros we define in platform.hpp are:

    ZMQ_HAVE_CURVE    1        //  When CURVE is enabled
    HAVE_LIBSODIUM    1        //  When we are using libsodium
    HAVE_TWEETNACL    1        //  When we're using tweetnacl (default)

As of this patch, the default build of libzmq always has CURVE
security, and always uses tweetnacl.
2016-02-11 13:32:01 +01:00
Pieter Hintjens
62c66ae7f7 Problem: test_large_msg kills my system temporarily
And I'm on a reasonably sized laptop. I think allocating INT_MAX
memory is dangerous in a test case.

Solution: expose this as a context option. I've used ZMQ_MAX_MSGSZ
and documented it and implemented the API. However I don't know how
to get the parent context for a socket, so the code in zmq.cpp is
still unfinished.
2016-02-09 10:55:09 +01:00
Luca Boccassi
edc4ee03e8 Problem: ZMQ_USEFD does not follow conventions
Solution: rename socket option (and variables and files) from usefd
to use_fd.
2016-02-09 09:36:14 +00:00
Luca Boccassi
c158178798 Problem: ZMQ_PRE_ALLOCATED_FD is too long
Solution: rename socket option (and variables and files) from
pre_allocated_fd to usefd.
2016-02-08 22:46:34 +00:00
Pieter Hintjens
a1f51b695f Problem: unclear rules for passing null arguments
Solution: be more explicit in the code, and in the zmq_recv man
page (which is the most unobvious case). Assert if length is not
zero and buffer is nonetheless null.
2016-02-06 14:13:13 +01:00
Pieter Hintjens
c8318912f5 Problem: test case is using internal API
It is poor style for test cases to use the internal API (i.e.
libzmq classes or header files), as this code serves the purpose
of teaching developers how to use the library (it doesn't do this
very well, it's an ambition).

Also, including headers in src/ creates problems when compiling.

Solution: remove use of src/macros.hpp.
2016-02-06 14:12:43 +01:00
Michael
7270d4de65 windows.hpp needs to be included before zmq.h
windows.hpp must be included first due to increases _WIN32_WINNT version
2016-02-06 23:31:56 +11:00
Michael
d06314df84 added windows includes as well as unix includes
added conditional includes for unix / windows
2016-02-06 23:19:10 +11:00
Michael
75bea4bc13 update for mingw's default _WIN32_WINNT
mingw defaults with _WIN32_WINNT as 0x0502 which doesn't define inet_pton(), so add a conditional check
2016-02-06 23:03:12 +11:00
Michael
05b5633b8d update for mingw's default _WIN32_WINNT
mingw defaults with _WIN32_WINNT as 0x0502 which doesn't define inet_pton(), so add a conditional check
2016-02-06 23:01:26 +11:00
Michael
596fd2408a added ZMQ_HAVE_WINDOWS check to _WIN32_WINNT usage 2016-02-06 22:59:58 +11:00
Michael
b98b1495af added ZMQ_HAVE_WINDOWS check to _WIN32_WINNT usage 2016-02-06 22:59:13 +11:00
Michael
595181d301 added ZMQ_HAVE_WINDOWS check to _WIN32_WINNT usage 2016-02-06 22:58:38 +11:00
Luca Boccassi
84ad4bf0ff Problem: cannot use new pre-allocated FD with TCP
Solution: parse the value set by the ZMQ_PRE_ALLOCATED_FD sockopt
when creating a new TCP socket and use it if valid.
Add new tests/test_pre_allocated_fd_tcp.cpp unit test.
2016-02-04 16:57:26 +00:00
Luca Boccassi
9b885b7c00 Problem: cannot use new pre-allocated FD with IPC
Solution: parse the value set by the ZMQ_PRE_ALLOCATED_FD sockopt
when creating a new IPC socket and use it if valid.
Add new tests/test_pre_allocated_fd_ipc.cpp unit test.
2016-02-04 16:57:26 +00:00
Luca Boccassi
4bcbb3055e Problem: cannot use pre-allocated FDs. Fixes #777
Solution: add new [set|get]sockopt ZMQ_PRE_ALLOCATED_FD to allow
users to let ZMQ use a pre-allocated file descriptor instead of
allocating a new one. Update [set|get]sockopt documentation and
test accordingly.

The main use case for this feature is a socket-activated systemd
service. For more information about this feature see:
http://0pointer.de/blog/projects/socket-activation.html
2016-02-04 16:57:26 +00:00
Pieter Hintjens
44c6b0484e Revert "Revert "Problem: deprecated use and reference of zmq_term"" 2016-02-01 23:00:06 +01:00
Pieter Hintjens
1708bfefb7 Revert "Problem: deprecated use and reference of zmq_term" 2016-02-01 22:41:51 +01:00
Constantin Rack
0d171563d0 Problem: tests use deprecated zmq_term function
Solution: replace all occurrences with `zmq_ctx_term`
2016-02-01 21:40:24 +01:00
Constantin Rack
7da3ee138e Problem: deprecated zmq_utils.h is still included
Solution: remove all remaining references to `zmq_utils.h`
2016-02-01 11:34:36 +01:00
somdoron
389e853c6d Fix compilation errors on windows 2016-01-30 13:29:41 +02:00
Doron Somech
add4e7675f Merge pull request #1744 from jcfr/fix-gcc-warnings
Fix unused-parameter/unused-but-set-variable/missing-field-initializers warnings
2016-01-30 09:08:09 +01:00
Jean-Christophe Fillion-Robin
46b02338e3 Style: Fix -Wunused-but-set-variable in test_stream_exceeds_buffer.cpp
This commit addresses the following warnings reported on gcc 5.2.1. In
the future, this will help reduce the "noise" and help catch warnings
revealing a serious problem.

8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---
/path/to/libzmq/tests/test_stream_exceeds_buffer.cpp: In function ‘int main()’:
/path/to/libzmq/tests/test_stream_exceeds_buffer.cpp:19:9: warning: variable ‘rc’ set but not used [-Wunused-but-set-variable]
     int rc = setsockopt(server_sock, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(enable));
         ^
8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---
2016-01-30 02:56:03 -05:00
Jean-Christophe Fillion-Robin
f329252dcb Style: Fix unused parameter compilation warnings
This commit addresses the following warnings reported on gcc 5.2.1. In
the future, this will help reduce the "noise" and help catch warnings
revealing a serious problem.

8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---
/path/to/libzmq/src/options.cpp:1048:36: warning: unused parameter ‘option_’ [-Wunused-parameter]
 bool zmq::options_t::is_valid (int option_) const
                                    ^

/path/to/libzmq/src/plain_client.cpp:146:30: warning: unused parameter ‘cmd_data’ [-Wunused-parameter]
         const unsigned char *cmd_data, size_t data_size)
                              ^

/path/to/libzmq/src/plain_client.cpp:146:30: warning: unused parameter ‘cmd_data’ [-Wunused-parameter]
         const unsigned char *cmd_data, size_t data_size)
                              ^

/path/to/libzmq/src/socket_base.cpp:1445:44: warning: unused parameter ‘group_’ [-Wunused-parameter]
 int zmq::socket_base_t::xjoin (const char *group_)
                                            ^
/path/to/libzmq/src/socket_base.cpp:1451:45: warning: unused parameter ‘group_’ [-Wunused-parameter]
 int zmq::socket_base_t::xleave (const char *group_)
                                             ^

/path/to/libzmq/src/radio.cpp:145:33: warning: unused parameter ‘msg_’ [-Wunused-parameter]
 int zmq::radio_t::xrecv (msg_t *msg_)
                                 ^
/path/to/libzmq/src/dish.cpp:164:32: warning: unused parameter ‘msg_’ [-Wunused-parameter]
 int zmq::dish_t::xsend (msg_t *msg_)
                                ^

/path/to/libzmq/tests/test_msg_ffn.cpp:32:16: warning: unused parameter ‘data’ [-Wunused-parameter]
 void ffn(void *data, void *hint) {
                ^

/path/to/libzmq/tests/test_timers.cpp:50:19: warning: unused parameter ‘timer_id’ [-Wunused-parameter]
 void handler (int timer_id, void* arg)
                   ^
8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---
2016-01-30 02:56:03 -05:00
Jean-Christophe Fillion-Robin
05e48cc6a9 ctest: Add missing test_udp and test_large_msg
This commit fixes the author warnings reported below. These tests
have originally been introduced in zeromq/libzmq@5ebfd17 and
zeromq/libzmq@5fe75f0.

8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---
CMake Warning (dev) at tests/CMakeLists.txt:133 (message):
  Test 'test_udp' is not known to CTest.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at tests/CMakeLists.txt:133 (message):
  Test 'test_large_msg' is not known to CTest.
This warning is for project developers.  Use -Wno-dev to suppress it.
8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---
2016-01-30 02:10:01 -05:00
somdoron
5ebfd1728f make udp support for radio-dish 2016-01-29 21:17:11 +02:00
somdoron
1960b4e8a9 Filtering messages on dish side 2016-01-29 10:53:47 +02:00
somdoron
5054f2eb61 radio-dish is sending the group as first frame 2016-01-29 10:53:47 +02:00
somdoron
68675e23d9 adds group to zmq_msg 2016-01-29 10:53:42 +02:00
somdoron
dc945998a4 missing virtual modifier or session_base 2016-01-28 18:31:05 +02:00
Constantin Rack
a539b0c6e8 Problem: copyright year is still 2015
Solution: update to 2016
2016-01-28 15:07:31 +01:00
somdoron
b8425a25cf radio-dish pattern 2016-01-27 18:22:48 +02:00
Constantin Rack
5c9bd5f0cb Problem: SIZE_MAX is not defined in all stdint.h includes
Solution: remove debug printf line completely
2016-01-20 19:30:21 +01:00
Constantin Rack
b7d42a4c4b Problem: SIZE_MAX is not defined
Solution: include stdint.h
2016-01-20 19:18:00 +01:00
Min RK
5fe75f0e43 truncate rc to INT_MAX
to avoid overflow for large messages

send/recv still succeed for large messages,
but `zmq_msg_size` must be used to get the true size.
2016-01-20 13:43:51 +01:00
somdoron
669c5697c2 fixing a bug: client over inproc receives msg with routing id set 2016-01-19 20:18:04 +02:00
Anonymous Maarten
be36423bc2 Problem: On Windows CI, the included file Windows.hpp could not be
found.
Solution: Include the source directory

Problem: _sleep is a library function of Windows.
Solution: use sleep_
2016-01-14 02:53:24 +01:00
Frederic Tregon
9bdb60577c Test for issue #1690 (ZMQ_REQ_RELAXED)
Current ZMQ_REQ_RELAXED test improvement to check that pipes are not closed
after executing two send() in a row with no recv() in between.
2016-01-03 15:28:07 +01:00
Pieter Hintjens
2566c02a9e Problem: CLIENT and SERVER don't check SNDMORE
These sockets don't handle multipart data, so if callers send it,
they drop frames, and things break silently.

Solution: if the caller tries to use ZMQ_SNDMORE, return -1 and
set errno to EINVAL.
2015-12-29 17:00:06 +01:00
Pieter Hintjens
7893a6ac26 Problem: zmq poller API is not CLASS conformant
Solution: change zmq_poller_close(p) to zmq_poller_destroy(&p)
2015-12-21 11:01:16 +01:00
Pieter Hintjens
f8b9ca5f42 Problem: zmq timers API is not CLASS conformant
If we're going to add CLASS-like APIs we should use the proper
syntax; specifically 'destroy' instead of 'close', which is a
hangover from the 'ZeroMQ is like sockets' model we're slowly
moving away from.

Solution: change zmq_timers_close(p) to zmq_timers_destroy(&p)
2015-12-21 10:56:37 +01:00
somdoron
aadaf99011 add timers API to libzmq 2015-12-18 12:23:22 +02:00
Ilya Kulakov
68b13fbddb Add the VMCI transport.
VMCI transport allows fast communication between the Host
and a virtual machine, between virtual machines on the same host,
and within a virtual machine (like IPC).

It requires VMware to be installed on the host and Guest Additions
to be installed on a guest.
2015-12-08 13:16:09 +06:00
Fedor Sheremetyev
234018d749 Add test demostrating that HWM applies to messages that have been already consumed. 2015-11-24 17:33:19 +00:00
Constantin Rack
5ba328d7f3 Problem: there is no test for setsockopt ZMQ_TCP_SEND/RECV_BUFFER
Solution: add test case
2015-11-13 10:44:00 +01:00
Anonymous Maarten
9930f1fc20 CTest: add missing tests + check for unknown tests 2015-10-24 00:17:52 +02:00
Anonymous Maarten
55ca9c5654 CMake: use libsodium if available, else use tweet_nacl 2015-10-23 04:06:57 +02:00
somdoron
da2bc60abe Removing zmq_pollfd as it is replaced by zmq_poller 2015-10-22 11:52:24 +03:00
somdoron
24fc0d4e89 drop the socket postfix from poller methods 2015-10-21 14:04:33 +03:00
somdoron
476ba22e0a ZMQ_Poller support more event types 2015-10-21 10:14:36 +03:00
somdoron
6501b8089f port zpoller to libzmq as zmq_poller 2015-10-18 21:07:23 +03:00
Richard Newton
3f4f3c1137 Fix windows cmake build 2015-09-14 13:21:20 +01:00
Constantin Rack
2c94bb42c5 Merge pull request #1578 from hintjens/master
Problem: drop tests on CLIENT/SERVER are misleading
2015-09-13 14:18:49 +02:00
Pieter Hintjens
50859e40b9 Problem: drop tests on CLIENT/SERVER are misleading
These sockets deal only with single part data (at present), so the
drop tests are misleading / inappropriate.

Solution: remove them.
2015-09-13 12:17:53 +02:00
Joe Eli McIlvain
fb57110b94 Merge pull request #1577 from hintjens/master
Various cleanups for CLIENT-SERVER sockets
2015-09-11 14:24:51 -07:00
Pieter Hintjens
6b00f40f74 Problem: test_client/server_drop_more are invalid
These tests connected CLIENT and SERVER to DEALER... this isn't
allowed. I changed to CLIENT-to-SERVER in both cases. The result
was aborts in client.cpp and server.cpp which cannot handle
invalid multipart data.

I removed the asserts in each of these in xsend.

Solution: fix the test cases and remove the (unwanted?) asserts
in client.cpp:xsend and server.cpp:xsend.
2015-09-11 17:07:50 -04:00
Pieter Hintjens
c2dffb9908 Problem: threadsafe test uses CLIENT-to-CLIENT
Solution: fix to use CLIENT-to-SERVER and increase number of messages
sent to 100K per thread, to better stress thread safety.
2015-09-11 17:01:27 -04:00
Pieter Hintjens
d416ffcec5 Problem: cannot build single test case in tests
This is due to the mangled include of platform.h, which was to make
CMake happy.

Solution: in CMakeLists.txt, define USING_CMAKE and then look for
platform.h in current directory if that is defined, else look in
../src/ as one would expect.
2015-09-11 16:42:26 -04:00
Pieter Hintjens
87f2dff38c Problem: zmq_msg_get_routing_id () is not consistent with API
We do not use 'get' for getters.

Solution: rename to zmq_msg_routing_id () for public API.
2015-09-11 13:15:00 -04:00
David Jelenc
64ffda90d2 Problem: Tests in Travis are failing randomly
Tests were failing, because some deque calls were causing undefined
behavior: calling front() or pop_front() on an empty deque. Such
calls are now safeguarded.
2015-09-06 01:49:50 +02:00
David Jelenc
8fd71d631d Fixed missing subscriptions on XPUB with manual subscriptions
The patch fixes the issue #1568.
2015-09-05 15:56:26 +02:00
David Jelenc
dd35e1db0f Problem: lingering subscriptions on XPUB sockets (#1566)
The patch fixes lingering subscriptions that occur upon disconnection
on XPUB sockets with option XPUB_MANUAL when used in a XPUB-XSUB
proxies.
2015-09-05 12:07:50 +02:00
Pieter Hintjens
1fdf8f78e4 Cleaned up test case 2015-09-02 09:55:19 +02:00
Richard Newton
096007c574 Fix zmq crash when calling shutdown with a pending inproc socket connect 2015-08-21 10:06:54 +01:00
Joe Eli McIlvain
61217a2686 Problem: Source files contain mixed tabs and spaces.
Solution: Convert to spaces and remove trailing whitespace in these files.
2015-08-20 07:46:34 -07:00
somdoron
4da5ff6a7d revert to original zmq_polland creating zmq_pollfd_poll for polling on pollfd 2015-08-17 18:57:47 +03:00
somdoron
d83b045347 rename poller to pollfd 2015-08-17 14:20:49 +03:00
somdoron
5bae6911af remove poller field, using fd instead 2015-08-17 11:56:23 +03:00
somdoron
1aaa893e02 add tests for polling on thread safe sockets 2015-08-16 13:57:28 +03:00
somdoron
34968771ca add an option to check if the socket is thread safe 2015-08-16 11:50:50 +03:00
Constantin Rack
effc26c695 Merge pull request #1476 from hintjens/master
Problem: lack test case for large stream messages
2015-08-12 10:03:45 +02:00
Constantin Rack
08c2a9274e Merge pull request #1514 from rikvdh/master
Merge fix for zeromq/zeromq4-1#52, getsockopt ZMQ_RCVMORE now resets all bits
2015-08-11 23:30:59 +02:00
Rik van der Heijden
5485d6e371 Check proxy return values in tests 2015-08-11 21:44:41 +02:00
Rik van der Heijden
c68e9a39bf Merge fix for zeromq/zeromq4-1#52, getsockopt ZMQ_RCVMORE now resets all bits 2015-08-11 21:37:50 +02:00
Pieter Hintjens
fd9bd1b2a5 Problem: broke Cmake build 2015-08-11 19:35:48 +02:00
Pieter Hintjens
11fba2b813 Fixed compile errors in test_stream 2015-08-11 19:34:25 +02:00
Pieter Hintjens
92c4decb69 Problem: lack test case for large stream messages
Solution: added to test_stream.cpp
2015-08-11 19:34:25 +02:00
Pieter Hintjens
a656b399cc Merge pull request #1496 from brian-peloton/macro-to-disable-test-timeout
Add a way to disable libzmq's internal test timeout.
2015-07-28 22:57:58 +02:00
Pieter Hintjens
94b6fca406 Merge pull request #1495 from brian-peloton/fix-test-flakiness
Increase sleep in test to fix flakiness under CPU load.
2015-07-28 22:57:46 +02:00
Pieter Hintjens
5dee46052d Merge pull request #1494 from brian-peloton/fix-partial-recv-in-test
Retry recv if it only returns part of a message during tests.
2015-07-28 22:57:35 +02:00
Brian Silverman
c4c5135db6 Retry recv if it only returns part of a message during tests.
Under linux 3.16.0-4-amd64, I was getting occasional test failures
before fixing this.
2015-07-28 13:48:48 -07:00
Brian Silverman
e449d7bfbd Fix test flakiness.
I'm pretty sure this is an issue with the test being too picky and not a
bug, but the behavior in this situation is not well documented.
2015-07-28 13:48:23 -07:00
Brian Silverman
f86bded783 Increase sleep in test to fix flakiness under CPU load. 2015-07-28 13:47:56 -07:00
Brian Silverman
cb0491ca18 Add a way to disable libzmq's internal test timeout.
It's nice to be able to disable libzmq's internal timeout when there's
another timeout in the test runner being used which gives nicer error
messages.
2015-07-28 13:47:19 -07:00
KIU Shueng Chuan
fd51b0e508 update test that relied on connect notifications to be disabled 2015-07-24 05:39:47 +08:00
Brian Silverman
18791f2bfb Fix several missing msg_t::close calls.
I traced memory leaks found using AddressSanitizer down to these.
2015-07-21 19:42:20 -07:00
Brian Silverman
a88524d388 Fix test_proxy hanging occasionally by setting ZMQ_LINGER to 0. 2015-07-20 19:41:23 -07:00
Jens Auer
23797120ff Fixed #1477 corruption in "zero-copy" raw_decoder for payloads larger than 8192 bytes #1477
Fixed wrong message::init arguments.
2015-07-20 22:22:13 +02:00
Dylan Cali
0f208c122d be pedantic and call zmq_close in tests 2015-06-28 22:32:15 -05:00
Dylan Cali
d14f419743 another errant comment 2015-06-28 21:29:23 -05:00
Dylan Cali
6dac5092ad fix errant comments 2015-06-28 21:27:06 -05:00
Dylan Cali
a9fd750e1c add tests for #949 2015-06-28 21:23:25 -05:00
Jonathan Reams
e9a5bc8d1e Fix units and default values for heartbeats options
Set the ZMQ_HEARTBEAT_TIMEOUT to default to the value of
ZMQ_HEARTBEAT_IVL if it's not explicitly set.
Change the units of ZMQ_HEARTBEAT_TTL to milliseconds in the API
and round down to the nearest decisecond so that all the options
are using the same units.
Make the maximum heartbeat TTL match the spec (6553 seconds)
2015-06-26 14:25:58 -04:00
Jonathan Reams
df0c7076bd Fix test_heartbeats compile in VS2013 2015-06-24 14:28:36 -04:00
Jonathan Reams
cbb3b176a6 Add ZMTP heartbeats
This commit adds ZMTP connection heartbeats described in
http://rfc.zeromq.org/spec:37/ZMTP.
2015-06-24 13:24:53 -04:00
Constantin Rack
15f9ee19cb Solution: allow brackets in tcp ipv6 address 2015-06-23 08:54:49 +02:00
Richard Newton
f696d0399c Fix tabbing 2015-06-10 16:47:23 +01:00
Richard Newton
8484e1606d Fix windows build 2015-06-10 16:43:59 +01:00
Min RK
fdb7d68056 test zmq_msg custom free-function
new allocation caused reference counters to lose track on copy
2015-06-08 15:18:53 -07:00
Min RK
f34cc24bd7 test proxy with single REP socket 2015-06-06 21:05:55 -07:00
Richard Newton
dc949624e1 Handle infinite hwms properly 2015-06-05 19:06:36 +01:00
Richard Newton
15eecf4cf4 Update high water marking to allow changing high water mark after connection established. 2015-06-05 17:14:55 +01:00
Richard Newton
dc105ffc78 Fix xpub test to set hwm before bind. 2015-06-05 12:19:48 +01:00
Richard Newton
9f8b8af926 Fail ZMQ_SNDHWM and ZMQ_RCVHWM setsockopt if already connected. 2015-06-05 10:43:40 +01:00
Kapp Arnaud
fb960147ca Introduce a failing test against zmq_setsockpt().
Problem: zmq_setsockpt() returns success when changing the
HWM after a bind or connect() even though the call has no effect.

Solution: Introduce a failing test a reminder we need to patch it.
2015-06-04 01:38:45 +02:00
Pieter Hintjens
a07244cda2 Merge pull request #1414 from hintjens/master
Problem: source file headers are somewhat confusing about LGPLv3
2015-06-02 23:40:52 +02:00
Pieter Hintjens
8620c3e032 Problem: source file headers are somewhat confusing about LGPLv3
Of course people still "can" distributed the sources under the
LGPLv3. However we provide COPYING.LESSER with additional grants.

Solution: specify these grants in the header of each source file.
2015-06-02 22:33:55 +02:00
ALEKSANDR MELNIKOV
1eb8e2a69f HPUX build and gmake check issues solution (#1412) 2015-06-02 20:17:15 +06:00
Jens Auer
d337cf5a96 Fixed out-of-bounds access when releasing socket handles. 2015-05-31 17:42:26 +02:00
Dan Riegsecker
f4f918ba73 Some test fail to build targeting less that Windows Vista
When targeting a version of Windows less than Windows Vista, the
security tests fail to build. Added a check for Windows version
and substituted inet_pton for inet_addr. Fixes libzmq issue #1396.
2015-05-07 16:52:37 -04:00
Rik van der Heijden
7b9e9b838d Issue #1382: Do not send data to backend when there are no listeners (+ tests) 2015-05-01 10:39:29 +02:00
Pieter Hintjens
0673cd4e69 Problem: test_disconnect_inproc sometimes fails
Solution: add settle pause after zmq_connect

Fixes #1340
2015-04-20 12:53:37 +02:00
Thomas Rodgers
d47980a6ed Allow zmq_msg_gets checks to assert rather than segfault 2015-02-19 20:28:10 -06:00
Thomas Rodgers
700f7bfede resolve #1347 addresses issue of no metadata on identity frame 2015-02-19 13:22:32 -06:00
Thomas Rodgers
8daa74dc77 Fix comment from prior commit 2015-02-18 13:05:05 -06:00
Thomas Rodgers
638ddeb404 resolve #1347 Support limited metadata for STREAM sockets 2015-02-18 12:28:58 -06:00
Doron Somech
a4de3df73e Revert "Bzimmerman cmake" 2015-02-12 21:29:09 +02:00
somdoron
bbdd8662ba thread safety - supporting windows 2015-02-12 18:54:23 +02:00
somdoron
6749c9b3eb thread safety 2015-02-12 18:54:22 +02:00
Bryan Zimmerman
caf4276710 removed packaged export
added version to builds
other cleanup
2015-02-09 10:47:05 -05:00
somdoron
79f162aa7b test the client socket can drop multi frame messages that being sent to it 2015-02-02 16:12:21 +02:00
somdoron
14a19cd5d4 test the server socket can drop multi frame messages that being sent to it 2015-02-02 15:57:30 +02:00
somdoron
862cd41c65 implement client socket type and drop messages when more flag is set on client and server 2015-02-02 11:59:13 +02:00
somdoron
5632b57b4a adds server socket type and routing id to msg 2015-02-02 01:17:37 +02:00
Pieter Hintjens
a7a512ab3d Problem: test cases are failing on slower PCs (eee PC)
Solution: raise timeouts from 100-150 msec to 250 msec
2015-01-30 11:57:31 +01:00
Julien Ruffin
cf2238f80e Added socket option ZMQ_INVERT_MATCHING.
ZMQ_INVERT_MATCHING reverses the PUB/SUB prefix matching. The subscription
list becomes a rejection list. The PUB socket sends messages to all
connected (X)SUB sockets that do not have any matching subscription.

Whenever the option is used on a PUB/XPUB socket, any connecting SUB
sockets must also set it or they will reject everything the publisher
sends them. XSUB sockets are unaffected because they do not filter out
incoming messages.
2015-01-26 17:59:43 +01:00
Richard Newton
415b49ba0d Fix Windows build 2015-01-26 09:12:07 +00:00
Constantin Rack
4ad2edff38 Merge pull request #1322 from hintjens/master
Problem: commit afb24b53 broke ZMQ_STREAM contract
2015-01-23 18:03:10 +01:00
Pieter Hintjens
6ced7027a0 Problem: commit afb24b53 broke ZMQ_STREAM contract
Symptom is that ZMQ_STREAM sockets in 4.1.0 and 4.1.1 generate zero
sized messages on each new connection, unlike 4.0.x which did not do
this.

Person who made this commit also changed test cases so that contract
breakage did not show. Same person was later banned for persistently
poor form in CZMQ contributions.

Solution: enable connect notifications on ZMQ_STREAM sockets using a
new ZMQ_STREAM_NOTIFY setting. By default, socket does not deliver
notifications, and behaves as in 4.0.x.

Fixes #1316
2015-01-23 15:25:40 +01:00
Constantin Rack
0d9852a2a5 Merge pull request #1321 from hintjens/master
Problem: copyright statements are out of date
2015-01-22 10:49:56 +01:00
Pieter Hintjens
94d9a4ffdf Problem: copyright statements are out of date
Solution: update for 2015

Fixes #1320
2015-01-22 10:32:37 +01:00
Thomas Rodgers
7d224d7871 Add 'Peer-Address' property to connection metadata
Allows non-C/C++ based clients easy access to the peer's IP address via
zmq_msg_gets(&msg, "Peer-Address") instead of zmq_msg_get(&msg, ZMQ_SRCFD)
followed by calls to getpeername and getnameinfo
2015-01-16 14:52:16 -06:00
Thomas Rodgers
7c0a644625 Remove of ZMQ_IDENTITY_FD socket option
Revert "linking fd to pipe identity via socket option"

This reverts commit fe3e8c5c70.

Conflicts:
	include/zmq.h
	src/pipe.hpp
	src/session_base.cpp
2015-01-09 17:28:50 -06:00
Thomas Rodgers
a450bdefec Revert "resolve #1292 ZMQ_IDENTITY_FD does not validate option_len"
This reverts commit 45c6815446.
2015-01-09 16:44:35 -06:00
Thomas Rodgers
45c6815446 resolve #1292 ZMQ_IDENTITY_FD does not validate option_len 2015-01-08 08:37:28 -06:00
DaiyuHurst
5d084cdfdd Implement a definitive cygwin target for libzmq. 2014-12-29 17:39:19 -05:00
Pieter Hintjens
eacd4d9cba Problem: test cases were sporadically failing
Solution: increase settle time for bind/unbind tests
2014-12-23 15:21:22 +01:00
Pieter Hintjens
04664f0ef7 Problem: 'bool' is not defined by default
zmq_atomic_counter_dec returned a 'bool' value, yet this isn't
defined by standard, so causes compile errors in upstream code.

Solution: return an int that can be safely converted to bool if
needed by bindings.
2014-12-23 15:20:10 +01:00
Pieter Hintjens
2de940b422 Problem: need atomic reference counting in several projects
Solution: as libzmq already provides this across all platforms,
expose an atomic counter API. I've not wrapped atomic pointers,
though someone who needs this may want to do so.
2014-12-23 01:14:38 +01:00
Min RK
5385a51527 craft vanilla socket security test messages
use explicit ZMTP/1.0 anonymous greeting
rather than HTTP request that just happened to work
2014-12-03 14:52:39 -08:00
Min RK
5a8b46e375 allow vanilla socket security tests to run on Windows
- add ws2tcpip.h
- alias close->closesocket
- increment port in sec_null test
2014-12-03 14:07:07 -08:00
Min RK
c35c0ca1bb test unauthenticated messages from vanilla sockets
fails on all auth mechanisms
2014-12-03 10:34:34 -08:00
Doron Somech
0ac0b04755 remove debug printf in test_xpub_welcome_msg 2014-11-26 15:53:50 +02:00
somdoron
768b62eb9d xpub welcome msg 2014-11-26 14:20:55 +02:00
somdoron
96e29f1455 Add manual control over subscriptions to Pub 2014-11-26 13:08:39 +02:00
Nikolay Amiantov
32b2d3034b Fix test_filter_ipc for cleared supplementary groups
This should fix part of [https://github.com/zeromq/libzmq/issues/1129].
2014-11-20 05:08:45 +03:00
Pieter Hintjens
b6e61d72b2 Problem: linger values other than -1 or 0 are unsafe
Solution: set defaults back to infinity, and add new context
option, ZMQ_BLOCKY that the user can set to false to get a
less surprising behavior on context termination. Eg.

    zmq_ctx_set (ctx, ZMQ_BLOCKY, false);
2014-11-17 11:56:59 +01:00
Constantin Rack
e00ea532df Add tests for issue #1094. 2014-11-07 17:35:41 +01:00
lysyloren
87c22364d6 Disable IPC testing on ipc-incapable systems in test_term_endpoint.cpp 2014-10-29 10:10:14 +01:00
lysyloren
f47960e4bc Added test and updated documentation for unbind wild-card * binded socket 2014-10-29 09:43:47 +01:00
Phillip Mienk
00b3bfab10 Remove local pgm configuration option, cleanup configure.ac, remove unused Makefile.am instances. 2014-10-13 19:10:36 -07:00
Martin Hurton
fe4396c597 Merge pull request #1188 from hintjens/master
Problem: stream_engine.cpp security can be downgraded
2014-09-19 20:16:09 +02:00
Pieter Hintjens
77f14aad95 Problem: stream_engine.cpp security can be downgraded
Solution: accept only the mechanism defined by the socket options.

I've not tested this yet, so it's a speculative fix.
2014-09-19 19:24:45 +02:00
Martin Hurton
8e9005d591 Merge pull request #1186 from hintjens/master
Problem: test_security_curve does't try wrong mechanisms
2014-09-18 10:09:49 +02:00
Pieter Hintjens
57ade6d5bb Problem: test_security_curve does't try wrong mechanisms
Solution: check that it rejects attempts to connect to a CURVE server
using NULL or PLAIN client.
2014-09-18 07:32:07 +02:00
evoskuil
8cd85857fb Fix potential redefinition of common DEBUG symbol, replace tabs. 2014-09-02 23:39:33 -07:00
evoskuil
d76536eb70 Default Travis clang build fails on unused variable 'MAX_SENDS'. 2014-08-28 18:25:35 -07:00
Richard Newton
8926cb3ddb Fix test broken when we changed FD_SETSIZE. 2014-08-26 08:36:51 +01:00
kreuzberger
212220dda7 Bugfix wrong CMakeLists.txt after rename of file 2014-08-12 21:34:30 +02:00
Pieter Hintjens
f20b70bef5 Cleaned up test_xpub_nodrop
Renamed test case to actually explain what it's testing, and cleaned up
the code a little.
2014-08-12 12:37:49 +02:00
Pieter Hintjens
785aebc6a8 Reworking Travis script 2014-08-12 12:37:49 +02:00
Pieter Hintjens
75d4f50be3 Problem: ZMQ_CURVE_SECRETKEY reads beyond end of Z85 data
Solution: change setsockopts on printable keys to expect 41, nor 40
bytes. Code still accepts 40 bytes for compatibility, and copies the
key to a well-terminated string before using it.

Fixes #1148
2014-08-12 12:37:49 +02:00
kreuzberger
f042ea9e26 better naming of flags and variables to real functionality: nodrop 2014-08-08 19:45:41 +02:00
kreuzberger
d9a3cc48d4 do not silently drop messages in publisher if hwm is reached 2014-08-08 19:36:00 +02:00
Pieter Hintjens
bbbe8d7832 Merge pull request #1154 from mrvn/pull-test_router_mandatory_hwm
Add test for HWM behaviour for mandatory ROUTER sockets over tcp
2014-08-07 13:09:54 +02:00
Goswin von Brederlow
893995e698 Add test for HWM behaviour for mandatory ROUTER sockets over tcp 2014-08-07 12:52:07 +02:00
Diego
6537e202d6 moved root CMakeLists.txt tests config to tests/CMakeLists.txt 2014-08-05 13:24:32 +02:00
Thomas Rodgers
03f097a541 Update zmq_msg_get(ZMQ_SHARED) to return true for type_cmsg messages 2014-07-29 13:43:38 -05:00
Ewen McNeill
829b1bb4d4 Include testutil.hpp if using SETTLE_TIME
Updated:
   tests/test_connect_delay_tipc.cpp
   tests/test_sub_forward_tipc.cpp
   tests/test_term_endpoint_tipc.cpp
2014-07-24 13:00:21 +12:00
Ewen McNeill
fc80e8cda1 z/OS: signal(SIGPIPE, SIG_IGN) for tests
Updated:
   tests/testutil.hpp: Add signal(SIGPIPE, SIG_IGN) to
        setup_test_environment(), on z/OS (__MVS__)
2014-07-23 13:39:45 +12:00
Pieter Hintjens
81b9f21bdd Merge pull request #1132 from rodgert/master
Added test and doc section for ZMQ_SHARED message flag
2014-07-13 02:03:51 +02:00
Thomas Rodgers
82282d6973 Added test and doc section for ZMQ_SHARED message flag 2014-07-12 18:05:49 -05:00
Richard Newton
31cff7ccf9 Add test for unbinding inproc socket. 2014-07-09 10:28:26 +01:00
Pieter Hintjens
a087ce55ea Problem: two header files for a single library
Users who need e.g. zmq_curve_keypair() have to remember to include
zmq_utils.h, which is counter-intuitive. The whole library should be
represented by a single include file.

Solution: merge all contents of zmq_utils.h into zmq.h, and deprecate
zmq_utils.h. Existing apps can continue unchanged. New apps can ignore
zmq_utils.h completely.
2014-06-27 15:58:18 +02:00
Pieter Hintjens
dd05a64462 Problem: zmq_msg_gets did not set errno on unknown properties
Solution: set errno to EINVAL when a property does not exist.

Also fixed test_metadata.cpp to test this case.
2014-06-25 17:28:36 +02:00
Pieter Hintjens
deaad00ad9 Problem: zmq_connect() does not validate TCP addresses
Since https://github.com/zeromq/libzmq/commit/350a1a, TCP addresses
get resolved asynchronously, so zmq_connect no longer returned an
error on incorrect addresses.

This is troublesome since we rely on some error checking to catch
blatant errors.

Solution add some upfront syntax checking that catches at least the
obvious kinds of errors (invalid characters, wrong or missing port
number).
2014-06-24 14:33:38 +02:00
Richard Newton
82be399527 Merge pull request #1097 from hintjens/master
Added capabilities API
2014-06-23 13:23:20 +01:00
chrox
bdf6427a00 Fixed build with arm-linux-androideabi toolchain 2014-06-22 18:13:05 +08:00
Pieter Hintjens
36db9c0803 Fixed compile error if Kerberos installed 2014-06-19 15:28:04 +02:00
Pieter Hintjens
f11d673ba9 Problem: need way to probe library capabilities
As libzmq is compiled with optional transports and security mechanisms,
there is no clean way for applications to determine what capabilities
are actually available in a given libzmq instance.

Solution: provide an API specifically for capability reporting. The
zmq_has () method is meant to be open ended. It accepts a string so
that we can add arbitrary capabilities without breaking existing
applications.

zmq.h also defines ZMQ_HAS_CAPABILITIES when this method is provided.
2014-06-18 15:19:07 +02:00
Richard Newton
1d236d81c8 Merge pull request #1090 from hintjens/master
Problem: zmq_ctx_get (ZMQ_MAX_SOCKETS) returns gibberish
2014-06-16 08:45:37 +01:00
Pieter Hintjens
188f7864ea Fixed testcase for ZMQ_MAX_SOCKETS 2014-06-11 21:25:46 +02:00
Dave Meehan
a1f8737976 Exclude test_abstract_ipc from non-Linux builds 2014-06-06 12:08:55 +01:00
Pieter Hintjens
cfc754f393 Merge pull request #1020 from jemc/inproc_simult
Add failing test reproducing issue #1015.
2014-05-23 16:03:15 +02:00
Joe Eli McIlvain
8b47d36875 Revert "Mark failing test for issue #1015 as XFAIL"
This reverts commit b6c577a9ec.
2014-05-22 12:21:32 -07:00
Pieter Hintjens
11175a33f1 Problem: security tests block on zmq_send
The expect_bounce_fail () helper assumed that messages could always
be sent. However in some cases zmq_send() blocks, due to there not
being any outgoing pipe. This changed in 77f5f7, where previously
there would be a pipe that kept trying to reconnect forever.

Solution: use a send timeout and check for EAGAIN if sending failed.
2014-05-20 15:42:35 +02:00
Pieter Hintjens
155feccb3f Merge pull request #1047 from mrvn/pull-testutil-expect_bounce_fail-send-timeout
Add a send timeout in expect_bounce_fail()
2014-05-19 17:52:27 +02:00
Goswin von Brederlow
2ba5af6d83 Set an alarm(60) in setup_test_environment() when not on windows so tests
will not block too long if they go wrong.
2014-05-19 17:03:41 +02:00
Goswin von Brederlow
0ebf94e429 Add a send timeout in expect_bounce_fail() so tests for authentication
failures don't block.
2014-05-19 17:03:24 +02:00
Pieter Hintjens
a9a15ccf6f Use different endpoint for each test step 2014-05-16 16:00:37 +02:00
Stoian Ivanov
6f5e7714cf test case for zmq_getsockopt/ZMQ_IDENTITY_FD 2014-05-13 15:19:48 +03:00
Daniel Shih
70b6516d96 add untracked test_stream_timeout into .gitignore and tests/Makefile.am 2014-05-11 23:46:51 +08:00
Joe Eli McIlvain
b6c577a9ec Mark failing test for issue #1015 as XFAIL 2014-05-09 14:06:17 -07:00
Joe Eli McIlvain
5cf74db6bb Add failing test reproducing issue #1015.
There is a race condition when connect and bind on a new inproc
endpoint happen "simultaneously" in threads.  Causes the error:
  Assertion failed: ok (ctx.cpp:474)
2014-05-09 11:02:01 -07:00
Will Strang
afe5fd87e9 Issue #1017: add ZMQ_HANDSHAKE_IVL time limit on connection handshake 2014-05-09 13:54:24 +00:00
Franco Fichtner
fff29a4a0c ipc: fail harder for abstract ipc on non-Linux
Using 'ipc://@abstract-socket' on non-Linux platforms yields inconsistent
behaviour.  Abstract sockets don't exist, so the literal file is created.
The test previously failed, but for a different reason: this is not the
directory you are looking for.  Now, zmq_bind() will fail for the right
reason: the socket can't be created.  Put the XFAIL back.
2014-05-05 23:26:06 +02:00
Franco Fichtner
69bd470103 tests: fix abstract ipc test by omitting slashes 2014-05-05 23:04:40 +02:00
Samuel Martin
6fdafc458a autotools: tests: disable test_fork if fork() is not available
fork() support is optional and its availability is correctly detected at
contfigure time.

But test_fork was all always built, preventing build for targets that do
not provide fork() from building successfully.

This pacth fixes the autotools on this point.
2014-05-03 21:55:03 +02:00
Pieter Hintjens
0d13971c05 Fixed compile error in test_security_null 2014-05-02 22:28:19 +02:00
Pieter Hintjens
84ed81c014 Added test_metadata
- also prioritize ZAP metadata over ZMTP metadata in case application
  uses same names.
2014-05-02 22:21:50 +02:00
Pieter Hintjens
d190325e4d Revert "Enlarge the race window for some test cases"
This reverts commit 2a84d25974.

Broke regression test on test_hwm.cpp.
2014-05-02 16:49:03 +02:00
Pieter Hintjens
0bc669b106 Merge pull request #1000 from daveab/feature/divide_by_zero_investigation
Feature/divide by zero investigation
2014-05-02 16:31:48 +02:00
dave b
2a84d25974 Enlarge the race window for some test cases
These changes cause an assertion in lb_sendpipe() when executing the test_security_plain testcase.
2014-05-02 14:32:14 +01:00
Pieter Hintjens
79ef02538f Port 9999 is unsafe for tests 2014-05-01 11:23:41 +02:00
Pieter Hintjens
408dea796f Merge pull request #993 from klnikita/src_addr_connect
Allow to set up a source address and port for outgoing tcp connections in zmq_connect
2014-04-30 14:57:08 +02:00
nikita kozlov
acb6807041 Allow to set up a source address and port for outgoing tcp connections in zmq_connect()
Few examples:
tcp:://192.168.0.4:55555;192.168.0.254:1234
tcp:://192.168.0.4:0;192.168.0.254:1234
tcp:://eth2:55555;192.168.0.254:1234
2014-04-30 14:43:37 +02:00
Pieter Hintjens
39ccfea036 Added more scaffolding for security
- additional messages to help people debugging security errors
2014-04-29 22:21:58 +02:00
Pieter Hintjens
d1232d144a Fixed NULL security test
Has some bits commented out due to #939, now work.

Note: there is an issue in libzmq when binding/unbinding or
connecting/disconnecting (I did not investigate deeper) the
same socket several times. Even closing the socket with zero
linger, zmq_ctx_term will block. The workaround in this test
case is to close the sockets for each test step.
2014-04-29 12:13:54 +02:00
Pieter Hintjens
9753de8566 Problem: zmq_socket_monitor code is dirty
Specifically:

* zmq_event_t should not be used internally in libzmq, it was
  meant to be an outward facing structure.

* In 4.x, zmq_event_t does not correspond to monitor events, so
  I removed the structure entirely.

* man page for zmq_socket_monitor is incomplete and the example
  code was particularly nasty.

* test_monitor.cpp needed rewriting, it was not clean.
2014-04-28 11:30:49 +02:00
Pieter Hintjens
8fcda0d5da Cleaned up XFAIL on resources
- this failing test was confusing users
- ZMTP v3.0 now does not define resources at all
- resources, along with other unimplemented aspects moved to
  RFC 37 ZMTP v3.1
2014-04-05 15:32:43 +02:00
Richard Newton
f5eebc2ae3 Remove delays and destroy/recreate context between tests 2014-03-17 13:41:02 +00:00
Richard Newton
e27a610897 Fix tabs 2014-03-17 12:32:21 +00:00
Richard Newton
26dc643205 Add delays in test_connect_rid to allow time for socket to close before address reuse. 2014-03-17 12:24:52 +00:00
Pieter Hintjens
b433adf49e Fixed comment 2014-03-16 11:53:40 +01:00
Mark Barbisan
350a1ac12b Allow TCP addresses to be re-resolved whenever there is a reconnection attempt 2014-03-12 13:28:37 -04:00
Olaf Mandel
e41c8cba0e Rename ZMQ_MAX_SOCKETS_MAX to ZMQ_SOCKET_LIMIT
As per suggestion by Pieter Hintjens. Also update wording in
zmq_ctx_set manual a bit.
2014-02-14 10:09:19 +01:00
Pieter Hintjens
1e9ea54bf6 Merge pull request #889 from olafmandel/MAX_SOCKETS_MAX
Add ZMQ_MAX_SOCKETS_MAX to zmq_ctx_get()
2014-02-13 19:15:01 +01:00
Laurent Alebarde
abf9d8b74e Revert "add a proxy hook"
This reverts commit 9ae6a91fad.
2014-02-13 18:35:09 +01:00
Laurent Alebarde
bc25366f7c Revert "add proxy_chain, a multi proxies chaining in the same thread feature"
This reverts commit bc7441f517.
2014-02-13 18:35:09 +01:00
Olaf Mandel
5815b768b9 Add ZMQ_MAX_SOCKETS_MAX to zmq_ctx_get()
The new options allows querying the maximum allowed number of sockets.
This is system dependent and cannot be encoded in the include file as a
preprocessor macro: for ZMQ_USE_SELECT, this depends on the FD_SETSIZE
macro at time of library compilation, not at time of include file use.
2014-02-13 15:54:06 +01:00
Richard Newton
668c42fc26 Fix hang on term when inproc is connected but never bound. 2014-02-12 23:10:23 +00:00
Pieter Hintjens
046e37e907 Test for 127.0.0.1 at tests startup 2014-01-29 20:16:58 +01:00