mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-27 15:41:05 +08:00
Merge pull request #3438 from sigiesec/fix-appveyor-test-execution
Fix appveyor test execution
This commit is contained in:
commit
2e6464864e
10
appveyor.yml
10
appveyor.yml
@ -36,14 +36,17 @@ environment:
|
||||
API_POLLER: poll
|
||||
WITH_LIBSODIUM: ON
|
||||
ENABLE_CURVE: ON
|
||||
TEST_OPTIONS: '-E "(test_many_sockets)"'
|
||||
- platform: Win32
|
||||
configuration: Debug
|
||||
WITH_LIBSODIUM: ON
|
||||
ENABLE_CURVE: ON
|
||||
TEST_OPTIONS: '-E "(test_spec_router|test_spec_pushpull|test_metadata|test_security_curve|test_dgram)"'
|
||||
- platform: x64
|
||||
configuration: Debug
|
||||
WITH_LIBSODIUM: ON
|
||||
ENABLE_CURVE: ON
|
||||
TEST_OPTIONS: '-E "(test_spec_router|test_spec_pushpull|test_metadata|test_security_curve|test_dgram)"'
|
||||
- platform: Win32
|
||||
configuration: Release
|
||||
WITH_LIBSODIUM: OFF
|
||||
@ -65,6 +68,7 @@ environment:
|
||||
CMAKE_GENERATOR: "Visual Studio 15 2017"
|
||||
MSVCVERSION: "v141"
|
||||
MSVCYEAR: "vs2017"
|
||||
TEST_OPTIONS: '-E "(test_many_sockets)"'
|
||||
- platform: cygwin64
|
||||
WITH_LIBSODIUM: OFF
|
||||
ENABLE_CURVE: ON
|
||||
@ -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%" == "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: 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%"
|
||||
|
||||
build_script:
|
||||
@ -188,9 +193,10 @@ test_script:
|
||||
- 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 14 2015 Win64" set PARALLELIZE=ON
|
||||
- cmd: if not defined TEST_OPTIONS set "TEST_OPTIONS= "
|
||||
- cmd: if "%PARALLELIZE%"=="ON" (
|
||||
echo "Running tests in parallel" &&
|
||||
set TEST_OPTIONS=-j5
|
||||
set TEST_OPTIONS=%TEST_OPTIONS% -j5
|
||||
)
|
||||
- cmd: ctest -C "%Configuration%" -V %TEST_OPTIONS%
|
||||
|
||||
|
@ -42,7 +42,7 @@ macro(zmq_check_o_cloexec)
|
||||
int main(int argc, char *argv [])
|
||||
{
|
||||
int s = open (\"/dev/null\", O_CLOEXEC | O_RDONLY);
|
||||
return (s == -1);
|
||||
return s == -1;
|
||||
}
|
||||
"
|
||||
ZMQ_HAVE_O_CLOEXEC)
|
||||
|
@ -87,7 +87,7 @@ class norm_engine_t : public io_object_t, public i_engine
|
||||
// These are used to feed data to decoder
|
||||
// and its underlying "msg" buffer
|
||||
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; }
|
||||
msg_t *AccessMsg () { return zmq_decoder->msg (); }
|
||||
// This invokes the decoder "decode" method
|
||||
@ -106,7 +106,7 @@ class norm_engine_t : public io_object_t, public i_engine
|
||||
void Append (NormRxStreamState &item);
|
||||
void Remove (NormRxStreamState &item);
|
||||
|
||||
bool IsEmpty () const { return (NULL == head); }
|
||||
bool IsEmpty () const { return NULL == head; }
|
||||
|
||||
void Destroy ();
|
||||
|
||||
|
@ -546,7 +546,7 @@ bool zmq::pipe_t::check_hwm () const
|
||||
{
|
||||
const bool full =
|
||||
_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_)
|
||||
@ -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_)
|
||||
{
|
||||
_endpoint_pair = endpoint_pair_;
|
||||
_endpoint_pair = ZMQ_MOVE (endpoint_pair_);
|
||||
}
|
||||
|
||||
const zmq::endpoint_uri_pair_t &zmq::pipe_t::get_endpoint_pair () const
|
||||
|
@ -542,7 +542,7 @@ void zmq::select_t::cleanup_retired ()
|
||||
|
||||
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)
|
||||
|
@ -99,6 +99,10 @@ int count_msg (int send_hwm_, int recv_hwm_, TestType test_type_)
|
||||
TEST_ASSERT_SUCCESS_ERRNO (zmq_setsockopt (
|
||||
connect_socket, ZMQ_SNDHWM, &send_hwm_, sizeof (send_hwm_)));
|
||||
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 {
|
||||
// Set up connect socket
|
||||
connect_socket = test_context_socket (ZMQ_PUSH);
|
||||
|
@ -152,6 +152,10 @@ void test_decrease_when_full ()
|
||||
zmq_bind (bind_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
|
||||
int send_count = test_fill_up_to_hwm (bind_socket, sndhwm);
|
||||
|
||||
|
@ -54,7 +54,6 @@ void test ()
|
||||
int wait = 1;
|
||||
TEST_ASSERT_SUCCESS_ERRNO (zmq_setsockopt (pub, ZMQ_XPUB_NODROP, &wait, 4));
|
||||
|
||||
|
||||
// Create a subscriber
|
||||
void *sub = test_context_socket (ZMQ_SUB);
|
||||
TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (sub, "inproc://soname"));
|
||||
@ -62,6 +61,11 @@ void test ()
|
||||
// Subscribe for all messages.
|
||||
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 send_count = 0;
|
||||
|
||||
@ -74,13 +78,19 @@ void test ()
|
||||
int recv_count = 0;
|
||||
do {
|
||||
// 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) {
|
||||
TEST_ASSERT_EQUAL_INT (EAGAIN, errno);
|
||||
break;
|
||||
} else {
|
||||
TEST_ASSERT_EQUAL_INT (0, rc);
|
||||
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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user