diff --git a/CMakeLists.txt b/CMakeLists.txt index f1d94fbb..69421b52 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,9 +10,9 @@ if(APPLE) endif() if(WIN32) -option(WITH_TWEETNACL "Build with tweetnacl" OFF) + option(WITH_TWEETNACL "Build with tweetnacl" OFF) else() -option(WITH_TWEETNACL "Build with tweetnacl" ON) + option(WITH_TWEETNACL "Build with tweetnacl" ON) endif() if(WITH_TWEETNACL) @@ -23,7 +23,7 @@ if(WITH_TWEETNACL) ) set(TWEETNACL_SOURCES - tweetnacl/src/tweetnacl.c + tweetnacl/src/tweetnacl.c ) if(WIN32) else() @@ -157,6 +157,7 @@ check_function_exists(gethrtime HAVE_GETHRTIME) set(CMAKE_REQUIRED_INCLUDES ) add_definitions(-D_REENTRANT -D_THREAD_SAFE) +add_definitions(-D_USING_CMAKE) option(ENABLE_EVENTFD "Enable/disable eventfd" ZMQ_HAVE_EVENTFD) diff --git a/tests/testutil.hpp b/tests/testutil.hpp index 68a80892..ed1915ee 100644 --- a/tests/testutil.hpp +++ b/tests/testutil.hpp @@ -32,7 +32,11 @@ #include "../include/zmq.h" #include "../src/stdint.hpp" -#include "platform.hpp" +#ifdef USING_CMAKE +# include "platform.hpp" +#else +# include "../src/platform.hpp" +#endif // This defines the settle time used in tests; raise this if we // get test failures on slower systems due to binds/connects not @@ -60,7 +64,6 @@ // Bounce a message from client to server and back // For REQ/REP or DEALER/DEALER pairs only - void bounce (void *server, void *client) { @@ -116,7 +119,6 @@ bounce (void *server, void *client) // Same as bounce, but expect messages to never arrive // for security or subscriber reasons. - void expect_bounce_fail (void *server, void *client) { @@ -193,7 +195,9 @@ const char *SEQ_END = (const char *) 1; // Sends a message composed of frames that are C strings or null frames. // The list must be terminated by SEQ_END. // Example: s_send_seq (req, "ABC", 0, "DEF", SEQ_END); -void s_send_seq (void *socket, ...) + +void +s_send_seq (void *socket, ...) { va_list ap; va_start (ap, socket); @@ -222,7 +226,9 @@ void s_send_seq (void *socket, ...) // the given data which can be either C strings or 0 for a null frame. // The list must be terminated by SEQ_END. // Example: s_recv_seq (rep, "ABC", 0, "DEF", SEQ_END); -void s_recv_seq (void *socket, ...) + +void +s_recv_seq (void *socket, ...) { zmq_msg_t msg; zmq_msg_init (&msg); @@ -260,7 +266,8 @@ void s_recv_seq (void *socket, ...) // Sets a zero linger period on a socket and closes it. -void close_zero_linger (void *socket) +void +close_zero_linger (void *socket) { int linger = 0; int rc = zmq_setsockopt (socket, ZMQ_LINGER, &linger, sizeof(linger)); @@ -269,7 +276,8 @@ void close_zero_linger (void *socket) assert (rc == 0); } -void setup_test_environment() +void +setup_test_environment (void) { #if defined _WIN32 # if defined _MSC_VER @@ -296,8 +304,11 @@ void setup_test_environment() } // Provide portable millisecond sleep -// http://www.cplusplus.com/forum/unices/60161/ http://en.cppreference.com/w/cpp/thread/sleep_for -void msleep (int milliseconds) +// http://www.cplusplus.com/forum/unices/60161/ +// http://en.cppreference.com/w/cpp/thread/sleep_for + +void +msleep (int milliseconds) { #ifdef ZMQ_HAVE_WINDOWS Sleep (milliseconds);