Allow coexisting domains and do a minimal test

The big issue is the there is still only a single log output that gets
opened on creating a domain and closed on deleting one, but otherwise at
least this minimal test works.

The other issue is that the GC waits until threads in all domains have
made sufficient progress, rather than just the threads in its own
domain.

Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
Erik Boasson 2019-07-05 22:13:35 +02:00 committed by eboasson
parent c1f3ad8a22
commit c9f04ee5bd
2 changed files with 31 additions and 3 deletions

View file

@ -218,10 +218,8 @@ dds_return_t dds_domain_create (dds_domain **domain_out, dds_domainid_t id)
{ {
if ((dom = dds_domain_find_locked (id)) == NULL) if ((dom = dds_domain_find_locked (id)) == NULL)
ret = DDS_RETCODE_NOT_FOUND; ret = DDS_RETCODE_NOT_FOUND;
else if (dom->m_id == id)
ret = DDS_RETCODE_OK;
else else
ret = DDS_RETCODE_PRECONDITION_NOT_MET; ret = DDS_RETCODE_OK;
} }
else else
{ {

View file

@ -72,6 +72,36 @@ CU_Test(ddsc_participant, create_with_no_conf_no_env)
} }
/* Test for creating participants in multiple domains with no configuration file */
CU_Test(ddsc_participant, create_multiple_domains)
{
dds_entity_t participant1, participant2;
dds_return_t status;
dds_domainid_t domain_id;
ddsrt_setenv("CYCLONEDDS_URI", "<Tracing><Verbosity>finest</><OutputFile>multi-domain-1.log</></>");
//valid specific domain value
participant1 = dds_create_participant (1, NULL, NULL);
CU_ASSERT_FATAL(participant1 > 0);
status = dds_get_domainid(participant1, &domain_id);
CU_ASSERT_EQUAL_FATAL(status, DDS_RETCODE_OK);
CU_ASSERT_EQUAL_FATAL(domain_id, 1);
ddsrt_setenv("CYCLONEDDS_URI", "<Tracing><Verbosity>finest</><OutputFile>multi-domain-2.log</></>");
//DDS_DOMAIN_DEFAULT from user
participant2 = dds_create_participant (2, NULL, NULL);
CU_ASSERT_FATAL(participant2 > 0);
status = dds_get_domainid(participant2, &domain_id);
CU_ASSERT_EQUAL_FATAL(status, DDS_RETCODE_OK);
CU_ASSERT_EQUAL_FATAL(domain_id, 2);
dds_delete(participant1);
dds_delete(participant2);
}
////WITH CONF ////WITH CONF
/* Test for creating participant with valid configuration file */ /* Test for creating participant with valid configuration file */