Problem: VMCI tests are not skipped outside VMs

Solution: check CID and skip if unavailable
This commit is contained in:
Luca Boccassi 2023-01-31 00:28:38 +00:00
parent acfdf67127
commit ccdc2f7583
2 changed files with 8 additions and 2 deletions

View File

@ -38,8 +38,11 @@ SETUP_TEARDOWN_TESTCONTEXT
void test_pair_vmci ()
{
unsigned int cid = VMCISock_GetLocalCID ();
if (cid == VMADDR_CID_ANY)
TEST_IGNORE_MESSAGE ("VMCI environment unavailable, skipping test");
std::stringstream s;
s << "vmci://" << VMCISock_GetLocalCID () << ":" << 5560;
s << "vmci://" << cid << ":" << 5560;
std::string endpoint = s.str ();
void *sb = test_context_socket (ZMQ_PAIR);

View File

@ -38,8 +38,11 @@ SETUP_TEARDOWN_TESTCONTEXT
void test_reqrep_vmci ()
{
unsigned int cid = VMCISock_GetLocalCID ();
if (cid == VMADDR_CID_ANY)
TEST_IGNORE_MESSAGE ("VMCI environment unavailable, skipping test");
std::stringstream s;
s << "vmci://" << VMCISock_GetLocalCID () << ":" << 5560;
s << "vmci://" << cid << ":" << 5560;
std::string endpoint = s.str ();
void *sb = test_context_socket (ZMQ_DEALER);