OSLIB test suite updated.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12305 110e8d01-0319-4d1e-a829-52ad28d1bb01
This commit is contained in:
parent
e442d39b3e
commit
1dcfea82ec
|
@ -95,7 +95,7 @@
|
|||
#endif
|
||||
|
||||
#if !defined(HAL_USE_SIO)
|
||||
#define HAL_USE_SPI FALSE
|
||||
#define HAL_USE_SIO FALSE
|
||||
#endif
|
||||
|
||||
#if !defined(HAL_USE_SPI)
|
||||
|
|
|
@ -1561,6 +1561,124 @@ test_assert(dofp == NULL, "found");]]></value>
|
|||
</step>
|
||||
</steps>
|
||||
</case>
|
||||
<case>
|
||||
<brief>
|
||||
<value>Dynamic Pipes Factory.</value>
|
||||
</brief>
|
||||
<description>
|
||||
<value>This test case verifies the dynamic pipes factory.</value>
|
||||
</description>
|
||||
<condition>
|
||||
<value>CH_CFG_FACTORY_PIPES == TRUE</value>
|
||||
</condition>
|
||||
<various_code>
|
||||
<setup_code>
|
||||
<value />
|
||||
</setup_code>
|
||||
<teardown_code>
|
||||
<value><![CDATA[dyn_pipe_t *dpp;
|
||||
|
||||
dpp = chFactoryFindPipe("mypipe");
|
||||
if (dpp != NULL) {
|
||||
while (dpp->element.refs > 0U) {
|
||||
chFactoryReleasePipe(dpp);
|
||||
}
|
||||
}]]></value>
|
||||
</teardown_code>
|
||||
<local_variables>
|
||||
<value><![CDATA[dyn_pipe_t *dpp;]]></value>
|
||||
</local_variables>
|
||||
</various_code>
|
||||
<steps>
|
||||
<step>
|
||||
<description>
|
||||
<value>Retrieving a dynamic pipe by name, must not exist.</value>
|
||||
</description>
|
||||
<tags>
|
||||
<value />
|
||||
</tags>
|
||||
<code>
|
||||
<value><![CDATA[dpp = chFactoryFindPipe("mypipe");
|
||||
test_assert(dpp == NULL, "found");]]></value>
|
||||
</code>
|
||||
</step>
|
||||
<step>
|
||||
<description>
|
||||
<value>Creating a dynamic pipe it must not exists, must succeed.</value>
|
||||
</description>
|
||||
<tags>
|
||||
<value />
|
||||
</tags>
|
||||
<code>
|
||||
<value><![CDATA[dpp = chFactoryCreatePipe("mypipe", 16U);
|
||||
test_assert(dpp != NULL, "cannot create");]]></value>
|
||||
</code>
|
||||
</step>
|
||||
<step>
|
||||
<description>
|
||||
<value>Creating a dynamic pipe with the same name, must fail.</value>
|
||||
</description>
|
||||
<tags>
|
||||
<value />
|
||||
</tags>
|
||||
<code>
|
||||
<value><![CDATA[dyn_pipe_t *dpp1;
|
||||
|
||||
dpp1 = chFactoryCreatePipe("mypipe", 16U);
|
||||
test_assert(dpp1 == NULL, "can create");]]></value>
|
||||
</code>
|
||||
</step>
|
||||
<step>
|
||||
<description>
|
||||
<value>Retrieving the dynamic pipe by name, must exist, then increasing the reference counter, finally releasing both references.</value>
|
||||
</description>
|
||||
<tags>
|
||||
<value />
|
||||
</tags>
|
||||
<code>
|
||||
<value><![CDATA[dyn_pipe_t *dpp1, *dpp2;
|
||||
|
||||
dpp1 = chFactoryFindPipe("mypipe");
|
||||
test_assert(dpp1 != NULL, "not found");
|
||||
test_assert(dpp == dpp1, "object reference mismatch");
|
||||
test_assert(dpp1->element.refs == 2, "object reference mismatch");
|
||||
|
||||
dpp2 = (dyn_pipe_t *)chFactoryDuplicateReference(&dpp1->element);
|
||||
test_assert(dpp1 == dpp2, "object reference mismatch");
|
||||
test_assert(dpp2->element.refs == 3, "object reference mismatch");
|
||||
|
||||
chFactoryReleasePipe(dpp2);
|
||||
test_assert(dpp1->element.refs == 2, "references mismatch");
|
||||
|
||||
chFactoryReleasePipe(dpp1);
|
||||
test_assert(dpp->element.refs == 1, "references mismatch");]]></value>
|
||||
</code>
|
||||
</step>
|
||||
<step>
|
||||
<description>
|
||||
<value>Releasing the first reference to the dynamic pipe must not trigger an assertion.</value>
|
||||
</description>
|
||||
<tags>
|
||||
<value />
|
||||
</tags>
|
||||
<code>
|
||||
<value><![CDATA[chFactoryReleasePipe(dpp);]]></value>
|
||||
</code>
|
||||
</step>
|
||||
<step>
|
||||
<description>
|
||||
<value>Retrieving the dynamic pipe by name again, must not exist.</value>
|
||||
</description>
|
||||
<tags>
|
||||
<value />
|
||||
</tags>
|
||||
<code>
|
||||
<value><![CDATA[dpp = chFactoryFindPipe("mypipe");
|
||||
test_assert(dpp == NULL, "found");]]></value>
|
||||
</code>
|
||||
</step>
|
||||
</steps>
|
||||
</case>
|
||||
</cases>
|
||||
</sequence>
|
||||
</sequences>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
|
||||
ChibiOS - Copyright (C) 2006..2017 Giovanni Di Sirio
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
|
||||
ChibiOS - Copyright (C) 2006..2017 Giovanni Di Sirio
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
|
||||
ChibiOS - Copyright (C) 2006..2017 Giovanni Di Sirio
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
|
||||
ChibiOS - Copyright (C) 2006..2017 Giovanni Di Sirio
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
|
||||
ChibiOS - Copyright (C) 2006..2017 Giovanni Di Sirio
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
|
||||
ChibiOS - Copyright (C) 2006..2017 Giovanni Di Sirio
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
|
||||
ChibiOS - Copyright (C) 2006..2017 Giovanni Di Sirio
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
|
||||
ChibiOS - Copyright (C) 2006..2017 Giovanni Di Sirio
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
|
||||
ChibiOS - Copyright (C) 2006..2017 Giovanni Di Sirio
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
@ -41,6 +41,7 @@
|
|||
* - @subpage oslib_test_004_003
|
||||
* - @subpage oslib_test_004_004
|
||||
* - @subpage oslib_test_004_005
|
||||
* - @subpage oslib_test_004_006
|
||||
* .
|
||||
*/
|
||||
|
||||
|
@ -629,6 +630,117 @@ static const testcase_t oslib_test_004_005 = {
|
|||
};
|
||||
#endif /* CH_CFG_FACTORY_OBJ_FIFOS == TRUE */
|
||||
|
||||
#if (CH_CFG_FACTORY_PIPES == TRUE) || defined(__DOXYGEN__)
|
||||
/**
|
||||
* @page oslib_test_004_006 [4.6] Dynamic Pipes Factory
|
||||
*
|
||||
* <h2>Description</h2>
|
||||
* This test case verifies the dynamic pipes factory.
|
||||
*
|
||||
* <h2>Conditions</h2>
|
||||
* This test is only executed if the following preprocessor condition
|
||||
* evaluates to true:
|
||||
* - CH_CFG_FACTORY_PIPES == TRUE
|
||||
* .
|
||||
*
|
||||
* <h2>Test Steps</h2>
|
||||
* - [4.6.1] Retrieving a dynamic pipe by name, must not exist.
|
||||
* - [4.6.2] Creating a dynamic pipe it must not exists, must succeed.
|
||||
* - [4.6.3] Creating a dynamic pipe with the same name, must fail.
|
||||
* - [4.6.4] Retrieving the dynamic pipe by name, must exist, then
|
||||
* increasing the reference counter, finally releasing both
|
||||
* references.
|
||||
* - [4.6.5] Releasing the first reference to the dynamic pipe must not
|
||||
* trigger an assertion.
|
||||
* - [4.6.6] Retrieving the dynamic pipe by name again, must not exist.
|
||||
* .
|
||||
*/
|
||||
|
||||
static void oslib_test_004_006_teardown(void) {
|
||||
dyn_pipe_t *dpp;
|
||||
|
||||
dpp = chFactoryFindPipe("mypipe");
|
||||
if (dpp != NULL) {
|
||||
while (dpp->element.refs > 0U) {
|
||||
chFactoryReleasePipe(dpp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void oslib_test_004_006_execute(void) {
|
||||
dyn_pipe_t *dpp;
|
||||
|
||||
/* [4.6.1] Retrieving a dynamic pipe by name, must not exist.*/
|
||||
test_set_step(1);
|
||||
{
|
||||
dpp = chFactoryFindPipe("mypipe");
|
||||
test_assert(dpp == NULL, "found");
|
||||
}
|
||||
|
||||
/* [4.6.2] Creating a dynamic pipe it must not exists, must
|
||||
succeed.*/
|
||||
test_set_step(2);
|
||||
{
|
||||
dpp = chFactoryCreatePipe("mypipe", 16U);
|
||||
test_assert(dpp != NULL, "cannot create");
|
||||
}
|
||||
|
||||
/* [4.6.3] Creating a dynamic pipe with the same name, must fail.*/
|
||||
test_set_step(3);
|
||||
{
|
||||
dyn_pipe_t *dpp1;
|
||||
|
||||
dpp1 = chFactoryCreatePipe("mypipe", 16U);
|
||||
test_assert(dpp1 == NULL, "can create");
|
||||
}
|
||||
|
||||
/* [4.6.4] Retrieving the dynamic pipe by name, must exist, then
|
||||
increasing the reference counter, finally releasing both
|
||||
references.*/
|
||||
test_set_step(4);
|
||||
{
|
||||
dyn_pipe_t *dpp1, *dpp2;
|
||||
|
||||
dpp1 = chFactoryFindPipe("mypipe");
|
||||
test_assert(dpp1 != NULL, "not found");
|
||||
test_assert(dpp == dpp1, "object reference mismatch");
|
||||
test_assert(dpp1->element.refs == 2, "object reference mismatch");
|
||||
|
||||
dpp2 = (dyn_pipe_t *)chFactoryDuplicateReference(&dpp1->element);
|
||||
test_assert(dpp1 == dpp2, "object reference mismatch");
|
||||
test_assert(dpp2->element.refs == 3, "object reference mismatch");
|
||||
|
||||
chFactoryReleasePipe(dpp2);
|
||||
test_assert(dpp1->element.refs == 2, "references mismatch");
|
||||
|
||||
chFactoryReleasePipe(dpp1);
|
||||
test_assert(dpp->element.refs == 1, "references mismatch");
|
||||
}
|
||||
|
||||
/* [4.6.5] Releasing the first reference to the dynamic pipe must not
|
||||
trigger an assertion.*/
|
||||
test_set_step(5);
|
||||
{
|
||||
chFactoryReleasePipe(dpp);
|
||||
}
|
||||
|
||||
/* [4.6.6] Retrieving the dynamic pipe by name again, must not
|
||||
exist.*/
|
||||
test_set_step(6);
|
||||
{
|
||||
dpp = chFactoryFindPipe("mypipe");
|
||||
test_assert(dpp == NULL, "found");
|
||||
}
|
||||
}
|
||||
|
||||
static const testcase_t oslib_test_004_006 = {
|
||||
"Dynamic Pipes Factory",
|
||||
NULL,
|
||||
oslib_test_004_006_teardown,
|
||||
oslib_test_004_006_execute
|
||||
};
|
||||
#endif /* CH_CFG_FACTORY_PIPES == TRUE */
|
||||
|
||||
/****************************************************************************
|
||||
* Exported data.
|
||||
****************************************************************************/
|
||||
|
@ -651,6 +763,9 @@ const testcase_t * const oslib_test_sequence_004_array[] = {
|
|||
#endif
|
||||
#if (CH_CFG_FACTORY_OBJ_FIFOS == TRUE) || defined(__DOXYGEN__)
|
||||
&oslib_test_004_005,
|
||||
#endif
|
||||
#if (CH_CFG_FACTORY_PIPES == TRUE) || defined(__DOXYGEN__)
|
||||
&oslib_test_004_006,
|
||||
#endif
|
||||
NULL
|
||||
};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
|
||||
ChibiOS - Copyright (C) 2006..2017 Giovanni Di Sirio
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
|
Loading…
Reference in New Issue