mirror of
https://github.com/zeromq/libzmq.git
synced 2025-03-20 18:48:16 +00:00
Problem: cannot build single test case in tests
This is due to the mangled include of platform.h, which was to make CMake happy. Solution: in CMakeLists.txt, define USING_CMAKE and then look for platform.h in current directory if that is defined, else look in ../src/ as one would expect.
This commit is contained in:
parent
5e936fe955
commit
d416ffcec5
@ -10,9 +10,9 @@ if(APPLE)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
option(WITH_TWEETNACL "Build with tweetnacl" OFF)
|
option(WITH_TWEETNACL "Build with tweetnacl" OFF)
|
||||||
else()
|
else()
|
||||||
option(WITH_TWEETNACL "Build with tweetnacl" ON)
|
option(WITH_TWEETNACL "Build with tweetnacl" ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_TWEETNACL)
|
if(WITH_TWEETNACL)
|
||||||
@ -157,6 +157,7 @@ check_function_exists(gethrtime HAVE_GETHRTIME)
|
|||||||
set(CMAKE_REQUIRED_INCLUDES )
|
set(CMAKE_REQUIRED_INCLUDES )
|
||||||
|
|
||||||
add_definitions(-D_REENTRANT -D_THREAD_SAFE)
|
add_definitions(-D_REENTRANT -D_THREAD_SAFE)
|
||||||
|
add_definitions(-D_USING_CMAKE)
|
||||||
|
|
||||||
option(ENABLE_EVENTFD "Enable/disable eventfd" ZMQ_HAVE_EVENTFD)
|
option(ENABLE_EVENTFD "Enable/disable eventfd" ZMQ_HAVE_EVENTFD)
|
||||||
|
|
||||||
|
@ -32,7 +32,11 @@
|
|||||||
|
|
||||||
#include "../include/zmq.h"
|
#include "../include/zmq.h"
|
||||||
#include "../src/stdint.hpp"
|
#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
|
// This defines the settle time used in tests; raise this if we
|
||||||
// get test failures on slower systems due to binds/connects not
|
// get test failures on slower systems due to binds/connects not
|
||||||
@ -60,7 +64,6 @@
|
|||||||
|
|
||||||
// Bounce a message from client to server and back
|
// Bounce a message from client to server and back
|
||||||
// For REQ/REP or DEALER/DEALER pairs only
|
// For REQ/REP or DEALER/DEALER pairs only
|
||||||
|
|
||||||
void
|
void
|
||||||
bounce (void *server, void *client)
|
bounce (void *server, void *client)
|
||||||
{
|
{
|
||||||
@ -116,7 +119,6 @@ bounce (void *server, void *client)
|
|||||||
|
|
||||||
// Same as bounce, but expect messages to never arrive
|
// Same as bounce, but expect messages to never arrive
|
||||||
// for security or subscriber reasons.
|
// for security or subscriber reasons.
|
||||||
|
|
||||||
void
|
void
|
||||||
expect_bounce_fail (void *server, void *client)
|
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.
|
// Sends a message composed of frames that are C strings or null frames.
|
||||||
// The list must be terminated by SEQ_END.
|
// The list must be terminated by SEQ_END.
|
||||||
// Example: s_send_seq (req, "ABC", 0, "DEF", 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_list ap;
|
||||||
va_start (ap, socket);
|
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 given data which can be either C strings or 0 for a null frame.
|
||||||
// The list must be terminated by SEQ_END.
|
// The list must be terminated by SEQ_END.
|
||||||
// Example: s_recv_seq (rep, "ABC", 0, "DEF", 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_t msg;
|
||||||
zmq_msg_init (&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.
|
// 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 linger = 0;
|
||||||
int rc = zmq_setsockopt (socket, ZMQ_LINGER, &linger, sizeof(linger));
|
int rc = zmq_setsockopt (socket, ZMQ_LINGER, &linger, sizeof(linger));
|
||||||
@ -269,7 +276,8 @@ void close_zero_linger (void *socket)
|
|||||||
assert (rc == 0);
|
assert (rc == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup_test_environment()
|
void
|
||||||
|
setup_test_environment (void)
|
||||||
{
|
{
|
||||||
#if defined _WIN32
|
#if defined _WIN32
|
||||||
# if defined _MSC_VER
|
# if defined _MSC_VER
|
||||||
@ -296,8 +304,11 @@ void setup_test_environment()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Provide portable millisecond sleep
|
// Provide portable millisecond sleep
|
||||||
// http://www.cplusplus.com/forum/unices/60161/ http://en.cppreference.com/w/cpp/thread/sleep_for
|
// http://www.cplusplus.com/forum/unices/60161/
|
||||||
void msleep (int milliseconds)
|
// http://en.cppreference.com/w/cpp/thread/sleep_for
|
||||||
|
|
||||||
|
void
|
||||||
|
msleep (int milliseconds)
|
||||||
{
|
{
|
||||||
#ifdef ZMQ_HAVE_WINDOWS
|
#ifdef ZMQ_HAVE_WINDOWS
|
||||||
Sleep (milliseconds);
|
Sleep (milliseconds);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user