mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-06-18 16:17:14 +02:00
Update ZMQ to current git.
This commit is contained in:
4
vendor/ZMQ/tests/CMakeLists.txt
vendored
4
vendor/ZMQ/tests/CMakeLists.txt
vendored
@ -161,7 +161,11 @@ if(ENABLE_DRAFTS)
|
||||
test_channel
|
||||
test_hello_msg
|
||||
test_disconnect_msg
|
||||
test_hiccup_msg
|
||||
)
|
||||
if(ZMQ_HAVE_BUSY_POLL)
|
||||
list(APPEND tests test_busy_poll)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ZMQ_HAVE_WS)
|
||||
|
58
vendor/ZMQ/tests/test_busy_poll.cpp
vendored
Normal file
58
vendor/ZMQ/tests/test_busy_poll.cpp
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
Copyright (c) 2007-2021 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of libzmq, the ZeroMQ core engine in C++.
|
||||
|
||||
libzmq is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU Lesser General Public License (LGPL) as published
|
||||
by the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
As a special exception, the Contributors give you permission to link
|
||||
this library with independent modules to produce an executable,
|
||||
regardless of the license terms of these independent modules, and to
|
||||
copy and distribute the resulting executable under terms of your choice,
|
||||
provided that you also meet, for each linked independent module, the
|
||||
terms and conditions of the license of that module. An independent
|
||||
module is a module which is not derived from or based on this library.
|
||||
If you modify this library, you must extend this exception to your
|
||||
version of the library.
|
||||
|
||||
libzmq is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "testutil.hpp"
|
||||
#include "testutil_unity.hpp"
|
||||
|
||||
SETUP_TEARDOWN_TESTCONTEXT
|
||||
|
||||
void test_busy_poll ()
|
||||
{
|
||||
// Create a socket
|
||||
void *socket = test_context_socket (ZMQ_DEALER);
|
||||
|
||||
// set socket ZMQ_BUSY_POLL options
|
||||
int busy_poll = 1;
|
||||
TEST_ASSERT_SUCCESS_ERRNO (
|
||||
zmq_setsockopt (socket, ZMQ_BUSY_POLL, &busy_poll, sizeof (int)));
|
||||
|
||||
// bind socket
|
||||
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (socket, "tcp://127.0.0.1:*"));
|
||||
|
||||
// Clean up.
|
||||
test_context_socket_close (socket);
|
||||
}
|
||||
|
||||
int main ()
|
||||
{
|
||||
setup_test_environment ();
|
||||
UNITY_BEGIN ();
|
||||
RUN_TEST (test_busy_poll);
|
||||
return UNITY_END ();
|
||||
}
|
76
vendor/ZMQ/tests/test_hiccup_msg.cpp
vendored
Normal file
76
vendor/ZMQ/tests/test_hiccup_msg.cpp
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
/*
|
||||
Copyright (c) 2007-2021 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of libzmq, the ZeroMQ core engine in C++.
|
||||
|
||||
libzmq is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU Lesser General Public License (LGPL) as published
|
||||
by the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
As a special exception, the Contributors give you permission to link
|
||||
this library with independent modules to produce an executable,
|
||||
regardless of the license terms of these independent modules, and to
|
||||
copy and distribute the resulting executable under terms of your choice,
|
||||
provided that you also meet, for each linked independent module, the
|
||||
terms and conditions of the license of that module. An independent
|
||||
module is a module which is not derived from or based on this library.
|
||||
If you modify this library, you must extend this exception to your
|
||||
version of the library.
|
||||
|
||||
libzmq is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "testutil.hpp"
|
||||
#include "testutil_unity.hpp"
|
||||
|
||||
SETUP_TEARDOWN_TESTCONTEXT
|
||||
|
||||
void test ()
|
||||
{
|
||||
char address[MAX_SOCKET_STRING];
|
||||
size_t addr_length = sizeof (address);
|
||||
|
||||
// Create a server
|
||||
void *server = test_context_socket (ZMQ_SERVER);
|
||||
|
||||
// bind server
|
||||
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (server, "tcp://127.0.0.1:*"));
|
||||
TEST_ASSERT_SUCCESS_ERRNO (
|
||||
zmq_getsockopt (server, ZMQ_LAST_ENDPOINT, address, &addr_length));
|
||||
|
||||
// Create a client
|
||||
void *client = test_context_socket (ZMQ_CLIENT);
|
||||
TEST_ASSERT_SUCCESS_ERRNO (
|
||||
zmq_setsockopt (client, ZMQ_HELLO_MSG, "HELLO", 5));
|
||||
TEST_ASSERT_SUCCESS_ERRNO (
|
||||
zmq_setsockopt (client, ZMQ_HICCUP_MSG, "HICCUP", 6));
|
||||
TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (client, address));
|
||||
|
||||
// Receive the hello message from client
|
||||
recv_string_expect_success (server, "HELLO", 0);
|
||||
|
||||
// Kill the server
|
||||
test_context_socket_close (server);
|
||||
|
||||
// Receive the hiccup message
|
||||
recv_string_expect_success (client, "HICCUP", 0);
|
||||
|
||||
// Clean up.
|
||||
test_context_socket_close (client);
|
||||
}
|
||||
|
||||
int main ()
|
||||
{
|
||||
setup_test_environment ();
|
||||
|
||||
UNITY_BEGIN ();
|
||||
RUN_TEST (test);
|
||||
return UNITY_END ();
|
||||
}
|
6
vendor/ZMQ/tests/test_inproc_connect.cpp
vendored
6
vendor/ZMQ/tests/test_inproc_connect.cpp
vendored
@ -54,8 +54,9 @@ static void simult_conn (void *endpt_)
|
||||
|
||||
// Connect
|
||||
// do not use test_context_socket here, as it is not thread-safe
|
||||
void *connect_socket = zmq_socket (get_test_context (), ZMQ_SUB);
|
||||
void *connect_socket = zmq_socket (get_test_context (), ZMQ_PAIR);
|
||||
TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (connect_socket, endpt));
|
||||
recv_string_expect_success (connect_socket, "foobar", 0);
|
||||
|
||||
// Cleanup
|
||||
TEST_ASSERT_SUCCESS_ERRNO (zmq_close (connect_socket));
|
||||
@ -68,8 +69,9 @@ static void simult_bind (void *endpt_)
|
||||
|
||||
// Bind
|
||||
// do not use test_context_socket here, as it is not thread-safe
|
||||
void *bind_socket = zmq_socket (get_test_context (), ZMQ_PUB);
|
||||
void *bind_socket = zmq_socket (get_test_context (), ZMQ_PAIR);
|
||||
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (bind_socket, endpt));
|
||||
send_string_expect_success (bind_socket, "foobar", 0);
|
||||
|
||||
// Cleanup
|
||||
TEST_ASSERT_SUCCESS_ERRNO (zmq_close (bind_socket));
|
||||
|
6
vendor/ZMQ/tests/test_pair_vmci.cpp
vendored
6
vendor/ZMQ/tests/test_pair_vmci.cpp
vendored
@ -48,10 +48,10 @@ void test_pair_vmci ()
|
||||
void *sc = test_context_socket (ZMQ_PAIR);
|
||||
TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (sc, endpoint.c_str ()));
|
||||
|
||||
bounce (sb, sc);
|
||||
expect_bounce_fail (sb, sc);
|
||||
|
||||
test_context_socket_close (sc);
|
||||
test_context_socket_close (sb);
|
||||
test_context_socket_close_zero_linger (sc);
|
||||
test_context_socket_close_zero_linger (sb);
|
||||
}
|
||||
|
||||
int main (void)
|
||||
|
10
vendor/ZMQ/tests/test_reqrep_vmci.cpp
vendored
10
vendor/ZMQ/tests/test_reqrep_vmci.cpp
vendored
@ -42,16 +42,16 @@ void test_reqrep_vmci ()
|
||||
s << "vmci://" << VMCISock_GetLocalCID () << ":" << 5560;
|
||||
std::string endpoint = s.str ();
|
||||
|
||||
void *sb = test_context_socket (ZMQ_REP);
|
||||
void *sb = test_context_socket (ZMQ_DEALER);
|
||||
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb, endpoint.c_str ()));
|
||||
|
||||
void *sc = test_context_socket (ZMQ_REQ);
|
||||
void *sc = test_context_socket (ZMQ_DEALER);
|
||||
TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (sc, endpoint.c_str ()));
|
||||
|
||||
bounce (sb, sc);
|
||||
expect_bounce_fail (sb, sc);
|
||||
|
||||
test_context_socket_close (sc);
|
||||
test_context_socket_close (sb);
|
||||
test_context_socket_close_zero_linger (sc);
|
||||
test_context_socket_close_zero_linger (sb);
|
||||
}
|
||||
|
||||
int main (void)
|
||||
|
5
vendor/ZMQ/tests/testutil.hpp
vendored
5
vendor/ZMQ/tests/testutil.hpp
vendored
@ -41,7 +41,12 @@
|
||||
// For AF_INET and IPPROTO_TCP
|
||||
#if defined _WIN32
|
||||
#include "../src/windows.hpp"
|
||||
#if defined(__MINGW32__)
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#else
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
|
Reference in New Issue
Block a user