From c9f04ee5bda988cd931d8ee659da0a13b4d017f2 Mon Sep 17 00:00:00 2001 From: Erik Boasson Date: Fri, 5 Jul 2019 22:13:35 +0200 Subject: [PATCH] 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 --- src/core/ddsc/src/dds_domain.c | 4 +--- src/core/ddsc/tests/participant.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/src/core/ddsc/src/dds_domain.c b/src/core/ddsc/src/dds_domain.c index 7c6ac13..97c0a90 100644 --- a/src/core/ddsc/src/dds_domain.c +++ b/src/core/ddsc/src/dds_domain.c @@ -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) ret = DDS_RETCODE_NOT_FOUND; - else if (dom->m_id == id) - ret = DDS_RETCODE_OK; else - ret = DDS_RETCODE_PRECONDITION_NOT_MET; + ret = DDS_RETCODE_OK; } else { diff --git a/src/core/ddsc/tests/participant.c b/src/core/ddsc/tests/participant.c index 8225d2d..714ce42 100644 --- a/src/core/ddsc/tests/participant.c +++ b/src/core/ddsc/tests/participant.c @@ -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", "finestmulti-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", "finestmulti-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 /* Test for creating participant with valid configuration file */