From 11f0802912fd6e6dfe3726d0ca787ff96c0a202d Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Tue, 21 Sep 2021 19:06:56 +0100 Subject: [PATCH] Problem: VMCI might not be supported by CI Solution: skip tests if zmq_bind fails with EAFNOSUPPORT --- tests/test_pair_vmci.cpp | 5 ++++- tests/test_reqrep_vmci.cpp | 5 ++++- tests/test_term_endpoint.cpp | 10 ++++++++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/tests/test_pair_vmci.cpp b/tests/test_pair_vmci.cpp index 2e20cc0c..87150ed9 100644 --- a/tests/test_pair_vmci.cpp +++ b/tests/test_pair_vmci.cpp @@ -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 ())); diff --git a/tests/test_reqrep_vmci.cpp b/tests/test_reqrep_vmci.cpp index 24dd72b1..f93b9102 100644 --- a/tests/test_reqrep_vmci.cpp +++ b/tests/test_reqrep_vmci.cpp @@ -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 ())); diff --git a/tests/test_term_endpoint.cpp b/tests/test_term_endpoint.cpp index 8f1a9e24..6430a7fe 100644 --- a/tests/test_term_endpoint.cpp +++ b/tests/test_term_endpoint.cpp @@ -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