mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-13 10:52:56 +01:00
Problem: tests readme outdated
Solution: fixed description for building tests, added references to unity and unittests
This commit is contained in:
parent
ae558706bf
commit
437e9f4f59
@ -2,27 +2,23 @@
|
|||||||
|
|
||||||
Write your test case as if you were writing clean application code. It should be safe to compile on all platforms.
|
Write your test case as if you were writing clean application code. It should be safe to compile on all platforms.
|
||||||
|
|
||||||
The only include file you should use is `testutil.hpp`. Do not include files from src. Do not use the internal libzmq API or your test case is fair game to be deleted.
|
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.
|
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.
|
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 header. Please copy from test_system.cpp if you're not certain.
|
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.
|
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, test might
|
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
|
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:
|
to add a sleep, please be consistent with all the other tests and use:
|
||||||
msleep (SETTLE_TIME);
|
msleep (SETTLE_TIME);
|
||||||
|
|
||||||
# Building tests in Windows
|
# Building tests in Windows
|
||||||
|
|
||||||
According to the version of your compiler, you should adapt the path `libzmq.lib` in the file `tests/CMakeLists.txt`.
|
|
||||||
|
|
||||||
Install CMAKE
|
|
||||||
CMD> CMAKE libzmq/tests
|
|
||||||
CMD> tests.sln
|
|
||||||
CMD> # build all projects in the solution
|
|
||||||
|
|
||||||
|
The tests are only built via cmake, not when using the checked-in Visual Studio .sln files.
|
||||||
|
Loading…
Reference in New Issue
Block a user