Commit Graph

1145 Commits

Author SHA1 Message Date
Luca Boccassi
cd991c72c8 Revert "Add forgotten test_pubsub. Currently only tests NORM if built."
The test always fails.

This reverts commit a6039d8716.
2023-10-25 11:49:29 +01:00
Michael Hudson-Doyle
aa3e097996 initialize error in test_security_gssapi.c:test_null_creds
Under some circumstances (which probably no longer apply in master) gcc inlined get_monitor_event into test_null_creds and then emitted a "maybe uninitialized" warning on the use of error. This would only be a problem if the tested code was misbehaving but I guess that's the point of a test!
2023-10-25 09:51:25 +01:00
Axel Rietschin
a6039d8716 Add forgotten test_pubsub. Currently only tests NORM if built. 2023-10-24 10:47:19 +01:00
George Cockshull
77303a1926 test_proxy_steerable: reduce cpu and thread count
Problem: flakiness on slow CI VMs

Solution: fewer worker threads, poll rather than thrash,
consistent timings. user cpu ~300% -> 15%.
2023-10-13 08:19:38 -04:00
George Cockshull
f8b3cc8108 Fix zmq_proxy_steerable PAUSE/RESUME
Problem: the new reimplementation of zmq_proxy_steerable had PAUSE/RESUME
that didn't follow expected behaviour. Possibly mixed up. Test didn't properly
cover the issue.

Solution: improve test coverage, fix the proxy command parsing.

I had no knowledge of the pre-MPL-2.0 implementation. This fix is based
on documented semantics and prior API usage. I contribute this
under MPL-2.0.
2023-10-12 15:22:44 -04:00
Brett Viren
5712ad5138 A clean-room implementation of zmq_proxy_steerable().
It is contriubted under the MPL-2.0.

I had no knowledge of the previous implementation of zmq_proxy_steerable().

This version was developed based on expectations set in the old man page with one exception.  This version uses a REP/REQ for the proxy control protocol sockets.  The old man page example used PUB/SUB which is nonsensical given the STATISTICS command requires two way communication.
2023-10-08 19:56:03 -04:00
Nehal Patel
8cdc4ed71a
Problem: unused variables warnings
Solution: fix them
2023-10-04 09:51:43 +01:00
Cornelius
ecc63d0d3b
Problem: long flag isn't set for subscriptions if topic has between 246 and 255 characters (#4564)
* Problem: long flag isn't set for subscriptions if topic has between 246 and 255 characters

Solution: fix V3.1 encoder to calculate long flag after evaluating the subscribe and cancel commands
2023-06-20 15:17:26 +01:00
Luca Boccassi
da31917f4f Relicense from LGPL3 + exceptions to Mozilla Public License version 2.0
Relicense permission collected from all relevant authors as tallied at:
https://github.com/rlenferink/libzmq-relicense/blob/master/checklist.md
The relicense grants are collected under RELICENSE/ and will be moved
to the above repository in a later commit.

Fixes https://github.com/zeromq/libzmq/issues/2376
2023-06-05 20:31:47 +01:00
Luca Boccassi
ff47aeb791 Problem: no permission to relicense tweetnacl integration
Solution: remove implementation. Frank Hartmann <soundart@gmx.net>,
the author, rejected our request to relicense under MPL2, so we
have to remove his copyrighted work.
Tweetnacl is not security-supported and could not be used in
production environments anyway, the supported backend is libsodium.
2023-06-04 23:54:31 +01:00
Luca Boccassi
13bc1de421 Problem: no permission to relicense zmq_proxy_steerable
Solution: remove implementation. Laurent Alebarde <l.alebarde@free.fr>,
the author, did not respond to requests to allow relicensing to MPL2,
so we have to remove his copyrighted work.
Make the API into an empty stub that returns -EOPNOTSUPP.
2023-06-04 23:54:31 +01:00
Keith Williams
abf2444f09 remove c99 extention from c++11 code 2023-04-18 22:27:06 +01:00
James Choi
10e5847fa8 Add support for QNX 7.1 build
Signed-off-by: James Choi <chachoi@blackberry.com>
2023-04-11 15:48:07 -04:00
Sergey Fedorov
74af53fdfa tests: use NOT APPLE instead of NOT MATCHES Clang 2023-02-01 05:37:59 +08:00
Luca Boccassi
bd0a34899a Problem: test_filter_ipc is flacky
Solution: expect send failure and use random endpoint
2023-01-31 01:16:24 +00:00
Luca Boccassi
ccdc2f7583 Problem: VMCI tests are not skipped outside VMs
Solution: check CID and skip if unavailable
2023-01-31 00:28:38 +00:00
Arnaud Loonstra
f7df6c8599 deprecate sprint and replace with snprintf 2023-01-24 22:45:48 +01:00
Luca Boccassi
a820627f55 Problem: test_zmq_ppoll_signals does not cleanup context
Solution: do it, to avoid false positive in valgrind
2023-01-16 00:52:30 +00:00
Luca Boccassi
7e0fdd82de Problem: test_zmq_ppol_signals uses fixed TCP port
Solution: use random one to avoid random failures
2023-01-16 00:52:30 +00:00
Luca Boccassi
117cbe690c Problem: buffer overflow in new test case
Solution: fix it
2023-01-15 23:44:12 +00:00
Luca Boccassi
7781dd1bbd Problem: formatting errors with clang-format-11
Solution: apply update
2023-01-12 01:07:06 +00:00
Luca Boccassi
47d0ecf639 Problem: missing VMCI can also return EPROTONOSUPPORT and the tests fail
Solution: ignore that too
2023-01-12 01:07:06 +00:00
Francesco Montorsi
c59104a01d
Add ZMQ_TOPICS_COUNT socket option (#4459) 2022-11-29 12:00:11 +00:00
Bill Torpey
25b3e7af02 avoid intermittent timeouts in test (esp. when run w/ASAN etc.) 2022-09-30 11:45:19 -04:00
Dimitris Apostolou
6b8dd84a63
Fix typos 2022-02-11 00:45:06 +02:00
Luca Boccassi
176d72cc9b Problem: build fails with gcc 12
Solution: change test_monitor and example
2022-01-18 16:15:07 +00:00
Tarmo Tänav
74529d97b2 Problem: ROUTER loses first frame metadata on message prefetch
Solution: copy metadata on prefetch to the first frame
2021-12-16 10:17:44 +02:00
Paul Thiele
6737d50933 Problem: if ZMQ_XPUB_VERBOSER is used with proxies unsubscribe messages are lost
Solution: add socket option ZMQ_XSUB_VERBOSE_UNSUBSCRIBE to forward all unsubscribe messages
2021-11-05 15:12:31 +01:00
Luca Boccassi
5d8d857540
Merge pull request #4264 from analogist/master
mingw-w64 10.3 build fix - winsock socket() return unsigned
2021-09-25 11:31:27 +01:00
James Wu
228edc92a9 fix test comparison between -1 and unsigned winsock2.h socket return 2021-09-24 13:13:19 -07:00
E. G. Patrick Bos
36e4c9b474
add zmq_ppoll
zmq_ppoll mostly mimics zmq_poll behavior, except for the added feature of being able to specify a signal mask. Signals in this mask will be blocked during execution of zmq_ppoll. Switching of the process' active signal mask happens atomically with the actual poll call, so that no race conditions can occur. This behavior is useful when one wants to gracefully handle POSIX signals without race conditions. See e.g. the discussion below https://250bpm.com/blog:12/ for an explanation.

Also includes two new tests:
1. test_zmq_ppoll_fd does the same thing as test_zmq_poll_fd, demonstrating backwards compatibility with zmq_poll when used with a default signal mask.
2. test_zmq_ppoll_signals demonstrates the use of zmq_ppoll with a signal mask, blocking out SIGTERM everywhere except in zmq_ppoll, allowing to handle the signal in one place without having to worry about race conditions.
2021-09-24 11:04:20 +02:00
Luca Boccassi
6f200814cd Problem: some tests occasionally fail on OBS
Solution: ignore them
2021-09-22 16:42:09 +01:00
Luca Boccassi
2a954b301e Problem: test_security_curve always fails when run by CMake under Github Actions
Solution: skip it
2021-09-22 16:42:09 +01:00
Luca Boccassi
e3d37a82e1 Problem: some tests time out in CI under Valgrind
Solution: triple the timeouts
2021-09-22 16:40:17 +01:00
Luca Boccassi
0f706bdd97 Problem: formatting errors
Solution: run make clang-format-diff
2021-09-22 16:40:17 +01:00
Luca Boccassi
11f0802912 Problem: VMCI might not be supported by CI
Solution: skip tests if zmq_bind fails with EAFNOSUPPORT
2021-09-22 16:40:17 +01:00
Luca Boccassi
37c548d62b Problem: test_pair_tcp_cap_net_admin requires privileges and might fail
Solution: skip it if EOPNOTSUPP is returned instead of failing
2021-09-22 16:40:17 +01:00
Luca Boccassi
de03c9a6ab Problem: test_inproc_connect occasionally fails on slow archs
Solution: actually send a message rather than just opening/closing
the sockets, as connecting is asynchronous.

tests/test_inproc_connect.cpp:341:test_bind_before_connect:PASS
tests/test_inproc_connect.cpp:342:test_connect_before_bind:PASS
tests/test_inproc_connect.cpp:343:test_connect_before_bind_pub_sub:PASS
tests/test_inproc_connect.cpp:344:test_connect_before_bind_ctx_term:PASS
tests/test_inproc_connect.cpp:345:test_multiple_connects:PASS
tests/test_inproc_connect.cpp:346:test_multiple_threads:PASS
Assertion failed: _state == active || _state == waiting_for_delimiter (src/pipe.cpp:504)
0  0xffffa015d3e4 in /usr/src/packages/BUILD/src/.libs/libzmq.so.5 (zmq::zmq_abort(char const*)+0xc)
1  0xffffa017b208 in /usr/src/packages/BUILD/src/.libs/libzmq.so.5 (zmq::pipe_t::process_delimiter()+0xb0)
2  0xffffa017b420 in /usr/src/packages/BUILD/src/.libs/libzmq.so.5 (zmq::pipe_t::read(zmq::msg_t*)+0xd8)
3  0xffffa01a4b28 in /usr/src/packages/BUILD/src/.libs/libzmq.so.5 (zmq::xpub_t::xread_activated(zmq::pipe_t*)+0x110)
4  0xffffa01a3758 in /usr/src/packages/BUILD/src/.libs/libzmq.so.5 (zmq::xpub_t::xattach_pipe(zmq::pipe_t*, bool, bool)+0x68)
5  0xffffa018dc3c in /usr/src/packages/BUILD/src/.libs/libzmq.so.5 (zmq::socket_base_t::attach_pipe(zmq::pipe_t*, bool, bool)+0x94)
6  0xffffa016f288 in /usr/src/packages/BUILD/src/.libs/libzmq.so.5 (zmq::object_t::process_command(zmq::command_t const&)+0x148)
7  0xffffa014ee3c in /usr/src/packages/BUILD/src/.libs/libzmq.so.5 (zmq::ctx_t::connect_inproc_sockets(zmq::socket_base_t*, zmq::options_t const&, zmq::ctx_t::pending_connection_t const&, zmq::ctx_t::side)+0xdc)
8  0xffffa0150bec in /usr/src/packages/BUILD/src/.libs/libzmq.so.5 (zmq::ctx_t::connect_pending(char const*, zmq::socket_base_t*)+0x1fc)
9  0xffffa0190034 in /usr/src/packages/BUILD/src/.libs/libzmq.so.5 (zmq::socket_base_t::bind(char const*)+0x3e4)
10  0xaaaae50475d8 in /usr/src/packages/BUILD/tests/.libs/test_inproc_connect (simult_bind(void*)+0x28)
11  0xffffa019bfb8 in /usr/src/packages/BUILD/src/.libs/libzmq.so.5 (thread_routine+0x70)
12  0xffffa00e07e4 in /lib/aarch64-linux-gnu/libpthread.so.0 (start_thread+0x18c)
13  0xffff9fdcab2c in /lib/aarch64-linux-gnu/libc.so.6 (clone+0x5c)
2021-06-14 11:43:06 +01:00
Doron Somech
1c6c5514ed problem: no way to know when connection is temporarly dropped
This is important in order to send the login sequence of a client to the server.

Solution: add ZMQ_HICCUP_MSG to a socket, socket would send that message whenever a connection get temporarly disconnected
2021-06-06 17:14:22 +03:00
Chengye Ke
04c37982b1
Support so_busy_poll (#4188)
* Support so_busy_poll.
2021-05-14 23:05:56 +01:00
Luca Boccassi
b4f758da35
Merge pull request #4174 from jlsantiago0/build-fix-bsd
Fix Build BSD
2021-04-15 23:16:33 +01:00
Jose Santiago
7d8b149681 Fix Build BSD
This fixes build under BSD. Tested with OpenBSD-6.4 and FreeBSD-11.3.
2021-04-15 14:04:27 -05:00
Jose Santiago
235654697f MINGW Build Fix.
There is a macro that redefines claose to closesocket, but then close is
later defined in unistd.h which is included in testutil_unity.cpp which
then causes the regular close() prototype to be defined with the new
function name closesocket which does not match the signature of the
original closesocket in winsock2.h from the toolchain.

We can work around this issue, by making sure that unistd.h is included
before the macro is defined. HMM> Yes macro substitution is the root of
evil.
2021-04-15 12:53:02 -05:00
Luca Boccassi
8fe5b54b8a Problem: VMCI build broken
Solution: refactor it
2021-02-21 11:50:38 +00:00
Luca Boccassi
16af1bd622 Problem: test_pubsub broken everywhere
Solution: disable it
2021-01-18 09:42:33 +00:00
mjvankampen
2dd24d6d80
Problem: norm fails to compile under windows (#4123)
* Makes norm useable (but maybe slow) on windows
2021-01-18 08:42:14 +00:00
Luca Boccassi
2347a76413 Problem: build broken on debian/hurd
Solution: fix it
2021-01-16 17:48:29 +00:00
Andy Heroff
2998ff34aa
Problem: No direct support for setting socket priority (#4118)
* Problem: No direct support for setting socket priority

Solution: Add ZMQ_PRIORITY socket option, which sets the
SO_PRIORITY socket option on the underlying socket. This
socket option is not supported under Windows. Check option
and set socket option on creation of underlying socket.
2021-01-06 22:22:41 +00:00
Luca Boccassi
41c4ce1817 Problem: ZMQ_PUB broken on ZMQ_WS
Solution: encode subscribe/cancel messages until there are appropriate
opcodes.
Regression introduced by 253e9dd27b

Fixes https://github.com/zeromq/libzmq/issues/4101
2020-12-23 17:44:07 +00:00
Luca Boccassi
d77c60a0db Problem: tests fails to receive with EAGAIN on slow architectures
Solution: remove arbitrary timeouts, as they are testing reliable pipes
with no contention, so if it can connect eventually it has to
work. The overall test timeout covers cases where it doesn't.

If tests want to use receive timeouts, they need to handle EAGAIN
properly.
2020-11-18 13:29:33 +00:00