Commit Graph

628 Commits

Author SHA1 Message Date
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
Bitiquinho
977e700893 Fix Copyright range 2016-05-15 15:37:33 -03:00