aboutsummaryrefslogtreecommitdiffstats
path: root/test/oslib/configuration.xml
diff options
context:
space:
mode:
Diffstat (limited to 'test/oslib/configuration.xml')
-rw-r--r--test/oslib/configuration.xml118
1 files changed, 118 insertions, 0 deletions
diff --git a/test/oslib/configuration.xml b/test/oslib/configuration.xml
index 292d0198f..f5b35e5c5 100644
--- a/test/oslib/configuration.xml
+++ b/test/oslib/configuration.xml
@@ -1325,6 +1325,124 @@ test_assert(dsp == NULL, "found");]]></value>
</step>
</steps>
</case>
+ <case>
+ <brief>
+ <value>Dynamic Mailboxes Factory.</value>
+ </brief>
+ <description>
+ <value>This test case verifies the dynamic mailboxes factory.</value>
+ </description>
+ <condition>
+ <value>CH_CFG_FACTORY_MAILBOXES == TRUE</value>
+ </condition>
+ <various_code>
+ <setup_code>
+ <value />
+ </setup_code>
+ <teardown_code>
+ <value><![CDATA[dyn_mailbox_t *dmp;
+
+dmp = chFactoryFindMailbox("mymbx");
+if (dmp != NULL) {
+ while (dmp->element.refs > 0U) {
+ chFactoryReleaseMailbox(dmp);
+ }
+}]]></value>
+ </teardown_code>
+ <local_variables>
+ <value><![CDATA[dyn_mailbox_t *dmp;]]></value>
+ </local_variables>
+ </various_code>
+ <steps>
+ <step>
+ <description>
+ <value>Retrieving a dynamic mailbox by name, must not exist.</value>
+ </description>
+ <tags>
+ <value />
+ </tags>
+ <code>
+ <value><![CDATA[dmp = chFactoryFindMailbox("mymbx");
+test_assert(dmp == NULL, "found");]]></value>
+ </code>
+ </step>
+ <step>
+ <description>
+ <value>Creating a dynamic mailbox it must not exists, must succeed.</value>
+ </description>
+ <tags>
+ <value />
+ </tags>
+ <code>
+ <value><![CDATA[dmp = chFactoryCreateMailbox("mymbx", 16U);
+test_assert(dmp != NULL, "cannot create");]]></value>
+ </code>
+ </step>
+ <step>
+ <description>
+ <value>Creating a dynamic mailbox with the same name, must fail.</value>
+ </description>
+ <tags>
+ <value />
+ </tags>
+ <code>
+ <value><![CDATA[dyn_mailbox_t *dmp1;
+
+dmp1 = chFactoryCreateMailbox("mymbx", 16U);
+test_assert(dmp1 == NULL, "can create");]]></value>
+ </code>
+ </step>
+ <step>
+ <description>
+ <value>Retrieving the dynamic mailbox by name, must exist, then increasing the reference counter, finally releasing both references.</value>
+ </description>
+ <tags>
+ <value />
+ </tags>
+ <code>
+ <value><![CDATA[dyn_mailbox_t *dmp1, *dmp2;
+
+dmp1 = chFactoryFindMailbox("mymbx");
+test_assert(dmp1 != NULL, "not found");
+test_assert(dmp == dmp1, "object reference mismatch");
+test_assert(dmp1->element.refs == 2, "object reference mismatch");
+
+dmp2 = (dyn_mailbox_t *)chFactoryDuplicateReference((dyn_element_t *)dmp1);
+test_assert(dmp1 == dmp2, "object reference mismatch");
+test_assert(dmp2->element.refs == 3, "object reference mismatch");
+
+chFactoryReleaseMailbox(dmp2);
+test_assert(dmp1->element.refs == 2, "references mismatch");
+
+chFactoryReleaseMailbox(dmp1);
+test_assert(dmp->element.refs == 1, "references mismatch");]]></value>
+ </code>
+ </step>
+ <step>
+ <description>
+ <value>Releasing the first reference to the dynamic mailbox must not trigger an assertion.</value>
+ </description>
+ <tags>
+ <value />
+ </tags>
+ <code>
+ <value><![CDATA[chFactoryReleaseMailbox(dmp);]]></value>
+ </code>
+ </step>
+ <step>
+ <description>
+ <value>Retrieving the dynamic mailbox by name again, must not exist.</value>
+ </description>
+ <tags>
+ <value />
+ </tags>
+ <code>
+ <value><![CDATA[dmp = chFactoryFindMailbox("mymbx");
+test_assert(dmp == NULL, "found");]]></value>
+ </code>
+ </step>
+ </steps>
+ </case>
</cases>
</sequence>
</sequences>