Commit Graph

929 Commits

Author SHA1 Message Date
Simon Giesecke
84a3767d61 Problem: open TODO comment regarding explicit zmq_disconnect/zmq_unbind
Solution: replaced by a comment explaining why the calls are in the test
2018-03-21 16:28:10 +01:00
Simon Giesecke
786a8d48d5 Problem: code duplication in test_reqrep_tcp
Solution: extracted make_connect_address
2018-03-21 15:09:23 +01:00
Simon Giesecke
8372797cc3 Problem: code duplication in test_reqrep_tcp
Solution: extracted bind_loopback
2018-03-21 15:09:22 +01:00
Simon Giesecke
c84c3a525a Problem: test_reqrep_tcp not yet using unity
Solution: migrate to unity
2018-03-21 15:09:19 +01:00
Simon Giesecke
6d89635f9a Problem: test_udp not using unity
Solution: migrate to unity, merge into test_radio_dish, and split up test cases
2018-03-16 17:03:45 +01:00
Simon Giesecke
dc2764f58c Problem: test_last_endpoint not using unity
Solution: migrate to unity
2018-03-16 16:35:31 +01:00
Simon Giesecke
1747cbdcac Problem: test_immediate not using unity
Solution: migrate to unity, and split test cases
2018-03-16 15:46:39 +01:00
Simon Giesecke
6f8b604648 Problem: test_radio_dish not using unity
Solution: migrate to unity, and split test cases
2018-03-16 15:22:14 +01:00
Simon Giesecke
cdc298f567 Problem: bind_loopback_ipv4 not reusable
Solution: Moved bind_loopback_ipv4 to testutil_unity to allow for reuse
2018-03-16 15:21:39 +01:00
Kachanovskiy
eb76ea06bd Fix for #2997 2018-03-16 12:48:00 +01:00
Luca Boccassi
4cb15ec638
Merge pull request #2994 from sigiesec/migrate-to-unity
Migrate further tests to unity, and split up into individual test cases
2018-03-15 16:55:05 +00:00
Simon Giesecke
7bd57ba83b Problem: test case tests multiple aspects
Solution: split test case
2018-03-15 16:43:34 +01:00
Simon Giesecke
3e374d98f1 Problem: test case tests multiple aspects
Solution: split test case
2018-03-15 16:43:33 +01:00
Simon Giesecke
eb0307a9a6 Problem: test case tests multiple aspects
Solution: split test case
2018-03-15 16:43:32 +01:00
Simon Giesecke
10dae6e830 Problem: test_poller not using unity
Solution: migrate to unity, and split test cases
2018-03-15 16:43:30 +01:00
Simon Giesecke
991b2336e4 Problem: test_thread_safe not using unity
Solution: migrate to unity, and split test cases
2018-03-15 16:43:27 +01:00
Simon Giesecke
5d32828bbf Problem: test_reconnect_ivl not using unity
Solution: migrate to unity, and reduce code duplication
2018-03-15 16:43:26 +01:00
Luca Boccassi
e388774737
Merge pull request #2981 from eponsko/master
Problem: no support for ZMTP 3.1 application metadata
2018-03-15 12:57:40 +00:00
Simon Giesecke
1e217ac063 Problem: unity built with unnecessary float but without command line argument support
Solution: add appropriate definitions to build
2018-03-15 11:28:50 +01:00
Simon Giesecke
f92cdf9470 Problem: test_ctx_destroy not using unity, and mixing test cases
Solution: migrate to unit and split up test cases
2018-03-15 10:58:56 +01:00
Simon Giesecke
9553a1f33e Problem: test_connect_resolve not yet using unity
Solution: migrate to unity
2018-03-14 22:40:24 +01:00
Simon Giesecke
6f9459e3fb Migrate tests/test_conflate.cpp to unity 2018-03-14 19:05:19 +01:00
Simon Giesecke
d318c95bc2 Problem: different aspects mixed in one test case
Solution: split up test case
2018-03-14 18:59:36 +01:00
Simon Giesecke
dbcd42c58d Migrate tests/test_client_server.cpp to unity 2018-03-14 18:45:26 +01:00
Simon Giesecke
0114572ce6 Migrate tests/test_bind_src_address.cpp to unity 2018-03-14 18:45:25 +01:00
Simon Giesecke
be33dce68e Migrate tests/test_bind_after_connect_tcp.cpp to unity 2018-03-14 18:45:25 +01:00
Simon Giesecke
631de94563 Problem: test_router_hangover not yet using unity
Solution: migrate to unity
2018-03-14 15:09:13 +01:00
Pontus Sköldström
dd5eec35be Support application metadata through ZMQ_METADATA
Lets the application set per-connection metadata.
Metadata is specified as "X-key:value" and set using zmq_setsockopt, eg:
zmq_setsockopt (s, ZMQ_METADATA, "X-key:value", 11);

The peer can then obtain the metadata from a received message:
char *data = zmq_msg_gets(msg, "X-key");
2018-03-14 12:56:15 +01:00
Simon Giesecke
59157f0e2f Problem: missing guidelines on proper test cleanup
Solution: add guidelines to tests/README.md
2018-03-14 12:26:06 +01:00
Simon Giesecke
9e3932b46b Problem: test assertion failures do not clean up properly
Solution: provide test_context and manage sockets of test_context via setup and teardown
2018-03-14 12:24:21 +01:00
Simon Giesecke
437e9f4f59 Problem: tests readme outdated
Solution: fixed description for building tests, added references to unity and unittests
2018-03-14 08:22:23 +01:00
Simon Giesecke
ae558706bf Problem: test_hwm and test_router_mandatory not yet using unity
Solution: migrate to unity
2018-03-14 08:22:23 +01:00
Luca Boccassi
19060345e4 Problem: TIPC availability check is too strict (#2977)
* Problem: TIPC availability check is too strict

Solution: at build time only check if the API is available. In the tests
do a first check and a skip if the functionality is not available.

TIPC needs an in-tree but not loaded by default kernel module, tipc.ko
to be loaded, which requires root, so it is unlikely to be available on
any build system by default.
This will allow most distributions to ship with TIPC support built in,
and to avoid tests failure if the module is not there.

* Problem: no Travis tests for TIPC

Solution: mark one job with sudo: required and load the kernel module

* Problem: CMake fails when test returns 77 (skip)

Solution: set property to let it mark the test as skipped as intended
2018-03-09 17:47:42 +01:00
Pontus.Skoeldstroem
7abb8388d6 Problem: Tests for different TIPC address types missing (#2956)
* Tests for different TIPC address types and code cleanup

* Adds tests for binding/connecting with different TIPC address types
  using Unity
* Adds error checking for address type misuse
2018-03-07 17:31:26 +00:00
Stefan Kaes
fcbd2a5710 Problem: enormous memory increase due to zero copy decoding
The zero copy decoding strategy implemented for 4.2.0 can lead to a large
increase of main memory usage in some cases (I have seen one program go up to
40G from 10G after upgrading from 4.1.4). This commit adds a new option to
contexts, called ZMQ_ZERO_COPY_RECV, which allows one to switch to the old
decoding strategy.
2018-03-05 18:13:28 +01:00
Luca Boccassi
354491ddf2 Problem: no test for ZMQ_XPUB_VERBOSE(R)
Solution: add test_xpub_verbose to cover those APIs
2018-03-02 13:42:44 +01:00
Simon Giesecke
0458b85dec Problem: Some tests timeout on appveyor for POLLER=poll
Solution: Increase test timeouts for poll poller under Windows
2018-02-13 18:38:26 +01:00
Simon Giesecke
922053237f Problem: test_sockopt_hwm not using unity
Solution: migrate test_sockopt_hwm to unity
2018-02-13 18:38:23 +01:00
Simon Giesecke
9ec95f9d46 Problem: build failure with VS <2015, has no snprintf
Solution: use _snprintf when snprintf is not available
2018-02-11 17:33:13 +00:00
sigiesec
5f854a31b7 Problem: test_security_curve not using test framework
Solution: use unity in test_security_curve
2018-02-11 17:25:36 +00:00
sigiesec
21879abb5b Problem: test_socket_null not using test framework
Solution: rewrite test_socket_null to use unity
2018-02-11 17:25:36 +00:00
sigiesec
61a28a26cc Problem: no test framework
Solution: add unity test framework, and integrate into cmake build
2018-02-11 17:25:36 +00:00
Luca Boccassi
9b1ce59719 Problem: DRAFT build broken with GCC 4.7
Solution: change variable type in test_timers to match public API
2018-02-10 17:08:01 +00:00
Simon Giesecke
a5e763039d Problem: use of TCP loopback fastpath not available for user sockets
Solution: add socket option
2018-02-09 14:22:42 +01:00
sigiesec
50d80d0835 Problem: test_timeo frequently fails on travis, probably because of slow
execution

Solution: relax test assertion to what can be guaranteed
2018-02-09 09:56:38 +01:00
sigiesec
88d8c768d1 Problem: test_timers frequently fails on travis-ci
Solution: relaxed test assertions, based on the actual time passed,
instead of assuming that this equals to the time slept
2018-02-09 09:55:40 +01:00
sigiesec
41f459e1dc Problem: formatting inconsistent
Solution: applied clang-format
2018-02-02 15:47:43 +01:00
Luca Boccassi
0298d037d0 Problem: CMake rebuilds everything twice
Solution: build all the objects separately before the link step, to
avoid rebuilding when doing both static and shared builds
2017-11-20 15:55:35 +00:00
Luca Boccassi
5264d49eab Problem: duplicate definition in CMake tweetnacl builds
Solution: don't redefine preprocessor macro if it's already defined in
platform.hpp
2017-11-19 12:47:05 +00:00
Luca Boccassi
de8f14adf5 Problem: test_security_{zap|curve} often hangs
Solution: set 0 linger on the sockets immediately after creating them
rather than immediately before closing them.
Running through helgrind/drd highlights a few race conditions, one of
which is the setting of linger vs checking it when closing the socket.
Work around it by setting it immediately to fix the test hangs.
2017-11-16 00:44:29 +00:00
Luca Boccassi
498c6bbb67 Problem: test_stream_exceeds_buffer cannot be ran in parallel
Solution: bind to wildcard and let the OS pick a free port instead
of using an hard-coded 12345 TCP port
2017-11-10 09:49:54 +00:00
Rolf Timmermans
c8592dfbc3 Problem: REQ socket with ZMQ_REQ_RELAXED does not report ZMQ_POLLOUT when queried for events after first message.
Solution: Check for strictness before returning false if no reply has been received.
2017-11-08 09:55:14 +01:00
f18m
2aa0e6fd4d Change ZMQ_THREAD_AFFINITY to ZMQ_THREAD_AFFINITY_CPU_ADD/ZMQ_THREAD_AFFINITY_CPU_REMOVE. Avoid prefix thread names when no prefix was set. 2017-10-25 09:55:47 +02:00
Luca Boccassi
bd2ff7fbf8 Problem: DRAFT build broken with old GCC due to missing SIZE_MAX
Solution: define __STDC_LIMIT_MACROS in test_timers.cpp before
including testutil.hpp so that the definitions are included
2017-10-17 14:13:28 +01:00
Luca Boccassi
2e2c22dd5b Problem: DRAFT build broken with old GCC due to GNU modifier
Solution: print unsigned integers instead of size_t to avoid the error:

  error: ISO C++ does not support the 'z' gnu_printf length modifier

due to very old version of GCC.
2017-10-17 13:36:10 +01:00
f18m
f25cd6e7be Background thread names (#2784)
* Add ZMQ_THREAD_NAME_PREFIX ctx option
2017-10-17 12:06:50 +01:00
Luca Boccassi
4c2a95eab2 Problem: test_ctx_options only checks global DRAFT flag
Solution: this will break once the tested APIs move from DRAFT to STABLE
so instead check for the specific macros.
2017-10-16 12:34:13 +01:00
f18m
bfbb4ff2e9 Background threads enhancements (#2778)
* Background thread scheduling 

- add ZMQ_THREAD_AFFINITY ctx option; set all thread scheduling options
from the context of the secondary thread instead of using the main
process thread context!
- change ZMQ_THREAD_PRIORITY to support setting NICE of the background
thread when using SCHED_OTHER
2017-10-16 12:29:03 +01:00
Luca Boccassi
b6aee51691 Problem: strict ZAP protocol adherence is backward incompatible
Solution: add ZMQ_ZAP_ENFORCE_DOMAIN to hide backward incompatible
change and make it disabled by default.
In a future release that breaks API compatibility we can then switch
the default to enabled in order to achieve full RFC compatibility.

Fixes #2762
2017-10-09 17:48:33 +01:00
Luca Boccassi
ed64585e93 Problem: test_rebind_ipc might not see race condition on fast envs
Solution: pre-create the second socket to save a few cycles between
closing the old one and binding the new one
2017-10-06 11:32:14 +01:00
Luca Boccassi
53f463a3fa Problem: test_rebind_ipc uses generic socket file name
Solution: name it after the test to avoid possible clashes when
running tests in parallel.
2017-10-06 11:08:40 +01:00
Ilya Kulakov
656cdb959a Problem: Race condition in IPC sockets
Solution: Don't unlink file on close

File may not belong to the socket at that point.
2017-10-05 14:57:10 -07:00
Luca Boccassi
44f96a3652 Merge pull request #2745 from sigiesec/rename-identity
Problem: term "identity" is confusing
2017-09-20 10:08:45 +02:00
Constantin Rack
f6688f0516 Merge pull request #2756 from bluca/reconnect_ivl_connect
Problem: zmq_connect fails after disconnect due to RECONNECT_IVL == -1
2017-09-20 07:46:19 +02:00
sigiesec
4b821d8f84 Problem: remaining uses of "identity"
Solution: replaced by "routing id"
2017-09-19 17:54:59 +02:00
sigiesec
1414bf938c Problem: use of unqualified "id" in code example
Solution: use "routing_id" instead
2017-09-19 17:54:52 +02:00
sigiesec
41bae55af7 Problem: inconsistent naming related to routing ids
Solution: renamed routing_id fields in pipe_t, renamed ZMQ_CONNECT_RID to ZMQ_CONNECT_ROUTING_ID
2017-09-19 17:53:53 +02:00
sigiesec
9e7507b38b Problem: term "identity" is confusing
Solution: replace by "routing id"
2017-09-19 17:53:44 +02:00
Luca Boccassi
edb4ca1023 Problem: zmq_connect fails after disconnect due to RECONNECT_IVL == -1
Solution: when a connection breaks and ZMQ_RECONNECT_IVL is set to -1,
which means a reconnection will not be attempted, send a message from
the I/O thread to the application thread to make the socket call
term_endpoint, which is the equivalent of manually calling
zmq_disconnect.
This way subsequent zmq_connect call to the same endpoint will attempt
again to do a connection.
Otherwise, for some socket types like SUBs, those new connects will
fail as the endpoint is recorded, despite the connection having been
permanently closed.

Add test cases to exercise this corner case with TCP and IPC.
2017-09-19 14:05:43 +01:00
sigiesec
e0243dcbca Problem: tests where client should receive an ERROR sometimes do not
receive an ERROR (probably because the connection is closed before)

Solution: wait for client-side monitor events before closing the client
socket

Fixes #2705
2017-09-19 11:16:05 +02:00
sigiesec
77f76a49b2 Problem: no tests for cases 5 and 6 of #2711
Solution: added tests
2017-09-18 18:43:32 +02:00
sigiesec
e546f9296e Problem: duplicated code & inconsistent behaviour between
mechanisms

Solution: uniformly require a ZAP domain to be set to activate ZAP
handling, clarify comment on Stonehouse pattern
2017-09-18 17:01:38 +02:00
sigiesec
ee8b8bd29c Problem: no test for ZAP handler terminating in flight
Solution: added test & some improvements of test utils
2017-09-18 16:54:03 +02:00
sigiesec
a5f94cb610 Problem: tests without ZAP handler are failing
Solution: emit events as expected by tests, and refuse connections when
ZAP is required but no handler started

Addresses #2711 partially
2017-09-18 12:58:09 +02:00
sigiesec
13b972b226 Problem: no tests without ZAP handler where one is expected
Solution: added test case for NULL/PLAIN/CURVE
2017-09-18 10:26:28 +02:00
Doron Somech
af03241dcb Revert "Problem: term "identity" is confusing" 2017-09-07 15:47:43 +03:00
sigiesec
e00131dd43 Problem: inconsistent naming related to routing ids
Solution: renamed routing_id fields in pipe_t, renamed ZMQ_CONNECT_RID to ZMQ_CONNECT_ROUTING_ID
2017-09-07 10:33:13 +02:00
sigiesec
1daf83079a Problem: term "identity" is confusing
Solution: replace by "routing id"
2017-09-06 17:45:56 +02:00
Luca Boccassi
b8695a47b5 Problem: proxy_steerable STATISTICS returns conflated buffers
Solution: split each stat into its own frame, to make it simpler and
easier to use it, especially from high level bindings
2017-09-06 01:28:28 +01:00
Luca Boccassi
78c4d33600 Problem: new STATISTICS proxy_steerable not behind DRAFT
Solution: ifdef it until it's declared stable
2017-09-05 17:37:52 +01:00
Luca Boccassi
c5aef5e078 Problem: compilation fails on 32 bit
Solution: trucate 64 bit stats in test_proxy, as it's much easier than
to try and print 64 unsigned integers in a portable way
2017-09-05 17:23:08 +01:00
f18m
4be9513443 Add "STATISTICS" command to zmq_proxy_steerable() (#2737)
* Issue #2736: Add STATISTICS command to zmq_proxy_steerable()
2017-09-05 17:05:04 +01:00
Luca Boccassi
0382118371 Problem: unused variable in test_wait_corner_cases
Solution: don't pass it
2017-09-01 19:55:51 +01:00
sigiesec
f3b268d84f Problem: no tests for error cases of zmq_socket_get_peer_state
Solution: added tests
2017-09-01 16:28:59 +02:00
sigiesec
eeccbbd6f8 Problem: test case fails with tcp transport
Solution: use inproc transport instead
2017-09-01 16:28:59 +02:00
sigiesec
fc334bc759 Problem: unclean and duplicated test code
Solution: refactoring
2017-09-01 16:28:59 +02:00
sigiesec
f70097c1cf Problem: test does not trigger HWM
Solution: modify order of operations, add diagnostic output
2017-09-01 16:28:59 +02:00
sigiesec
cda20260b3 Problem: missing call to zmq_poller_destroy
Solution: added call
2017-09-01 16:28:58 +02:00
sigiesec
efa86fe629 Problem: no test case using the proposed zmq_socket_get_peer_state function
Solution: added test case (with dummy implementation of zmq_socket_get_peer_state)
2017-09-01 16:28:58 +02:00
sigiesec
49e1b8b75f Problem: test case in main function
Solution: extracted test_basic function
2017-09-01 16:28:57 +02:00
Luca Boccassi
fab14a3cc1 Problem: support for CMake << 3.1 broken
Solution: remove redundant target_sources directive
2017-09-01 10:59:48 +01:00
sigiesec
7eebed56a5 Problem: no test for zmq_timers_timeout without any active timers
Solution: add test
2017-08-23 10:31:44 +02:00
sigiesec
6147e45a07 Problem: missing tests for zmq_timers_* corner cases, missing handling of such corner cases, code duplication, missing assertions in test code
Solution: add tests, add checks to timers_t, add match_by_id functor, add assertions
2017-08-23 09:41:34 +02:00
sigiesec
d072d57e2e Problem: no tests for zmq_timer_* with NULL timers argument
Solution: added tests
2017-08-23 09:41:22 +02:00
sigiesec
8b263d5820 Problem: test_timers.cpp sleep_ duplicates msleep from testutil
Solution: replace sleep_ my msleep
2017-08-23 09:05:10 +02:00
sigiesec
8ae91fdf9a Problem: no test cases for zmq_poller_add*, zmq_poller_modify*, zmq_poller_remove* corner cases
Solution: added test cases
2017-08-22 20:22:39 +02:00
sigiesec
68f416c0ca Problem: missing test case for zmq_poller_wait_all with negative number of events
Solution: add test case
2017-08-22 20:04:55 +02:00
sigiesec
a71f7b0405 Problem: zmq_poller_* uses ETIMEDOUT (instead of the usual EAGAIN) to indicate timeouts
Solution: replace ETIMEDOUT within socket_poller_t and all client code by EAGAIN

Fixes #2713
2017-08-22 20:00:29 +02:00
sigiesec
6a3c053a3e Problem: EFAULT is returned for bad file descriptors passed to zmq_poller_*_fd
Solution: Return EBADF instead
2017-08-22 19:43:56 +02:00
sigiesec
74303b08e6 Problem: calling zmq_poller_wait* with NULL events causes an assertion, as opposed to other NULL arguments, which return an error
Solution: return EFAULT when such an operation is attempted
2017-08-22 19:43:56 +02:00
sigiesec
c1a4cfdd9f Problem: waiting on an empty poller with infinite timeout waits forever
Solution: return EFAULT when such an operation is attempted
2017-08-22 19:43:56 +02:00
sigiesec
0c9b16d62a Problem: missing test cases for zmq_poller_* functions called with invalid arguments and corner cases for zmq_poller_wait_*
Solution: added test cases
2017-08-22 19:43:42 +02:00
sigiesec
2e4fc4faf0 Problem: zmq_poller_*_fd functions do not check for invalid fd
Solution: add checks, added test cases
2017-08-22 19:28:07 +02:00
sigiesec
f9af5503b4 Problem: missing test cases for zmq_poller_* functions called with invalid arguments
Solution: added test cases
2017-08-22 19:28:07 +02:00
sigiesec
9a336622fb Problem: no tests for socket-related functions passing NULL as socket
Soluton: added tests
2017-08-22 16:22:38 +02:00
Simon Giesecke
0aef54421d Problem: test_monitor is disabled on Windows
Solution: enable test
2017-08-21 12:20:37 +02:00
Simon Giesecke
82227136ea Problem: test_monitor sometimes fails due to a wrong event received, but not known which
Solution: add diagnostic output
2017-08-21 12:20:36 +02:00
Simon Giesecke
74203729bd Problem: test_zap_unsuccessful_status_500 and test_curve_security_with_bogus_client_credentials sometimes fail, particulary on slow/valgrind runs
Solutio: relax test assertion
2017-08-20 22:47:15 +02:00
sigiesec
bd0675b93f Problem: no tests for client-side events for successful handshake and authentication failure in handshake
Solution: added tests for CURVE, add emitting of client-side event in curve_client_t; add ZAP code 300/500 tests for all mechanisms; suppress sending an error message for ZAP code 300
2017-08-20 22:45:14 +02:00
Luca Boccassi
b239d99a2c Problem: test_security_gssapi does not close messages
Solution: do it to avoid leaks. Even though they are below 33 bytes so
it's all allocated on the stack, the small message size might change in
the future.
2017-08-20 11:54:49 +01:00
Luca Boccassi
cd09065c8a Problem: test_security_gssapi expects wrong event
Solution: fix it
2017-08-20 11:54:13 +01:00
Simon Giesecke
00c6962516 Problem: test failing due to too few messages sent relative to SNDHWM
Solution: relaxed assertion to accept 10% of the SNDHWM, and updated documentation accordingly
2017-08-20 11:51:09 +02:00
sigiesec
4c2acdacca Problem: wrong assumption on behavior of ZMQ_SNDHWM in test_sockopt_hwm.cpp
Solution: align assertions with specification of ZMQ_SNDHWM (actual number of enqueueable messages may be lower)
2017-08-20 11:43:13 +02:00
Luca Boccassi
90b6c102bb Problem: various unused variables warnings
Solution: use LIBZMQ_UNUSED where necessary
2017-08-19 12:18:51 +01:00
Luca Boccassi
5b1c0cd0ac Problem: test_security_gssapi fails to build
Solution: monitor new events only if DRAFT APIs are enabled, and
convert to new event types. Same for DRAFT socket options.
2017-08-18 16:56:36 +01:00
Luca Boccassi
330856daec Problem: double definition in test_security_gssapi
Solution: remove the second one to fix build failure
2017-08-18 16:28:03 +01:00
sigiesec
301f3c70c2 Problem: code duplication between curve_client_t and curve_server_t decode and encode
Solution: extracted common base class curve_mechanism_base_t
2017-08-18 11:34:22 +02:00
sigiesec
e2d3ba9c62 Problem: classification ZMQ_HANDSHAKE_FAILED_* events is coarse-grained and partially misleading
Solution: redesign ZMQ_HANDSHAKE_FAILED_* events, introduce new class of ZMQ_HANDSHAKE_FAILED_AUTH events
2017-08-18 09:17:59 +02:00
sigiesec
863a02b4a1 Problem: no ZAP tests for PLAIN mechanism
Solution: added ZAP tests for PLAIN
2017-08-17 12:22:26 +02:00
sigiesec
00816875b8 Problem: no ZAP tests for NULL mechanism
Solution: added ZAP tests for NULL
2017-08-17 12:11:14 +02:00
sigiesec
406af1ef67 Problem: ZAP tests are now generic but placed in test_security_curve.cpp
Solution: Move ZAP tests to own file test_security_zap.cpp, move common code to testutil_security.hpp
2017-08-17 11:45:18 +02:00
sigiesec
59d8060165 Problem: ZAP tests are only run with CURVE security
Solution: as a first step, parametrize mechanism configuration in CURVE tests
2017-08-17 11:10:11 +02:00
Simon Giesecke
4a18f6204c Problem: Possible buffer overruns related to metadata in various mechanisms (#2683)
* Problem: no test case with CURVE encryption and large identity

Solution: added test case (currently crashing)

* Problem: possible buffer overflow in mechanism_t::add_property

Solution: add target buffer length parameter and check the buffer is sufficiently large

* Problem: test cases accidentally excluded from build

Solution: remove #if/#endif

* Problem: possible buffer overruns related to metadata at various locations

Solution: allocate buffer large enough for actual metadata, reduce code duplication

* Problem: syntax error related to pointer type conversion

Solution: change argument type of make_command_with_basic_properties to const char *

* Problem: large metadata may cause an assertion in produce_initiate

Solution: Allow metadata of arbitrary size in produce_initiate
2017-08-15 18:42:31 +01:00
Simon Giesecke
d5e4319edc [WIP, do not merge] Problem: insufficient tests for ZMTP-CURVE protocol errors (#2680)
* Extracted connect_vanilla_socket function

* Problem: no tests for ZMTP-CURVE protocol errors

Solution: added two test cases with erroneous HELLO commands

* Problem: insufficient tests for ZMTP-CURVE protocol errors

Solution: added two test cases with erroneous HELLO command version

* Problem: test HELLO message is invalid apart from deliberate errors

Solution: create cryptographically correct HELLO message
add tweetnacl.c to test_security_curve

* Problem: nonce is incorrect, build fails with GCC

Solution: use correct non prefix

* Problem: make builds are failing

Solution: transfer CMake changes to (auto)make files

* Problem: nonce is incorrect, build fails with GCC

Solution: use correct non prefix

* Problem: make builds are failing

Solution: transfer CMake changes to (auto)make files

* Problem: no test with INITIATE command with invalid length

Solution: added test case

* Problem: code duplication between test_security_curve.cpp and curve_client.cpp

Solution: extracted parts of zmq::curve_client_t::produce_hello into reusable function

* Problem: code duplication between test_security_curve.cpp and curve_client.cpp

Solution: extracted further parts of zmq::curve_client_t into reusable functions
added missing file

* Problem: mechanism_t::add_property can be declared static

Solution: declare mechanism_t::add_property static

* Problem: intermediate crypto data needs to be passed between static function calls to curve_client_tools_t

Solution: add non-static member functions

* Problem: msg_t instance may be closed twice

Solution: remove offending close

* Problem: prepare_hello uses static curve_client_tools_t::produce_hello

Solution: Use non-static curve_client_tools_t::produce_hello

* Problem: no test with invalid command name where INITIATE command is expected

Solution: added test case

* Problem: make builds are failing due to curve_client_tools.hpp not being found

Solution: add curve_client_tools.hpp to list of source files

* Problem: wrong initializer order in zmq::curve_client_t

Solution: reorder

* Problem: under non-Windows systems, test fails because random_open was not called

Solution: call random_open/random_close within test

* Problem: conflict between custom function htonll and macro definition on Darwin

Solution: define htonll function only if not defined as a macro

* Problem: nullptr not defined on all platforms

Solution: replace nullptr by NULL

* Problem: libsodium builds not working

Solution: adapt compile and link file sets for libsodium builds

* Problem: Makefile.am broken

Solution: Fix syntax

* Problem: no tests for garbage encrypted cookie or content in INITIATE

Solution: added test cases

* Problem: test cases accidentally excluded from build

Solution: remove #if/#endif

* Solution: some error cases are unreachable

Problem: for the time being, added some comments without changing the code

* Added comments on hard-to-test cases
2017-08-15 15:28:24 +01:00
Simon Giesecke
a6cef4ef86 Problem: ZAP status codes != 200 do not result in an appropriate monitor event (#2665)
* Problem: missing test for status code 300, inadequate assertion for status code 500

Solution: add test, change assertion (currently test fails)

* Problem: gcc compiler error deprecated conversion from string constant

Solution: declare variable as const

* Problem: in case of ZAP handler returning a status code other than 200, no appropriate event is emitted

Solution: immediately emit event after receiving reply from ZAP handler

* Problem: endpoint address is not included in zap-reply monitor event

Solution: added functions to retrieve endpoint address in zmq::i_engine and zmq::session_base_t
removed unused code block in zmq::stream_engine_t::next_handshake_command

* Problem: wrong formatting

Solution: fix formatting

* Problem: test fails because of EPIPE

Solution: add EPIPE/ECONNRESET/ECONNAGAIN handling for more test cases
2017-08-08 13:10:20 +01:00
Simon Giesecke
834b9e4cd7 Problem: some test cases may still fail because of EPIPE/ECONNABORT/ECONNRESET (#2664)
* Problem: CI failure on Appveyor with err==ECONNRESET

Solution: ignore ECONNRESET analogous to EPIPE

* Problem: blocking test execution

Solution: added more debug output, do not wait for monitor infinitely without output
2017-08-07 17:07:37 +01:00
Jim Klimov
612d81a831 Merge pull request #2659 from bluca/fix_getrandom
Problems: test_security_curve occasionally hangs or fails due to ECONNABORTED
2017-08-07 12:36:59 +02:00
Luca Boccassi
20bbd016c1 Merge pull request #2663 from sigiesec/fix-zap-assertion
Problem: failing assertion on ZAP protocol error
2017-08-07 11:15:54 +01:00
Simon Giesecke
de82cbe4ba Problem: failing assertion on ZAP protocol error
Solution: do not assert on ZAP protocol error when connection was closed by client
2017-08-07 10:59:36 +02:00
Simon Giesecke
8842e0f0a9 Problem: occasional test failures due to messages not (yet) received in test assertion
Solution: add sleep
2017-08-07 10:35:25 +02:00
Luca Boccassi
5f6ff69f62 Problem: test_security_curve fails due to ECONNABORTED
Solution: expect that error, which can happen on very slow machines
due to a client timimng out or RST before the connection is accepted
by the server
2017-08-07 09:26:38 +01:00
Luca Boccassi
1c1f10a25a Problem: test_security_curve occasionally hangs
Solution: refactor the ZAP thread to avoid creating the socket in the
main thread and using it in the ZAP thread, and also to eliminate
races at shutdown use another inproc control socket to signal
termination to the thread
2017-08-07 09:18:37 +01:00
Luca Boccassi
14df80ae3a Problem: test_security_curve does not account for ECONNRESET
Solution: ignore ECONNRESET as with EPIPE - it can happen on very
slow machines when the engine sends data to the peer and then tries
to read from the TCP socket before the peer has read
2017-08-05 18:08:21 +01:00
Luca Boccassi
9c085381ee Problem: test_security_curve timeouts on CMake
Solution: bump timeout from 20 to 60 seconds
2017-08-04 16:25:59 +01:00
Simon Giesecke
7ba70e95e5 Problem: test failure on CI due to ZMQ_EVENT_HANDSHAKE_FAILED_NO_DETAIL/EPIPE problem
Solution: add workaround at another place, unify two code fragments to remove duplication
2017-08-04 16:05:20 +02:00
Simon Giesecke
aacb219acd Problem: open TODOs in test code
Solution: removed code duplication
improved global variable naming
added assertions on number of ZAP requests handled
added assertion on monitor event to test_curve_security_with_plain_client_credentials
2017-08-04 15:11:14 +02:00
Jim Klimov
e84804d4cc Merge pull request #2647 from bluca/travis_test
Problems: too many OSX travis builds, curve test uses hard-coded TCP port
2017-08-04 13:21:02 +02:00
Luca Boccassi
32085870df Merge pull request #2650 from sigiesec/connection-close-event-workaround
Problem: sporadic failure in test_curve_security_with_null_client_credentials
2017-08-04 11:48:27 +01:00
Simon Giesecke
4b847f3ff9 Problem: no tests for ZAP handler that has an invalid protocol (#2648)
* Problem: no tests for ZAP protocol errors

Solution: added first test for a bogus version number in ZAP reply

* Problem: no tests for ZAP protocol errors

Solution: added more test cases

* Problem: cannot compile without ZMQ_BUILD_DRAFT_API

Solution: conditionally compile parts that depend on draft API

* Problem: test_security_curve times out in CI

Solution: Increase timeout for this test to 20 seconds
2017-08-04 11:07:41 +01:00
Simon Giesecke
4fec4c99be Problem: sporadic failure in test_curve_security_with_null_client_credentials
Solution: add workaround for EPIPE error
2017-08-04 11:35:00 +02:00
Luca Boccassi
ccb1250fcc Problem: a curve test uses hard-coded TCP port
Solution: use the wildcard endpoint instead
2017-08-03 14:41:36 +01:00
Simon Giesecke
5d4e30eb13 Replace console output by monitoring events for curve security issues (#2645)
* Fixing #2002 one way of doing it

 * Mechanisms can implement a new method `error_detail()`
 * This error detail have three values for the moment: no_detail
 (default), protocol, encryption.
    + generic enough to make sense for all mechanisms.
    - low granularity level on information.

* Fixing #2002: implementation of the error details

The ZMQ_EVENT_HANDSHAKE_FAILED event carries the error details
as value.

* Removed Microsoft extenstion for enum member access

This was leading to compilation error under linux.

* Adaptation of CURVE test cases

* Monitoring event: changed API for detailed events

Removed ZMQ_EVENT_HANDSHAKE_FAILED and replaced it by:
- ZMQ_EVENT_HANDSHAKE_FAILED_NO_DETAIL,
- ZMQ_EVENT_HANDSHAKE_FAILED_PROTOCOL,
- ZMQ_EVENT_HANDSHAKE_FAILED_ENCRYPTION

Adaptation of text case `security_curve`

* Removed event value comparison

This was introduced for the previous API model adaptation

* Removed the prints in std output and added missing details

`current_error_detail` was not set in every protocol error cases

* Fixed initialization of current_error_detail

* Fixed error in greeting test case

The handshake failure due to mechanism mismatch in greeting is actually
a protocol error. The error handling method consider it like so and
send a protocol handshake failure monitoring event instead of no_detail.

Fixed the test_security_curve expectation as well.

* Upgraded tests of monitoring events

The tests check the number of monitoring events received

* Problem: does not build under Linux or without ZMQ_DRAFT_API

Solution:
- properly use ZMQ_DRAFT_API conditional compilation
- use receive timeouts instead of Sleep

* Problem: duplicate definition of variable 'timeout'

Solution: merged definitions

* Problem: inconsistent timing dependencies

Solution: reduce timing dependency by using timeouts at more places

* Problem: assertion failure under Linux due to unexpected monitor event

Solution: output event type to aid debugging

* Problem: erroneous assertion code

* Problem: assertion failure with a garbage server key due to an extra third event

Solution: changed assertion to expect three events (needs to be checked)

* Problem: extra include directive to non-existent file

Solution: removed include directive

* Problem: assertion failure on appveyor for unknown reason

Solution: improve debug output

* Problem: no build with libsodium and draft api

Solution: add build configurations with libsodium and draft api

* Problem: assertion failure on CI

Solution: change assertion to reflect actual behaviour on CI (at least temporarily)

* Problem: error in condition in assertion code

* Problem: assertion failure on CI

Solution: generalize assertion to match behavior on CI

* Problem: assertion failures on CI

Solution: removed inconsistent assertion on no monitor events before flushing
improved debuggability by converting function into macro

* Problem: diverging test code for three analogous test cases with garbage key

Solution: extract common code into function

* Problem: does not build without ZMQ_BUILD_DRAFT_API

Solution: introduce dummy variable

* Attempt to remove workaround regarding ZMQ_EVENT_HANDSHAKE_FAILED_NO_DETAIL again

* Problem: EAGAIN error after handshake complete if there is no more data in inbuffer

Solution: Skip tcp_read attempt in that case

* Problem: handshaking event emitted after handshaking failed

Solution: use stream_engine_t::handshaking instead of mechanism_t::status() to determine whether still handshaking

* Include error code in debug output

* Improve debugging output: output flushed events

* Split up ZMQ_EVENT_HANDSHAKE_FAILED_PROTOCOL into ZMQ_EVENT_HANDSHAKE_FAILED_ZMTP and ZMQ_EVENT_HANDSHAKE_FAILED_ZAP

* Fixed compilation without ZMQ_BUILD_DRAFT_API

* Renamed ZMQ_EVENT_HANDSHAKE_SUCCEED to ZMQ_EVENT_HANDSHAKE_SUCCEEDED for language consistency

* Renamed ZMQ_EVENT_HANDSHAKE_SUCCEED to ZMQ_EVENT_HANDSHAKE_SUCCEEDED for language consistency

* Renamed ZMQ_EVENT_HANDSHAKE_SUCCEED to ZMQ_EVENT_HANDSHAKE_SUCCEEDED for language consistency

* Fixed assert_monitor_event (require event instead of allowing no event)
Reverted erroneous change to handshaking condition
Renamed test_wrong_key to test_garbage_key
Generalized assumption in test_garbage_key to allow for ZMQ_EVENT_HANDSHAKE_FAILED_NO_DETAIL with error == EPIPE

* Better isolate test cases from each other by providing a fresh context & server for each

* Added diagnostic output

* Changed assertion to reflect actual behavior on CI

* Fixed formatting, observe maximum line length

* Fixed formatting, observe maximum line length

* Increase timeout to check if this fixes valgrind run

* Close server with close_zero_linger

* Increase timeout to check if this fixes valgrind run

* Increase timeout to check if this fixes valgrind run

* Generalize assertion to also work with valgrind

* Fixed formatting

* Add more diagnostic output

* Generalize assertion to also work with valgrind
2017-08-03 14:15:56 +01:00
Luca Boccassi
415bdbc1b9 Problem: ZMQ_BINDTODEVICE is DRAFT but not DRAFT
Solution: move definition in the DRAFT section of the header
2017-07-31 16:31:31 +01:00
Brian Russell
b963542e8f Add socket option BINDTODEVICE
Linux now supports Virtual Routing and Forwarding (VRF) as per:

https://www.kernel.org/doc/Documentation/networking/vrf.txt

In order for an application to bind or connect to a socket with an
address in a VRF, they need to first bind the socket to the VRF device:

    setsockopt(sd, SOL_SOCKET, SO_BINDTODEVICE, dev, strlen(dev)+1);

Note "dev" is the VRF device, eg. VRF "blue", rather than an interface
enslaved to the VRF.

Add a new socket option, ZMQ_BINDTODEVICE, to bind a socket to a device.
In general, if a socket is bound to a device, eg. an interface, only
packets received from that particular device are processed by the socket.

If device is a VRF device, then subsequent binds/connects to that socket
use addresses in the VRF routing table.
2017-07-31 15:31:47 +01:00
Luca Boccassi
3536c4b9c4 Problem: XPUB_MANUAL subscriptions not removed on peer term
Solution: remove the pipe from the real trie when a peer disconnects.
Also add a unit test that exercises the behaviour by reconnecting
a different socket and sending a message that matches.
Fixes #2601 and introduced by #2042
2017-06-22 01:02:08 +01:00
Luca Boccassi
8e2027983a Problem: XPUB_MANUAL takes effect for the next bind
Solution: fix unit test to bind after setting the option.
2017-06-22 00:58:44 +01:00
Joe Eli McIlvain
2d83acceff Merge pull request #2596 from bluca/zap_curve
Problems: ZAP can be set up incorrectly, CURVE and GSSAPI can be used only with ZAP
2017-06-15 11:51:43 -07:00
Iban Cereijo
2c4e5364aa Problem: missing Ws2_32.lib when cross compiling
Solution: use lower case ws2_32.lib to enable cross compilation
from platforms with case-sensitive filesystems.

When cross compiling the tests with Mingw-w64, CMake cannot
locate Ws2_32.lib
2017-06-14 15:54:03 +02:00
Luca Boccassi
0ce18eac25 Problem: CURVE can no longer be used without ZAP
Solution: revert change that made ZAP mandatory.
The "Stonehouse" pattern, where CURVE is used only for encryption and
without authentication, is a valid use case so we should still
support it.
Also restore CURVE testing in the test_heartbeat.

Fixes #2594
2017-06-13 22:56:32 +01:00
Luca Boccassi
17637536b8 Problem: use-after-free in test_poller
Solution: remove server socket from poller before closing it
Fixes #2581
2017-05-18 13:10:19 +01:00
Luca Boccassi
bdc676f687 Problem: REP leaves label msgs for dead REQ in pipe
Solution: roll back the pipe if writing messages other than the
first fails in router::xsend. Roll it back also when the pipe is
terminating.
Also add test case that reproduces the memory leak when ran with
valgrind.
Fixes #2567
2017-05-17 09:18:15 +01:00
BJovke
1489fc1ac5 Revert "Problem: REP leaves label msgs for dead REQ in pipe" 2017-05-16 11:20:03 +02:00
Luca Boccassi
0999fdd885 Problem: REP leaves label msgs for dead REQ in pipe
Solution: roll back the pipe if writing messages other than the
first fails in router::xsend.
Also add test case that reproduces the memory leak when ran with
valgrind.
Fixes #2567
2017-05-10 23:44:03 +01:00
Luca Boccassi
b29d46b6a5 Problem: tests use same IPC endpoint
Solution: use either a wildcard IPC, or where the codepath needs to
be tested a file named after the test, so that it is unique and there
is no clash on the filesystem, allowing parallel test runs.
2017-05-01 22:57:05 +01:00
Luca Boccassi
5934919f3e Problem: tests bind to hardcoded TCP ports
Solution: use ZMQ_LAST_ENDPOINT in most places. This alllows running
tests in paralle, and on over-booked shared machines where many of
the ports would be already in use.
Keep 3 tests with an hardcoded port, as there are some code paths that
require it (eg: connect before bind), but list those ports in
tests/testutil.hpp as macros so that they do not overlap and still
allow parallel runs.

These changes were inspired by a patch uploaded to Ubuntu by the
package maintainer, Steve Langasek <steve.langasek@ubuntu.com>.
Thank you Steve!
2017-05-01 22:57:05 +01:00
Jim Garlick
edd6b0ad01 gssapi: add a basic test for GSSAPI security
Problem: there is no test coverage for GSSAPI.

Solution: add a test structured like the CURVE test.

The test is not built if libzmq is not configured with
--with-libgssapi_krb5. It will report SKIPPED status
if the required environment is missing (see below).

Environment:  KRB5_KTNAME and KRB5_CLIENT_KTNAME
environment variables must point to a keytab file
containing creds for a host-based test principal
(see comment at top of source for details).
Kerberos must be configured and a KDC containing the
test principal must be running, otherwise the test
will fail/hang.

N.B. For now, the test must use the same principal for
both client and server roles because it seems impossible
to set them to different principals when they are
threads in the same process.  Once one principal is
cached in credential cache, attempts to acquire creds
for a different "desired name" seem to be ignored and
the cached principal is used instead.
2017-04-26 09:31:21 -07:00
Yann Diorcet
17460b3b2b Targets broken by some parts of f7d1c159d4 2017-04-24 15:57:14 +02:00
Yann Diorcet
f7d1c159d4 Fix windows compilation 2017-04-12 10:59:04 +02:00
Stefan Herbrechtsmeier
2f367bddf7 cmake: Remove build/msvc include path to remove file name clash
Remove the `build/msvc` include path from the test project to fix a
problem with the order of the include paths. Additionally remove the
unnecessary `include_directories` from the master project.

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
2017-04-05 10:03:07 +02:00
evoskuil
7952c584b6 Problem: xpub test has broken style (missing whitespace). 2017-03-30 14:45:48 -07:00
evoskuil
0bfd747af8 Problem: heartbeats test has invalid curve design; xplat and style probs. 2017-03-29 17:43:25 -07:00
Goswin von Brederlow
1dd5fef20c zmq_curve_keypair(): return result from crypto_box_keypair() to make testcase meaningfull 2017-03-16 14:01:08 +00:00
Luca Boccassi
0f473d14cb Problem: unnecessary change to router_mandatory_hwm test
Solution:

Revert "Problem with ZMQ_ROUTER_MANDATORY option when peer lost"

This partially reverts commit 06740b5d8c.

The change in the mentioned commit was fixed to be backward
compatible so test changes are no longer necessary.
Partially revert the commit, leaving only the bug fix and taking out
the test change and the superfluous change in socket_base.
2017-02-24 17:57:14 +00:00
Reza Ebrahimi
06740b5d8c Problem with ZMQ_ROUTER_MANDATORY option when peer lost
indention

Revert "indention"

This reverts commit a6e7e192ac2d089ac9f7dc0d31d4b1fd10de982e.

indention

indention

Fix Failure in tests

Check both pipe full and pipe close
2017-02-24 20:49:26 +03:30
sigiesec
c6c21cf197 Problem: zmq_z85_decode does not validate its input (#2322)
* Problem: zmq_z85_decode does not validate its input
Solution: added checks for invalid characters and overflows

* Added tests, added further check for range overflow, removed (multiple) calls to strlen

* Problem: gcc fails to build
Solution: added missing include directive

* Added VS2015 test_utils_z85 project

* Fixed indentation and copyright notice

* Resolved garbage from merge

* Revert "Added VS2015 test_utils_z85 project"

This reverts commit c58b3c664c.

* Problem: test calls zmq_z85_decode with a NULL dest
Solution: call zmq_z85_decode with a properly sized buffer

* Problem: tests for zmq_z85_* scattered over two files
Solution: merged files

* Removed reference to removed test file from CMakeLists.txt

* Problem: Missing include directive to stdint.h
Solution: Added include directive

* Define __STDC_LIMIT_MACROS before including stdint.h

* Problem: Wrong variable is checked for invalid character marker
Solution: Use correct variable
2017-01-25 14:28:03 +00:00
Asmod4n
b7cd6e8a85
add test and documentation for "draft" capability 2017-01-19 20:50:18 +01:00
Luca Boccassi
7e186432cb Problem:capitalized include filenames trip mingw
Solution: use lowercase
2017-01-03 14:59:57 +01:00
Vincent Tellier
ea7e03a7ff Fixed issue #2286 by documentation
tests/README.md explicitly indicates to check the libzmq.lib path in
CMakeLists.txt.
2017-01-01 19:08:28 +01:00
Luca Boccassi
3f3601e855 Problem: handshake events not tested with curve
Solution: check that the expected handshake success or failure events
are triggered in the curve security unit test
2016-12-31 01:31:37 +01:00
Luca Boccassi
c0e2bc4ef9 Problem: new DRAFT monitor events returned even without --enable-draft
Solution: wrap the event triggering in the DRAFT ifdef as well as the
defines. This ensures that the event are returned only if the
library was built with DRAFTs enabled.

Also update the test case to expect the new events since it uses
the catch-all mask. Although the sequence of event is different and
this might be considered as an API breakage, using the catch-all
ZMQ_EVENT_ALL mask implies that, well, all events are monitored so
it's normal that new ones will be added.
Users that don't want this kind of behaviour to change can simply
monitor only the event that they care about.
2016-12-30 23:21:14 +01:00
Luca Boccassi
113feb60a2 Problem: ZMQ_MSG_T_SIZE draft but not in DRAFT section
Solution: move it there, add it to src/zmq_draft.h and clarify in the
documentation and in the NEWS file that this option is not yet stable
2016-12-29 21:07:39 +01:00
Luca Boccassi
06055a7b74 Problem: cmake does not run test_zmq_poll_fd
Solution: add it to the list
2016-12-26 19:20:09 +01:00
Luca Boccassi
272d340c1f Problem: no mixed FD and zmq socket zmq_poll test
Solution: add one
2016-12-15 12:03:48 +00:00
Luca Boccassi
dcec022358 Problem: test_stream_exceeds_buffer does not build on AIX
Solution: add missing includes
2016-12-06 20:34:10 +00:00
Luca Boccassi
8325355d73 Problem: test_stream_exceeds_buffer has redundant includes
Solution: remove them as they are already in testutil.hpp
2016-12-06 20:33:46 +00:00
Luca Boccassi
670bec56d8 Problem: size of zmq_msg_t is not known to FFI wrappers
Solution: add a ZMQ_MSG_T_SIZE context read-only option so that
wrappers can call zmq_ctx_get (ctx, ZMQ_MSG_T_SIZE) to get the
size at runtime.
2016-11-20 12:24:03 +00:00
Harald
6f597d0bd3 Problem: CMake build rejects to build with openpgm enabled
Solution: add optional lookup for openpgm via pkg-config
2016-11-01 12:31:40 +01:00
Luca Boccassi
25bf30bebe Problem: 2 connects with same sourceip:port to different destip:port fail
Solution: during a connect with a TCP endpoint if a source address is
passed set the SO_REUSEADDR flag on the socket before the bind system
call.
Add unit test to cover this case for both IPv4 and IPv6.
2016-10-23 22:31:45 +01:00
Nick Guiffrida
ffdb44ad2c Fix zmq_poll return code assert in tests/test_radio_dish.cpp 2016-09-30 21:50:31 -07:00
Min RK
bdcaa935b9 zmq_poll calls zmq_poller if available
enables zmq_poll on threadsafe sockets only supported in zmq_poller (radio, dish, etc.)
2016-09-28 13:53:57 +02:00
Luca Boccassi
fab846a5e5 Problem: zmq_ctx_term asserts with connect-before-bind and sockets with identity over inproc transport
Solution: check if the connecting inproc socket has been closed
before trying to send the identity.
Otherwise the pipe will be in waiting_for_delimiter state causing
writes to fail and the connect to assert when the context is being
torn down and the pending inproc connects are resolved.
Add test case that covers this behaviour.
2016-09-24 18:59:29 +01:00
Luca Boccassi
25402335fd Problem: no bind-after-connect TCP test
Solution: add one to increase coverage
2016-09-24 18:27:19 +01:00
Luca Boccassi
53e5a9a6f9 Problem: zmq_connect with IPv6 "source:port;dest:port" format is broken
Solution: allow for '[' character when doing the basic sanity check
on the TCP endpoint.
Also add unit tests for both IPv4 and IPv6 source;dest format.
2016-09-17 20:04:40 +01:00
Luca Boccassi
c1d07c6cd6 Problem: test_reqrep_tcp does not have IPv6 tests
Solution: add them
2016-09-17 20:04:40 +01:00
Luca Boccassi
896192ff42 Problem: test_reqrep_tcp does not test multiple endpoints
Solution: add a test for this use case
2016-09-17 19:30:59 +01:00
Luca Boccassi
75219e33a7 Problem: test_reqrep_tcp does not test disconnect/unbind
Solution: add disconnect and unbind calls to the test
2016-09-17 19:30:35 +01:00
Luca Boccassi
8d723fee3d Problem: test_reqrep_tcp is too limited
Solution: refactor it to allow for multiple functionalities to be
tested
2016-09-17 19:30:22 +01:00
Thomas Braun
c9c49f3e9f Problem: Missing newline in printf statement
Solution: Add "\n" at end of format string.
2016-09-12 19:45:31 +02:00
Luca Boccassi
a9343dbbc3 Problem: testutil.hpp fails to build on Windows XP
Solution: ifdef is_ipv6_available to always return false if building
on Windows XP, as it doesn't support the needed standard libc
functions
2016-08-27 16:48:38 +01:00
Luca Boccassi
0002824fc0 Problem: is_ipv6_available needs context to work on Windows
Solution: call the function after the zmq_ctx has been created, not
before, so that the relevant Windows system calls have been setup.
2016-08-23 21:48:57 +01:00
Luca Boccassi
f486176741 Revert "is_ipv6_available: Create a fake zmq context on windows"
This reverts commit 9adf20aaeb.
2016-08-23 21:46:43 +01:00
Thomas Braun
9adf20aaeb is_ipv6_available: Create a fake zmq context on windows
This is required as zmq_ctx_new calls WSAStartup. Without that the IPV6
socket creation always fails.
2016-08-23 21:52:16 +02:00
Giuseppe Corbelli
7fdb167732 [tests/testutil.hpp] Problem: wrong windows.hpp path
Solution: correct path is ../src/windows.hpp. Also added automatic linking
of iphlpapi library if required and using MSVC
2016-07-12 15:58:17 +02:00
Giuseppe Corbelli
0b01cc1ebc [tests/CMakeLists.txt] Problem: The libzmq.lib search path should be set
only if the library is found at a specific path

Solution: Search for libzmq.lib in ../bin/Win32/Debug/v120/dynamic, don't
know how to automatically search in correct path based on current build
configuration
2016-07-12 15:54:55 +02:00
Fedor Sheremetyev
813c738137 Add test for consistent unsubscription in XPUB manual mode.
Expect custom messages on both explicit unsubscription and pipe termination.
2016-06-17 11:36:13 +01:00
evoskuil
c050d95fcd Problem: no unit tests for base85 or public curve functions. 2016-05-19 03:46:15 -07:00
hitstergtd
fed17746c6 Problem: Wrapping issue in test for SRCFD [style]
Solution:
Wrap it.
2016-05-16 20:47:47 +01:00
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