From 0be287b67bca5e778cd42ef4a7d92a202d3c6619 Mon Sep 17 00:00:00 2001 From: Erik Boasson Date: Wed, 29 Apr 2020 19:50:52 +0200 Subject: [PATCH] No auto-dispose in deadline test Use of an auto-dispose writer meant the NO_WRITERS case did not actually get tested. The behaviour of the implementation was to generate deadline missed notifications for such instances, but the test expected otherwise. There is a disagreement between different DDS implementations on the desirability of generating deadline missed notifications for NOT_ALIVE instances. Deadline notifications on DISPOSED instances seems silly, as it means end-of-life. Deadline notifications on a NO_WRITERS instance are certainly valuable for applications that don't pay attention to the number of writers (otherwise one has to monitor both liveliness changed and deadline missed notifications to be be sure to get some notification). Different usage patterns definitely affect what is desirable and I doubt one-size-fits-all is the right approach. This commit changes the test and retains the behaviour, and if it errs, it at least errs on the side of caution. Signed-off-by: Erik Boasson --- src/core/ddsc/tests/deadline.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/ddsc/tests/deadline.c b/src/core/ddsc/tests/deadline.c index e10bd74..c97debb 100644 --- a/src/core/ddsc/tests/deadline.c +++ b/src/core/ddsc/tests/deadline.c @@ -125,6 +125,7 @@ static void deadline_init(void) dds_qset_history(g_qos, DDS_HISTORY_KEEP_ALL, DDS_LENGTH_UNLIMITED); dds_qset_durability(g_qos, DDS_DURABILITY_TRANSIENT_LOCAL); dds_qset_reliability(g_qos, DDS_RELIABILITY_RELIABLE, DDS_INFINITY); + dds_qset_writer_data_lifecycle(g_qos, false); } static void deadline_fini(void) @@ -422,7 +423,10 @@ CU_Theory((int32_t n_inst, uint8_t unreg_nth, uint8_t dispose_nth), ddsc_deadlin n_dispose++; } } - n_alive = n_inst - n_dispose - n_unreg; + /* FIXME: should unregistered instances cause deadline expirations? I do think so + and that is what it actually implemented + if they shouldn't: n_alive = n_inst - n_dispose - n_unreg */ + n_alive = n_inst - n_dispose; /* Sleep deadline_dur + 50% and check missed deadline count */ sleepfor(3 * deadline_dur / 2);