Commit Graph

531 Commits

Author SHA1 Message Date
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