aboutsummaryrefslogtreecommitdiffstats
path: root/test/oslib/configuration.xml
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2017-10-27 14:28:03 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2017-10-27 14:28:03 +0000
commit034cca7ca5232ab9ed6e4dd0c72f952dfaf0c11e (patch)
treef67f1917d1cf9d8d4dd12febc2668f67d1b0e540 /test/oslib/configuration.xml
parent45f40f99b1ed67c03dc9dad0b440a9b3fe3227a3 (diff)
downloadChibiOS-034cca7ca5232ab9ed6e4dd0c72f952dfaf0c11e.tar.gz
ChibiOS-034cca7ca5232ab9ed6e4dd0c72f952dfaf0c11e.tar.bz2
ChibiOS-034cca7ca5232ab9ed6e4dd0c72f952dfaf0c11e.zip
Added test case for dynamic mailboxes.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10902 35acf78f-673a-0410-8e92-d51de3d6d3f4
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>