libzmq/tests
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
..
CMakeLists.txt Add support for QNX 7.1 build 2023-04-11 15:48:07 -04:00
README.md Problem: missing guidelines on proper test cleanup 2018-03-14 12:26:06 +01:00
test_abstract_ipc.cpp Problem: no test for (invalid) empty abstract ipc endpoint name 2020-09-05 13:17:13 +02:00
test_address_tipc.cpp Problem: test_address_tipc is unnecessarily verbose 2019-03-24 13:34:13 -04:00
test_ancillaries.cpp Problem: remaining basic assertions 2019-03-23 09:09:36 -04:00
test_app_meta.cpp Problem: pointee types are unnecessarily non-const 2020-02-04 18:34:19 +01:00
test_atomics.cpp Problem: tests without test framework 2018-12-09 07:36:39 -05:00
test_base85.cpp Problem: pointee types are unnecessarily non-const 2020-02-04 18:34:19 +01:00
test_bind_after_connect_tcp.cpp Problem: default test setUp/tearDown functions duplicated in many test programs 2019-03-24 12:53:12 -04:00
test_bind_curve_fuzzer.cpp Problem: fuzzer corpus file can be quite large 2020-07-04 17:50:35 +01:00
test_bind_fuzzer.cpp Problem: fuzzer corpus file can be quite large 2020-07-04 17:50:35 +01:00
test_bind_null_fuzzer.cpp Problem: fuzzer corpus file can be quite large 2020-07-04 17:50:35 +01:00
test_bind_src_address.cpp Problem: default test setUp/tearDown functions duplicated in many test programs 2019-03-24 12:53:12 -04:00
test_bind_stream_fuzzer.cpp Problem: no fuzzing coverage for ZMQ_STREAM 2020-09-06 11:05:15 +01:00
test_bind_ws_fuzzer.cpp Problem: test_bind_ws_fuzzer needs DRAFT sockets 2020-08-21 14:39:08 +01:00
test_busy_poll.cpp Support so_busy_poll (#4188) 2021-05-14 23:05:56 +01:00
test_capabilities.cpp Problem: test_capabilities fails on Windows when IPC support is available 2019-12-06 20:24:41 +01:00
test_channel.cpp problem: no thread-safe alternative for ZMQ_PAIR 2020-05-09 08:49:01 +03:00
test_client_server.cpp Problem: use of C-style casts 2019-12-08 15:24:48 +01:00
test_conflate.cpp Problem: code from bind_loopback_ipv4 is duplicated 2019-03-24 13:34:13 -04:00
test_connect_curve_fuzzer.cpp Problem: fuzzer corpus file can be quite large 2020-07-04 17:50:35 +01:00
test_connect_delay_tipc.cpp Problem: default test setUp/tearDown functions duplicated in many test programs 2019-03-24 12:53:12 -04:00
test_connect_fuzzer.cpp Problem: fuzzer corpus file can be quite large 2020-07-04 17:50:35 +01:00
test_connect_null_fuzzer.cpp Problem: fuzzer corpus file can be quite large 2020-07-04 17:50:35 +01:00
test_connect_resolve.cpp Problem: test_connect_resolve not yet using unity 2018-03-14 22:40:24 +01:00
test_connect_rid.cpp Problem: default test setUp/tearDown functions duplicated in many test programs 2019-03-24 12:53:12 -04:00
test_connect_stream_fuzzer.cpp Problem: no fuzzing coverage for ZMQ_STREAM 2020-09-06 11:05:15 +01:00
test_connect_ws_fuzzer.cpp Problem: no fuzz testing for websockets 2020-07-05 23:43:58 +01:00
test_ctx_destroy.cpp Problem: pointee types are unnecessarily non-const 2020-02-04 18:34:19 +01:00
test_ctx_options.cpp Problem: zmq_ctx_get API broken 2020-09-10 22:37:01 +01:00
test_dgram.cpp Problem: default test setUp/tearDown functions duplicated in many test programs 2019-03-24 12:53:12 -04:00
test_diffserv.cpp Problem: default test setUp/tearDown functions duplicated in many test programs 2019-03-24 12:53:12 -04:00
test_disconnect_inproc.cpp Problem: pointee types are unnecessarily non-const 2020-02-04 18:34:19 +01:00
test_disconnect_msg.cpp problem: router doesn't know when peer disconnected 2020-04-17 18:04:28 +03:00
test_filter_ipc.cpp Problem: test_filter_ipc is flacky 2023-01-31 01:16:24 +00:00
test_fork.cpp Problem: default test setUp/tearDown functions duplicated in many test programs 2019-03-24 12:53:12 -04:00
test_getsockopt_memset.cpp Problem: default test setUp/tearDown functions duplicated in many test programs 2019-03-24 12:53:12 -04:00
test_heartbeats.cpp Problem: some tests occasionally fail on OBS 2021-09-22 16:42:09 +01:00
test_hello_msg.cpp Problem: test_hello_msg binds to hard-coded port and fails when it's in use 2020-05-05 14:13:38 +01:00
test_hiccup_msg.cpp problem: no way to know when connection is temporarly dropped 2021-06-06 17:14:22 +03:00
test_hwm_pubsub.cpp Problem: formatting errors with clang-format-11 2023-01-12 01:07:06 +00:00
test_hwm.cpp Problem: default test setUp/tearDown functions duplicated in many test programs 2019-03-24 12:53:12 -04:00
test_immediate.cpp Problem: some tests occasionally fail on OBS 2021-09-22 16:42:09 +01:00
test_inproc_connect.cpp deprecate sprint and replace with snprintf 2023-01-24 22:45:48 +01:00
test_invalid_rep.cpp Problem: default test setUp/tearDown functions duplicated in many test programs 2019-03-24 12:53:12 -04:00
test_iov.cpp Problem: default test setUp/tearDown functions duplicated in many test programs 2019-03-24 12:53:12 -04:00
test_ipc_wildcard.cpp Problem: code from bind_loopback_ipc is duplicated 2019-03-24 13:34:13 -04:00
test_issue_566.cpp deprecate sprint and replace with snprintf 2023-01-24 22:45:48 +01:00
test_last_endpoint.cpp Problem: default test setUp/tearDown functions duplicated in many test programs 2019-03-24 12:53:12 -04:00
test_many_sockets.cpp Problem: pointee types are unnecessarily non-const 2020-02-04 18:34:19 +01:00
test_metadata.cpp Problem: ROUTER loses first frame metadata on message prefetch 2021-12-16 10:17:44 +02:00
test_mock_pub_sub.cpp problem: zeromq connects peer before handshake is completed 2020-05-13 19:36:13 +03:00
test_monitor.cpp Problem: build fails with gcc 12 2022-01-18 16:15:07 +00:00
test_msg_ffn.cpp Problem: boilerplate when init msg from data copy (#3860) 2020-04-09 23:59:43 +01:00
test_msg_flags.cpp Problem: default test setUp/tearDown functions duplicated in many test programs 2019-03-24 12:53:12 -04:00
test_msg_init.cpp Problem: boilerplate when init msg from data copy (#3860) 2020-04-09 23:59:43 +01:00
test_pair_inproc.cpp Problem: tests without test framework 2018-12-10 07:01:06 -05:00
test_pair_ipc.cpp Problem: no test for (invalid) too long ipc endpoint name 2020-09-05 13:17:13 +02:00
test_pair_tcp_cap_net_admin.cpp Problem: test_pair_tcp_cap_net_admin requires privileges and might fail 2021-09-22 16:40:17 +01:00
test_pair_tcp.cpp Problem: socket returned by ZMQ_FD cannot be used with CreateIoCompletionPort 2019-03-27 09:56:11 +01:00
test_pair_tipc.cpp Problem: default test setUp/tearDown functions duplicated in many test programs 2019-03-24 12:53:12 -04:00
test_pair_vmci.cpp Problem: VMCI tests are not skipped outside VMs 2023-01-31 00:28:38 +00:00
test_peer.cpp problem: zeromq doesn't has a thread-safe peer to peer socket 2020-02-09 23:20:14 +02:00
test_poller.cpp Problem: formatting errors with clang-format-11 2023-01-12 01:07:06 +00:00
test_probe_router.cpp Problem: default test setUp/tearDown functions duplicated in many test programs 2019-03-24 12:53:12 -04:00
test_proxy_hwm.cpp Problem: no permission to relicense zmq_proxy_steerable 2023-06-04 23:54:31 +01:00
test_proxy_single_socket.cpp Problem: no permission to relicense zmq_proxy_steerable 2023-06-04 23:54:31 +01:00
test_proxy_terminate.cpp Problem: no permission to relicense zmq_proxy_steerable 2023-06-04 23:54:31 +01:00
test_proxy.cpp Problem: no permission to relicense zmq_proxy_steerable 2023-06-04 23:54:31 +01:00
test_pub_invert_matching.cpp Problem: default test setUp/tearDown functions duplicated in many test programs 2019-03-24 12:53:12 -04:00
test_pubsub_topics_count.cpp Problem: buffer overflow in new test case 2023-01-15 23:44:12 +00:00
test_pubsub.cpp Problem: norm fails to compile under windows (#4123) 2021-01-18 08:42:14 +00:00
test_radio_dish.cpp Problem: formatting errors with clang-format-11 2023-01-12 01:07:06 +00:00
test_rebind_ipc.cpp Problem: ipc transport not supported under Windows 2019-10-29 23:04:54 +01:00
test_reconnect_ivl.cpp Problem: mingw build broken 2019-12-28 21:17:09 +01:00
test_reconnect_options.cpp Problem: formatting errors 2020-06-26 23:45:39 +01:00
test_req_correlate.cpp Problem: tests fails to receive with EAGAIN on slow architectures 2020-11-18 13:29:33 +00:00
test_req_relaxed.cpp Problem: tests fails to receive with EAGAIN on slow architectures 2020-11-18 13:29:33 +00:00
test_reqrep_device_tipc.cpp Problem: default test setUp/tearDown functions duplicated in many test programs 2019-03-24 12:53:12 -04:00
test_reqrep_device.cpp Problem: default test setUp/tearDown functions duplicated in many test programs 2019-03-24 12:53:12 -04:00
test_reqrep_inproc.cpp Problem: default test setUp/tearDown functions duplicated in many test programs 2019-03-24 12:53:12 -04:00
test_reqrep_ipc.cpp Problem: code from bind_loopback_ipc is duplicated 2019-03-24 13:34:13 -04:00
test_reqrep_tcp.cpp deprecate sprint and replace with snprintf 2023-01-24 22:45:48 +01:00
test_reqrep_tipc.cpp Problem: default test setUp/tearDown functions duplicated in many test programs 2019-03-24 12:53:12 -04:00
test_reqrep_vmci.cpp Problem: VMCI tests are not skipped outside VMs 2023-01-31 00:28:38 +00:00
test_router_handover.cpp Problem: code from bind_loopback_ipv4 is duplicated 2019-03-24 13:34:13 -04:00
test_router_mandatory_hwm.cpp Fix typos 2022-02-11 00:45:06 +02:00
test_router_mandatory_tipc.cpp Problem: default test setUp/tearDown functions duplicated in many test programs 2019-03-24 12:53:12 -04:00
test_router_mandatory.cpp Problem: code from bind_loopback_ipv4 is duplicated 2019-03-24 13:34:13 -04:00
test_router_notify.cpp Problem: identifiers not conformant with naming convention 2019-12-08 15:24:48 +01:00
test_scatter_gather.cpp Problem: s_send(more) can be replaced by safer send_string_expect_success 2019-03-24 13:34:13 -04:00
test_security_curve.cpp Problem: some tests time out in CI under Valgrind 2021-09-22 16:40:17 +01:00
test_security_gssapi.cpp Fix typos 2022-02-11 00:45:06 +02:00
test_security_no_zap_handler.cpp Problem: default test setUp/tearDown functions duplicated in many test programs 2019-03-24 12:53:12 -04:00
test_security_null.cpp Problem: using BSD sockets in test is duplicated across many tests 2020-04-26 17:59:26 +01:00
test_security_plain.cpp Problem: using BSD sockets in test is duplicated across many tests 2020-04-26 17:59:26 +01:00
test_security_zap.cpp Problem: default test setUp/tearDown functions duplicated in many test programs 2019-03-24 12:53:12 -04:00
test_setsockopt.cpp deprecate sprint and replace with snprintf 2023-01-24 22:45:48 +01:00
test_shutdown_stress_tipc.cpp Problem: test_shutdown_stress_tipc fails sometimes 2020-04-26 15:08:04 +01:00
test_shutdown_stress.cpp Problem: some tests time out in CI under Valgrind 2021-09-22 16:40:17 +01:00
test_socket_null.cpp Problem: pointee types are unnecessarily non-const 2020-02-04 18:34:19 +01:00
test_socket_options_fuzzer.cpp Problem: test_socket_options_fuzzer does not work 2020-08-22 17:01:10 +01:00
test_sockopt_hwm.cpp Problem: default test setUp/tearDown functions duplicated in many test programs 2019-03-24 12:53:12 -04:00
test_socks.cpp Problem: some tests time out in CI under Valgrind 2021-09-22 16:40:17 +01:00
test_sodium.cpp Problem: tests without test framework 2018-12-16 12:28:42 -05:00
test_spec_dealer.cpp Problem: formatting errors with clang-format-11 2023-01-12 01:07:06 +00:00
test_spec_pushpull.cpp Fix typos 2022-02-11 00:45:06 +02:00
test_spec_rep.cpp Problem: tests fails to receive with EAGAIN on slow architectures 2020-11-18 13:29:33 +00:00
test_spec_req.cpp avoid intermittent timeouts in test (esp. when run w/ASAN etc.) 2022-09-30 11:45:19 -04:00
test_spec_router.cpp Problem: formatting errors with clang-format-11 2023-01-12 01:07:06 +00:00
test_srcfd.cpp Problem: default test setUp/tearDown functions duplicated in many test programs 2019-03-24 12:53:12 -04:00
test_stream_disconnect.cpp deprecate sprint and replace with snprintf 2023-01-24 22:45:48 +01:00
test_stream_empty.cpp Problem: default test setUp/tearDown functions duplicated in many test programs 2019-03-24 12:53:12 -04:00
test_stream_exceeds_buffer.cpp Problem: using BSD sockets in test is duplicated across many tests 2020-04-26 17:59:26 +01:00
test_stream_timeout.cpp Problem: duplicated code in tests related to monitoring 2020-02-04 18:36:03 +01:00
test_stream.cpp Problem: libzmq does not advertise ZMTP 3.1 2020-02-05 17:03:39 +00:00
test_sub_forward_tipc.cpp Problem: default test setUp/tearDown functions duplicated in many test programs 2019-03-24 12:53:12 -04:00
test_sub_forward.cpp Problem: default test setUp/tearDown functions duplicated in many test programs 2019-03-24 12:53:12 -04:00
test_system.cpp Problem: Multiple fd_t definitions 2020-04-28 08:50:18 +00:00
test_tcp_accept_filter.cpp Problem: formatting errors with clang-format-11 2023-01-12 01:07:06 +00:00
test_term_endpoint_tipc.cpp Problem: default test setUp/tearDown functions duplicated in many test programs 2019-03-24 12:53:12 -04:00
test_term_endpoint.cpp Problem: VMCI might not be supported by CI 2021-09-22 16:40:17 +01:00
test_thread_safe.cpp Problem: code from bind_loopback_ipv4 is duplicated 2019-03-24 13:34:13 -04:00
test_timeo.cpp Problem: default test setUp/tearDown functions duplicated in many test programs 2019-03-24 12:53:12 -04:00
test_timers.cpp Problem: use of C-style casts 2019-12-08 15:24:48 +01:00
test_unbind_wildcard.cpp deprecate sprint and replace with snprintf 2023-01-24 22:45:48 +01:00
test_use_fd.cpp Problem: set infinite timeouts on some tests by mistake 2020-05-06 20:56:36 +01:00
test_ws_transport.cpp deprecate sprint and replace with snprintf 2023-01-24 22:45:48 +01:00
test_wss_transport.cpp remove c99 extention from c++11 code 2023-04-18 22:27:06 +01:00
test_xpub_manual_last_value.cpp problem: test_xpub_manual is flapping 2020-05-14 00:01:06 +03:00
test_xpub_manual.cpp problem: test_xpub_manual is flapping 2020-05-14 00:01:06 +03:00
test_xpub_nodrop.cpp Problem: redundant else after return 2019-12-08 15:24:48 +01:00
test_xpub_verbose.cpp Problem: default test setUp/tearDown functions duplicated in many test programs 2019-03-24 12:53:12 -04:00
test_xpub_welcome_msg.cpp Problem: default test setUp/tearDown functions duplicated in many test programs 2019-03-24 12:53:12 -04:00
test_xsub_verbose.cpp Problem: if ZMQ_XPUB_VERBOSER is used with proxies unsubscribe messages are lost 2021-11-05 15:12:31 +01:00
test_z85_decode_fuzzer.cpp Problem: fuzzer corpus file can be quite large 2020-07-04 17:50:35 +01:00
test_zmq_poll_fd.cpp Problem: default test setUp/tearDown functions duplicated in many test programs 2019-03-24 12:53:12 -04:00
test_zmq_ppoll_fd.cpp add zmq_ppoll 2021-09-24 11:04:20 +02:00
test_zmq_ppoll_signals.cpp Problem: test_zmq_ppoll_signals does not cleanup context 2023-01-16 00:52:30 +00:00
testutil_monitoring.cpp Problem: build fails with gcc 12 2022-01-18 16:15:07 +00:00
testutil_monitoring.hpp Problem: build fails with gcc 12 2022-01-18 16:15:07 +00:00
testutil_security.cpp Problem: sanitizer tests cannot allocate much memory 2020-05-05 11:42:06 +01:00
testutil_security.hpp Problem: formatting errors 2021-09-22 16:40:17 +01:00
testutil_unity.cpp Problem: build broken on debian/hurd 2021-01-16 17:48:29 +00:00
testutil_unity.hpp Problem: formatting errors with clang-format-11 2023-01-12 01:07:06 +00:00
testutil.cpp deprecate sprint and replace with snprintf 2023-01-24 22:45:48 +01:00
testutil.hpp Merge pull request #4174 from jlsantiago0/build-fix-bsd 2021-04-15 23:16:33 +01:00

Guidelines for tests

Write your test case as if you were writing clean application code. It should be safe to compile on all platforms.

Normally, you should only include the header files from the tests directory, e.g. testutil.hpp. Do not include files from src. Do not use the internal libzmq API. Tests for these should be placed in unittests instead.

If you must write non-portable code, wrap it in #ifdefs to ensure it will compile and run on all systems.

Note that testutil.hpp includes platform.h. Do not include it yourself as it changes location depending on the build system and OS.

All sources must contain the correct copyright header. Please copy from test_system.cpp if you're not certain.

Write new tests using the unity test framework. For an example, see test_sockopt_hwm.

Please use only ANSI C99 in test cases, no C++. This is to make the code more reusable.

On many slower environments, like embedded systems, VMs or CI systems, tests might fail because it takes time for sockets to settle after a connect. If you need to add a sleep, please be consistent with all the other tests and use: msleep (SETTLE_TIME);

Ensure proper cleanup

If a test program uses unity, it will execute test cases individually, and will continue to run further test cases if an assertion in one test case fails. However, the test case that had an assertion failure will be aborted. To ensure that the resources of the test case are properly cleaned up, use appropriate setUp and tearDown functions. These are run by unity before each test case starts resp. after it ended (whether successfully or not). The same setUp and tearDown function is used for all test cases in a test program.

For many test cases, the following setUp and tearDown functions will be appropriate: void setUp () { setup_test_context (); }

void tearDown ()
{
	teardown_test_context ();
}

Within the tests, do not use zmq_socket and zmq_close then but test_context_socket and test_context_socket_close instead. These functions will register/unregister sockets with the test_context. All sockets not closed when tearDown is executed, with forcibly be closed with linger=0 before terminating the context. Note that it is a misuse not to close sockets during successful test execution, and a warning will be output.

Building tests in Windows

The tests are only built via cmake, not when using the checked-in Visual Studio .sln files.