test_reqrep_vmci.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MPL-2.0 */
2 
3 #include <string>
4 #include <sstream>
5 #include <vmci_sockets.h>
6 
7 #include "testutil.hpp"
8 #include "testutil_unity.hpp"
9 
11 
13 {
14  unsigned int cid = VMCISock_GetLocalCID ();
15  if (cid == VMADDR_CID_ANY)
16  TEST_IGNORE_MESSAGE ("VMCI environment unavailable, skipping test");
17  std::stringstream s;
18  s << "vmci://" << cid << ":" << 5560;
19  std::string endpoint = s.str ();
20 
22  int rc = zmq_bind (sb, endpoint.c_str ());
23  if (rc < 0 && (errno == EAFNOSUPPORT || errno == EPROTONOSUPPORT))
24  TEST_IGNORE_MESSAGE ("VMCI not supported");
26 
28  TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (sc, endpoint.c_str ()));
29 
30  bounce (sb, sc);
31 
34 }
35 
36 int main (void)
37 {
39 
40  UNITY_BEGIN ();
42  return UNITY_END ();
43 }
test_reqrep_vmci
SETUP_TEARDOWN_TESTCONTEXT void test_reqrep_vmci()
Definition: test_reqrep_vmci.cpp:12
bounce
static void bounce(void *socket_)
Definition: test_req_relaxed.cpp:50
EAFNOSUPPORT
#define EAFNOSUPPORT
Definition: zmq.h:134
UNITY_END
return UNITY_END()
s
XmlRpcServer s
RUN_TEST
#define RUN_TEST(func)
Definition: unity_internals.h:615
SETUP_TEARDOWN_TESTCONTEXT
#define SETUP_TEARDOWN_TESTCONTEXT
Definition: testutil_unity.hpp:172
string
GLsizei const GLchar *const * string
Definition: glcorearb.h:3083
errno
int errno
test_context_socket_close_zero_linger
void * test_context_socket_close_zero_linger(void *socket_)
Definition: testutil_unity.cpp:215
zmq_connect
ZMQ_EXPORT int zmq_connect(void *s_, const char *addr_)
Definition: zmq.cpp:307
testutil_unity.hpp
ZMQ_DEALER
#define ZMQ_DEALER
Definition: zmq.h:263
sb
void * sb
Definition: test_channel.cpp:8
testutil.hpp
zmq_bind
ZMQ_EXPORT int zmq_bind(void *s_, const char *addr_)
Definition: zmq.cpp:299
sc
void * sc
Definition: test_channel.cpp:9
test_context_socket
void * test_context_socket(int type_)
Definition: testutil_unity.cpp:200
EPROTONOSUPPORT
#define EPROTONOSUPPORT
Definition: zmq.h:107
TEST_IGNORE_MESSAGE
#define TEST_IGNORE_MESSAGE(message)
Definition: unity.h:103
setup_test_environment
void setup_test_environment(int timeout_seconds_)
Definition: testutil.cpp:201
UNITY_BEGIN
UNITY_BEGIN()
main
int main(void)
Definition: test_reqrep_vmci.cpp:36
TEST_ASSERT_SUCCESS_ERRNO
#define TEST_ASSERT_SUCCESS_ERRNO(expr)
Definition: proxy_thr.cpp:47


libaditof
Author(s):
autogenerated on Wed May 21 2025 02:06:59