Name
Last commit
Last update
..
CMakeLists.txt Problem: test_monitor depends on testutil_security
README.md Problem: missing guidelines on proper test cleanup
test_abstract_ipc.cpp Problem: tests without test framework
test_address_tipc.cpp Problem: bug in tipc_listener_t::set_address, random port is determined but not used
test_ancillaries.cpp Problem: test_ancillarries not yet using unity
test_app_meta.cpp Problem: test_app_meta cannot be ran in parallel
test_atomics.cpp Problem: tests without test framework
test_base85.cpp Problem: test_base85 not yet using unity
test_bind_after_connect_tcp.cpp Migrate tests/test_bind_after_connect_tcp.cpp to unity
test_bind_src_address.cpp Migrate tests/test_bind_src_address.cpp to unity
test_capabilities.cpp Problem: test_capabilities not yet using unity
test_client_server.cpp Problem: tests do not follow naming style
test_conflate.cpp Migrate tests/test_conflate.cpp to unity
test_connect_delay_tipc.cpp Problem: test_connect_delay_tipc randomly fails
test_connect_resolve.cpp Problem: test_connect_resolve not yet using unity
test_connect_rid.cpp Problem: test_connect_rid not yet using unity
test_ctx_destroy.cpp Problem: tests do not follow naming style
test_ctx_options.cpp Problem: ZMQ_SOCKET_LIMIT and ZMQ_THREAD_PRIORITY have the same value
test_dgram.cpp Problem: tests without test framework
test_diffserv.cpp Problem: tests without test framework
test_disconnect_inproc.cpp Problem: tests do not follow naming style
test_filter_ipc.cpp Problem: typo in RUN_TEST macro breaks debian/kfreebsd build
test_fork.cpp Problem: formatting inconsistent
test_getsockopt_memset.cpp Problem: formatting inconsistent
test_heartbeats.cpp Problem: tests do not follow naming style
test_hwm.cpp Problem: tests do not follow naming style
test_hwm_pubsub.cpp Problem: GNU/Hurd does not implement getsockname for ipc
test_immediate.cpp Problem: test_immediate not using unity
test_inproc_connect.cpp Problem: GCC warnings about string overflows in tests
test_invalid_rep.cpp Problem: tests without test framework
test_iov.cpp Problem: tests without test framework
test_ipc_wildcard.cpp Problem: tests without test framework
test_issue_566.cpp Problem: GCC warnings about string overflows in tests
test_last_endpoint.cpp Problem: tests do not follow naming style
test_many_sockets.cpp Problem: test_many_sockets does not show number of sockets that could be created
test_metadata.cpp Problem: tests without test framework
test_mock_pub_sub.cpp Problem: can't process ZMTP 3.1 cancel/subscribe commands
test_monitor.cpp Problem: test_monitor fails with ipv6
test_msg_ffn.cpp Problem: tests do not follow naming style
test_msg_flags.cpp Problem: formatting inconsistent
test_pair_inproc.cpp Problem: tests without test framework
test_pair_ipc.cpp Problem: tests use hard-coded fixed IPC file path
test_pair_tcp.cpp Problem: test_pair_tcp not yet using unity
test_pair_tipc.cpp Problem: tests without test framework
test_pair_vmci.cpp Problem: formatting inconsistent
test_poller.cpp Problem: tests do not follow naming style
test_probe_router.cpp Problem: test case test_probe_router_router does not receive auto-generated routing id
test_proxy.cpp Problem: zmq_proxy STATISTICS eligible for stable
test_proxy_hwm.cpp Problem: zmq_proxy STATISTICS eligible for stable
test_proxy_single_socket.cpp Problem: tests do not follow naming style
test_proxy_terminate.cpp Loading commit data...
test_pub_invert_matching.cpp Loading commit data...
test_radio_dish.cpp Loading commit data...
test_rebind_ipc.cpp Loading commit data...
test_reconnect_ivl.cpp Loading commit data...
test_req_correlate.cpp Loading commit data...
test_req_relaxed.cpp Loading commit data...
test_reqrep_device.cpp Loading commit data...
test_reqrep_device_tipc.cpp Loading commit data...
test_reqrep_inproc.cpp Loading commit data...
test_reqrep_ipc.cpp Loading commit data...
test_reqrep_tcp.cpp Loading commit data...
test_reqrep_tipc.cpp Loading commit data...
test_reqrep_vmci.cpp Loading commit data...
test_router_handover.cpp Loading commit data...
test_router_mandatory.cpp Loading commit data...
test_router_mandatory_hwm.cpp Loading commit data...
test_router_mandatory_tipc.cpp Loading commit data...
test_router_notify.cpp Loading commit data...
test_scatter_gather.cpp Loading commit data...
test_security_curve.cpp Loading commit data...
test_security_gssapi.cpp Loading commit data...
test_security_null.cpp Loading commit data...
test_security_plain.cpp Loading commit data...
test_security_zap.cpp Loading commit data...
test_setsockopt.cpp Loading commit data...
test_shutdown_stress.cpp Loading commit data...
test_shutdown_stress_tipc.cpp Loading commit data...
test_socket_null.cpp Loading commit data...
test_sockopt_hwm.cpp Loading commit data...
test_sodium.cpp Loading commit data...
test_spec_dealer.cpp Loading commit data...
test_spec_pushpull.cpp Loading commit data...
test_spec_rep.cpp Loading commit data...
test_spec_req.cpp Loading commit data...
test_spec_router.cpp Loading commit data...
test_srcfd.cpp Loading commit data...
test_stream.cpp Loading commit data...
test_stream_disconnect.cpp Loading commit data...
test_stream_empty.cpp Loading commit data...
test_stream_exceeds_buffer.cpp Loading commit data...
test_stream_timeout.cpp Loading commit data...
test_sub_forward.cpp Loading commit data...
test_sub_forward_tipc.cpp Loading commit data...
test_system.cpp Loading commit data...
test_term_endpoint.cpp Loading commit data...
test_term_endpoint_tipc.cpp Loading commit data...
test_thread_safe.cpp Loading commit data...
test_timeo.cpp Loading commit data...
test_timers.cpp Loading commit data...
test_unbind_wildcard.cpp Loading commit data...
test_use_fd.cpp Loading commit data...
test_xpub_manual.cpp Loading commit data...
test_xpub_nodrop.cpp Loading commit data...
test_xpub_verbose.cpp Loading commit data...
test_xpub_welcome_msg.cpp Loading commit data...
test_zmq_poll_fd.cpp Loading commit data...
testutil.hpp Loading commit data...
testutil_monitoring.hpp Loading commit data...
testutil_security.hpp Loading commit data...
testutil_unity.hpp Loading commit data...

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.