Unverified Commit 2e646486 authored by Doron Somech's avatar Doron Somech Committed by GitHub

Merge pull request #3438 from sigiesec/fix-appveyor-test-execution

Fix appveyor test execution
parents 995e0a3a 028aecc6
...@@ -36,14 +36,17 @@ environment: ...@@ -36,14 +36,17 @@ environment:
API_POLLER: poll API_POLLER: poll
WITH_LIBSODIUM: ON WITH_LIBSODIUM: ON
ENABLE_CURVE: ON ENABLE_CURVE: ON
TEST_OPTIONS: '-E "(test_many_sockets)"'
- platform: Win32 - platform: Win32
configuration: Debug configuration: Debug
WITH_LIBSODIUM: ON WITH_LIBSODIUM: ON
ENABLE_CURVE: ON ENABLE_CURVE: ON
TEST_OPTIONS: '-E "(test_spec_router|test_spec_pushpull|test_metadata|test_security_curve|test_dgram)"'
- platform: x64 - platform: x64
configuration: Debug configuration: Debug
WITH_LIBSODIUM: ON WITH_LIBSODIUM: ON
ENABLE_CURVE: ON ENABLE_CURVE: ON
TEST_OPTIONS: '-E "(test_spec_router|test_spec_pushpull|test_metadata|test_security_curve|test_dgram)"'
- platform: Win32 - platform: Win32
configuration: Release configuration: Release
WITH_LIBSODIUM: OFF WITH_LIBSODIUM: OFF
...@@ -65,6 +68,7 @@ environment: ...@@ -65,6 +68,7 @@ environment:
CMAKE_GENERATOR: "Visual Studio 15 2017" CMAKE_GENERATOR: "Visual Studio 15 2017"
MSVCVERSION: "v141" MSVCVERSION: "v141"
MSVCYEAR: "vs2017" MSVCYEAR: "vs2017"
TEST_OPTIONS: '-E "(test_many_sockets)"'
- platform: cygwin64 - platform: cygwin64
WITH_LIBSODIUM: OFF WITH_LIBSODIUM: OFF
ENABLE_CURVE: ON ENABLE_CURVE: ON
...@@ -132,7 +136,8 @@ before_build: ...@@ -132,7 +136,8 @@ before_build:
- cmd: if "%PLATFORM%" == "Win32" set EXTRA_FLAGS='-D CMAKE_C_FLAGS_RELEASE="/MT" -D CMAKE_C_FLAGS_DEBUG="/MTd"' - cmd: if "%PLATFORM%" == "Win32" set EXTRA_FLAGS='-D CMAKE_C_FLAGS_RELEASE="/MT" -D CMAKE_C_FLAGS_DEBUG="/MTd"'
- cmd: if "%PLATFORM%" == "x64" set EXTRA_FLAGS='-D CMAKE_C_FLAGS_RELEASE="/MT" -D CMAKE_C_FLAGS_DEBUG="/MTd"' - cmd: if "%PLATFORM%" == "x64" set EXTRA_FLAGS='-D CMAKE_C_FLAGS_RELEASE="/MT" -D CMAKE_C_FLAGS_DEBUG="/MTd"'
- cmd: if "%PLATFORM%" == "cygwin64" set APPVEYOR_BUILD_FOLDER=/cygdrive/C/projects/libzmq - cmd: if "%PLATFORM%" == "cygwin64" set APPVEYOR_BUILD_FOLDER=/cygdrive/C/projects/libzmq
- cmd: cmake -D CMAKE_INCLUDE_PATH="%SODIUM_INCLUDE_DIR%" -D CMAKE_LIBRARY_PATH="%SODIUM_LIBRARY_DIR%" -D WITH_LIBSODIUM="%WITH_LIBSODIUM%" -D ENABLE_DRAFTS="%ENABLE_DRAFTS%" -D ENABLE_ANALYSIS="%ENABLE_ANALYSIS%" -D ENABLE_CURVE="%ENABLE_CURVE%" -D API_POLLER="%API_POLLER%" -D POLLER="%POLLER%" %EXTRA_FLAGS% -D WITH_LIBSODIUM="%WITH_LIBSODIUM%" -D LIBZMQ_WERROR="ON" -G "%CMAKE_GENERATOR%" "%APPVEYOR_BUILD_FOLDER%" - cmd: if "%ENABLE_ANALYSIS%"=="ON" ( set LIBZMQ_WERROR="OFF" ) else ( set LIBZMQ_WERROR="ON" )
- cmd: cmake -D CMAKE_INCLUDE_PATH="%SODIUM_INCLUDE_DIR%" -D CMAKE_LIBRARY_PATH="%SODIUM_LIBRARY_DIR%" -D WITH_LIBSODIUM="%WITH_LIBSODIUM%" -D ENABLE_DRAFTS="%ENABLE_DRAFTS%" -D ENABLE_ANALYSIS="%ENABLE_ANALYSIS%" -D ENABLE_CURVE="%ENABLE_CURVE%" -D API_POLLER="%API_POLLER%" -D POLLER="%POLLER%" %EXTRA_FLAGS% -D WITH_LIBSODIUM="%WITH_LIBSODIUM%" -D LIBZMQ_WERROR="%LIBZMQ_WERROR%" -G "%CMAKE_GENERATOR%" "%APPVEYOR_BUILD_FOLDER%"
- cmd: cd "%LIBZMQ_SRCDIR%" - cmd: cd "%LIBZMQ_SRCDIR%"
build_script: build_script:
...@@ -188,9 +193,10 @@ test_script: ...@@ -188,9 +193,10 @@ test_script:
- cmd: if "%CMAKE_GENERATOR%"=="Visual Studio 14 2015" set PARALLELIZE=ON - cmd: if "%CMAKE_GENERATOR%"=="Visual Studio 14 2015" set PARALLELIZE=ON
- cmd: if "%CMAKE_GENERATOR%"=="Visual Studio 12 2013 Win64" set PARALLELIZE=ON - cmd: if "%CMAKE_GENERATOR%"=="Visual Studio 12 2013 Win64" set PARALLELIZE=ON
- cmd: if "%CMAKE_GENERATOR%"=="Visual Studio 14 2015 Win64" set PARALLELIZE=ON - cmd: if "%CMAKE_GENERATOR%"=="Visual Studio 14 2015 Win64" set PARALLELIZE=ON
- cmd: if not defined TEST_OPTIONS set "TEST_OPTIONS= "
- cmd: if "%PARALLELIZE%"=="ON" ( - cmd: if "%PARALLELIZE%"=="ON" (
echo "Running tests in parallel" && echo "Running tests in parallel" &&
set TEST_OPTIONS=-j5 set TEST_OPTIONS=%TEST_OPTIONS% -j5
) )
- cmd: ctest -C "%Configuration%" -V %TEST_OPTIONS% - cmd: ctest -C "%Configuration%" -V %TEST_OPTIONS%
......
...@@ -42,7 +42,7 @@ macro(zmq_check_o_cloexec) ...@@ -42,7 +42,7 @@ macro(zmq_check_o_cloexec)
int main(int argc, char *argv []) int main(int argc, char *argv [])
{ {
int s = open (\"/dev/null\", O_CLOEXEC | O_RDONLY); int s = open (\"/dev/null\", O_CLOEXEC | O_RDONLY);
return (s == -1); return s == -1;
} }
" "
ZMQ_HAVE_O_CLOEXEC) ZMQ_HAVE_O_CLOEXEC)
......
...@@ -87,7 +87,7 @@ class norm_engine_t : public io_object_t, public i_engine ...@@ -87,7 +87,7 @@ class norm_engine_t : public io_object_t, public i_engine
// These are used to feed data to decoder // These are used to feed data to decoder
// and its underlying "msg" buffer // and its underlying "msg" buffer
char *AccessBuffer () { return (char *) (buffer_ptr + buffer_count); } char *AccessBuffer () { return (char *) (buffer_ptr + buffer_count); }
size_t GetBytesNeeded () const { return (buffer_size - buffer_count); } size_t GetBytesNeeded () const { return buffer_size - buffer_count; }
void IncrementBufferCount (size_t count) { buffer_count += count; } void IncrementBufferCount (size_t count) { buffer_count += count; }
msg_t *AccessMsg () { return zmq_decoder->msg (); } msg_t *AccessMsg () { return zmq_decoder->msg (); }
// This invokes the decoder "decode" method // This invokes the decoder "decode" method
...@@ -106,7 +106,7 @@ class norm_engine_t : public io_object_t, public i_engine ...@@ -106,7 +106,7 @@ class norm_engine_t : public io_object_t, public i_engine
void Append (NormRxStreamState &item); void Append (NormRxStreamState &item);
void Remove (NormRxStreamState &item); void Remove (NormRxStreamState &item);
bool IsEmpty () const { return (NULL == head); } bool IsEmpty () const { return NULL == head; }
void Destroy (); void Destroy ();
......
...@@ -546,7 +546,7 @@ bool zmq::pipe_t::check_hwm () const ...@@ -546,7 +546,7 @@ bool zmq::pipe_t::check_hwm () const
{ {
const bool full = const bool full =
_hwm > 0 && _msgs_written - _peers_msgs_read >= uint64_t (_hwm); _hwm > 0 && _msgs_written - _peers_msgs_read >= uint64_t (_hwm);
return (!full); return !full;
} }
void zmq::pipe_t::send_hwms_to_peer (int inhwm_, int outhwm_) void zmq::pipe_t::send_hwms_to_peer (int inhwm_, int outhwm_)
...@@ -556,7 +556,7 @@ void zmq::pipe_t::send_hwms_to_peer (int inhwm_, int outhwm_) ...@@ -556,7 +556,7 @@ void zmq::pipe_t::send_hwms_to_peer (int inhwm_, int outhwm_)
void zmq::pipe_t::set_endpoint_pair (zmq::endpoint_uri_pair_t endpoint_pair_) void zmq::pipe_t::set_endpoint_pair (zmq::endpoint_uri_pair_t endpoint_pair_)
{ {
_endpoint_pair = endpoint_pair_; _endpoint_pair = ZMQ_MOVE (endpoint_pair_);
} }
const zmq::endpoint_uri_pair_t &zmq::pipe_t::get_endpoint_pair () const const zmq::endpoint_uri_pair_t &zmq::pipe_t::get_endpoint_pair () const
......
...@@ -542,7 +542,7 @@ void zmq::select_t::cleanup_retired () ...@@ -542,7 +542,7 @@ void zmq::select_t::cleanup_retired ()
bool zmq::select_t::is_retired_fd (const fd_entry_t &entry_) bool zmq::select_t::is_retired_fd (const fd_entry_t &entry_)
{ {
return (entry_.fd == retired_fd); return entry_.fd == retired_fd;
} }
zmq::select_t::family_entry_t::family_entry_t () : has_retired (false) zmq::select_t::family_entry_t::family_entry_t () : has_retired (false)
......
...@@ -99,6 +99,10 @@ int count_msg (int send_hwm_, int recv_hwm_, TestType test_type_) ...@@ -99,6 +99,10 @@ int count_msg (int send_hwm_, int recv_hwm_, TestType test_type_)
TEST_ASSERT_SUCCESS_ERRNO (zmq_setsockopt ( TEST_ASSERT_SUCCESS_ERRNO (zmq_setsockopt (
connect_socket, ZMQ_SNDHWM, &send_hwm_, sizeof (send_hwm_))); connect_socket, ZMQ_SNDHWM, &send_hwm_, sizeof (send_hwm_)));
TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (connect_socket, "inproc://a")); TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (connect_socket, "inproc://a"));
// we must wait for the connect to succeed here, unfortunately we don't
// have monitoring events for inproc, so we just hope SETTLE_TIME suffices
msleep (SETTLE_TIME);
} else { } else {
// Set up connect socket // Set up connect socket
connect_socket = test_context_socket (ZMQ_PUSH); connect_socket = test_context_socket (ZMQ_PUSH);
......
...@@ -152,6 +152,10 @@ void test_decrease_when_full () ...@@ -152,6 +152,10 @@ void test_decrease_when_full ()
zmq_bind (bind_socket, "inproc://a"); zmq_bind (bind_socket, "inproc://a");
zmq_connect (connect_socket, "inproc://a"); zmq_connect (connect_socket, "inproc://a");
// we must wait for the connect to succeed here, unfortunately we don't
// have monitoring events for inproc, so we just hope SETTLE_TIME suffices
msleep (SETTLE_TIME);
// Fill up to hwm // Fill up to hwm
int send_count = test_fill_up_to_hwm (bind_socket, sndhwm); int send_count = test_fill_up_to_hwm (bind_socket, sndhwm);
......
...@@ -54,7 +54,6 @@ void test () ...@@ -54,7 +54,6 @@ void test ()
int wait = 1; int wait = 1;
TEST_ASSERT_SUCCESS_ERRNO (zmq_setsockopt (pub, ZMQ_XPUB_NODROP, &wait, 4)); TEST_ASSERT_SUCCESS_ERRNO (zmq_setsockopt (pub, ZMQ_XPUB_NODROP, &wait, 4));
// Create a subscriber // Create a subscriber
void *sub = test_context_socket (ZMQ_SUB); void *sub = test_context_socket (ZMQ_SUB);
TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (sub, "inproc://soname")); TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (sub, "inproc://soname"));
...@@ -62,6 +61,11 @@ void test () ...@@ -62,6 +61,11 @@ void test ()
// Subscribe for all messages. // Subscribe for all messages.
TEST_ASSERT_SUCCESS_ERRNO (zmq_setsockopt (sub, ZMQ_SUBSCRIBE, "", 0)); TEST_ASSERT_SUCCESS_ERRNO (zmq_setsockopt (sub, ZMQ_SUBSCRIBE, "", 0));
// we must wait for the subscription to be processed here, so we just
// hope SETTLE_TIME suffices; otherwise some or all published messages
// might be lost
msleep (SETTLE_TIME);
int hwmlimit = hwm - 1; int hwmlimit = hwm - 1;
int send_count = 0; int send_count = 0;
...@@ -74,13 +78,19 @@ void test () ...@@ -74,13 +78,19 @@ void test ()
int recv_count = 0; int recv_count = 0;
do { do {
// Receive the message in the subscriber // Receive the message in the subscriber
int rc = zmq_recv (sub, NULL, 0, ZMQ_DONTWAIT); int rc = zmq_recv (sub, NULL, 0, 0);
if (rc == -1) { if (rc == -1) {
TEST_ASSERT_EQUAL_INT (EAGAIN, errno); TEST_ASSERT_EQUAL_INT (EAGAIN, errno);
break; break;
} else { } else {
TEST_ASSERT_EQUAL_INT (0, rc); TEST_ASSERT_EQUAL_INT (0, rc);
recv_count++; recv_count++;
if (recv_count == 1) {
const int sub_rcvtimeo = 250;
TEST_ASSERT_SUCCESS_ERRNO (zmq_setsockopt (
sub, ZMQ_RCVTIMEO, &sub_rcvtimeo, sizeof (sub_rcvtimeo)));
}
} }
} while (true); } while (true);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment