Commit Graph

4521 Commits

Author SHA1 Message Date
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
Constantin Rack
18dcc32ac3 Merge pull request #1803 from bluca/ci_default_only_on_secondary
Problem: too many CI builds
2016-02-13 01:18:47 +01:00
Luca Boccassi
9a6e10406d Problem: too many CI builds
Solution: remove libsodium and no curve builds from cmake and android
2016-02-12 23:22:51 +00:00
Luca Boccassi
930a24425c Merge pull request #1802 from hintjens/master
Problem: tests don't build on Windows
2016-02-12 15:28:09 +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
Luca Boccassi
0dbb918244 Merge pull request #1800 from hintjens/master
Cleaning up Windows build for gyp
2016-02-12 15:00:24 +00: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
d148c3ea5d Problem: no clue how to run gyp on Windows
Solution: offer a build.bat to help the user.
2016-02-12 15:48:37 +01:00
Luca Boccassi
8bee4e2547 Merge pull request #1799 from hintjens/master
Making gyp builds work
2016-02-12 10:40:43 +00: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
44c3859073 Problem: minor glitch, test_socketopt_hwm <> test_sockopt_hwm
Doesn't affect building, just potentially confusing.

Solution: fix it.
2016-02-12 11:24:35 +01:00
Pieter Hintjens
25ce52e449 Problem: tcp_address.cpp has messy include usage
It's all over the place.

Solution: remove duplicates and try to move main includes to start
of source. Also, include net/if.h always, so that the code will
compile if ZMQ_HAVE_IFADDRS isn't defined.
2016-02-12 11:01:52 +01:00
Pieter Hintjens
a682f94a32 Problem: tcp_address.cpp won't compile on OS/X w/o ZMQ_HAVE_IFADDRS
This is rather insane since the code knows well enough what systems
support if_nametoindex. I blame this on over-use of autotools early
in libzmq's days.

Anyhow, this breaks gyp builds on OS/X.

Solution: add ZMQ_HAVE_IFADDRS to build/gyp/platform.hpp for OS/X.
2016-02-12 10:49:19 +01:00
Constantin Rack
22e830bece Merge pull request #1798 from hintjens/master
Getting gyp build working
2016-02-12 10:07:14 +01:00
Pieter Hintjens
6bef3fe9ad Problem: can't build libzmq.a using gyp
Solution: add necessary macros into builds/gyp/platform.hpp

Work for Linux now, other platforms to test.
2016-02-12 09:58:44 +01:00
Joe Eli McIlvain
781ddd6758 Merge pull request #1797 from bluca/ci_matrix
Problem: CI use of sodium or nacl is confusing
2016-02-11 15:31:21 -08:00
Luca Boccassi
9393f06381 Problem: CI use of sodium or nacl is confusing
Solution: establish a matrix of CI options. On one axis we have the
build system (autotools, cmake, android) and on the other axis we
have the encryption options (tweetnacl, libsodium or none).
2016-02-11 22:39:36 +00:00
Pieter Hintjens
05f382d290 Merge pull request #1796 from bluca/cmake_build
Problem: typo in CMake platform.hpp breaks build
2016-02-11 23:06:07 +01:00
Luca Boccassi
01eb580739 Problem: typo in CMake platform.hpp breaks build
Solution: use ZMQ_USE_TWEETNACL as a define as expected instead of
HAVE_TWEETNACL
2016-02-11 21:41:21 +00:00
Pieter Hintjens
fde81d7e07 Problem: can't build using gyp
I'm adding gyp support so that we can easily pull in libzmq
and other C/C++ projects into gyp packages, especially via
node-gyp.

Solution: add gyp definition

This works only for Windows, OS/X, and Linux. We set a single
macro in project.gyp according to the system, and the rest is
done in builds/gyp/platform.hpp. The values in that file are
not dynamic. Your mileage will vary.
2016-02-11 22:41:01 +01:00
Pieter Hintjens
db77fc9ced Merge pull request #1795 from bluca/ci_tweetnacl
Problem: CI is borken
2016-02-11 22:18:52 +01:00
Luca Boccassi
0afac59018 Problem: empty files are against ISO C++
Solution: if not building with tweetnacl, do not include its sources
in Makefile.am. CMake already includes them optionally.
2016-02-11 21:05:10 +00:00
Luca Boccassi
f1c4416e20 Problem: typo in CMakeLists "matches" keyword
Solution: must be upper case
2016-02-11 20:41:18 +00:00
Luca Boccassi
1e6915039f Problem: typo in CMakeLists.txt, can't use sodium
Solution: check for WITH_LIBSODIUM configure option instead of
WITH_SODIUM
2016-02-11 20:40:34 +00:00
Luca Boccassi
f777ad8b91 Problem: typo in configure.ac, can't use libsodium
Solution: set the curve_library variable to the expected value if
libsodium is selected
2016-02-11 20:30:07 +00:00
Luca Boccassi
0bdc5d0457 Problem: CMake CI build still clones libsodium
Solution: avoid cloning libsodium, default build is tweetnacl
2016-02-11 20:27:06 +00:00
Luca Boccassi
4f5594c2ce Problem: Android CI build uses unstable libsodium
Solution: checkout stable branch before building
2016-02-11 20:25:21 +00:00
Luca Boccassi
3420e6e0dd Problem: CI still thinks libsodium is default
Solution: build by default with tweetnacl, and add sub-build project
to test libsodium
2016-02-11 20:16:17 +00:00
Luca Boccassi
1fb4840955 Merge pull request #1794 from hintjens/master
Problem: tweetnacl sources are a mess
2016-02-11 17:19:16 +00:00
Pieter Hintjens
f8ed793f76 Problem: tweetnacl sources are a mess
- they have no copyright / license statement
- they are in some randomish directory structure
- they are a mix of postable and non-portable files
- they do not conform to conditional compile environment

Overall, it makes it rather more work than needed, in build scripts.

Solution: clean up tweetnacl sauce.

- merged code into single tweetnacl.c and .h
- standard copyright header, DJB to AUTHORS
- moved into src/ along with all other source files
- all system and conditional compilation hidden in these files
- thus, they can be compiled and packaged in all cases
- ZMQ_USE_TWEETNACL is set when we're using built-in tweetnacl
- HAVE_LIBSODIUM is set when we're using external libsodium
2016-02-11 18:06:07 +01:00
Constantin Rack
a460e5abd2 Merge pull request #1793 from hintjens/master 2016-02-11 17:13:03 +01:00
Pieter Hintjens
e65367ea2d Problem: some configure options are confusing
It's especially annoying to see this:

  --enable-perf           Build performance measurement tools [default=yes].
  --disable-eventfd       disable eventfd [default=no]
  --enable-curve-keygen   Build curve key-generation tool [default=yes].

Solution: all options should explain the non-default case. Also
the language should be enable/disable, with/without, rather than
yes/no. E.g. '--without-docs'.
2016-02-11 16:52:41 +01:00
Pieter Hintjens
8e40e67d29 Merge pull request #1792 from bluca/fix_gitignore
Problem: old filenames in .gitignore
2016-02-11 16:36:30 +01:00
Luca Boccassi
700de65a37 Merge pull request #1791 from hintjens/master
Problem: autotools platform.hpp is not compatible with CMake
2016-02-11 15:30:37 +00:00
Luca Boccassi
2e3a0db5f9 Problem: old filenames in .gitignore
Solution: remove them
2016-02-11 15:29:14 +00:00
Pieter Hintjens
9f8ced3f65 Problem: autotools platform.hpp is not compatible with CMake
Specifically, the poller detection code does not set macros in
platform.hpp. The configure script passed them as -D on the command
line.

Solution: rewrite the poller detection code.
2016-02-11 16:14:12 +01:00
Constantin Rack
dd4b93ddd8 Merge pull request #1790 from hintjens/master
Problem: use of libsodium vs. tweetnacl is confused
2016-02-11 14:00:09 +01:00
Pieter Hintjens
ddbbe3b47c Problem: cmake fails with #error None of the ZMQ_USE_* macros defined
This happens if you first configure with autotools, and then run
cmake. The problem is that the compiler finds the old src/platform.hpp
before looking for the one generated by CMake. Further, there are a
set of macros that configure passes via the command line, yet CMake
passes via platform.hpp. (HAVE_xxx for pollers, at least.) This means
you can't do a CMake build using the autotools platform.hpp.

Solution: remove any src/platform.hpp when running cmake. This is a
workaround. I'll fix the inconsistent macros separately.
2016-02-11 13:38:02 +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
Min RK
42ab88e486 Merge pull request #1786 from hintjens/master
Cleaning up recent option names
2016-02-09 12:50:30 +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