Problem: VMCI might not be supported by CI

Solution: skip tests if zmq_bind fails with EAFNOSUPPORT
This commit is contained in:
Luca Boccassi 2021-09-21 19:06:56 +01:00
parent 37c548d62b
commit 11f0802912
3 changed files with 16 additions and 4 deletions

View File

@ -43,7 +43,10 @@ void test_pair_vmci ()
std::string endpoint = s.str ();
void *sb = test_context_socket (ZMQ_PAIR);
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb, endpoint.c_str ()));
int rc = zmq_bind (sb, endpoint.c_str ());
if (rc < 0 && errno == EAFNOSUPPORT)
TEST_IGNORE_MESSAGE ("VMCI not supported");
TEST_ASSERT_SUCCESS_ERRNO (rc);
void *sc = test_context_socket (ZMQ_PAIR);
TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (sc, endpoint.c_str ()));

View File

@ -43,7 +43,10 @@ void test_reqrep_vmci ()
std::string endpoint = s.str ();
void *sb = test_context_socket (ZMQ_DEALER);
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb, endpoint.c_str ()));
int rc = zmq_bind (sb, endpoint.c_str ());
if (rc < 0 && errno == EAFNOSUPPORT)
TEST_IGNORE_MESSAGE ("VMCI not supported");
TEST_ASSERT_SUCCESS_ERRNO (rc);
void *sc = test_context_socket (ZMQ_DEALER);
TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (sc, endpoint.c_str ()));

View File

@ -115,7 +115,10 @@ void test_unbind_via_last_endpoint ()
#endif
#if defined ZMQ_HAVE_VMCI
void *req = test_context_socket (ZMQ_REQ);
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (req, ep_wc_vmci));
int rc = zmq_bind (req, ep_wc_vmci);
if (rc < 0 && errno == EAFNOSUPPORT)
TEST_IGNORE_MESSAGE ("VMCI not supported");
TEST_ASSERT_SUCCESS_ERRNO (rc);
#endif
// Unbind sockets binded by wild-card address
@ -153,7 +156,10 @@ void test_wildcard_unbind_fails ()
#endif
#if defined ZMQ_HAVE_VMCI
void *req = test_context_socket (ZMQ_REQ);
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (req, ep_wc_vmci));
int rc = zmq_bind (req, ep_wc_vmci);
if (rc < 0 && errno == EAFNOSUPPORT)
TEST_IGNORE_MESSAGE ("VMCI not supported");
TEST_ASSERT_SUCCESS_ERRNO (rc);
#endif
// Sockets binded by wild-card address can't be unbinded by wild-card address