aboutsummaryrefslogtreecommitdiffstats
path: root/test/nil
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2016-03-19 11:22:24 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2016-03-19 11:22:24 +0000
commit590c27ea84385d15797224785e80d2a003df8997 (patch)
tree89e4ac27b2d8a6915a0d1bb7786c83f48cb7e0ab /test/nil
parentd29098e7f64c4d15b5414447937bfd09f142f758 (diff)
downloadChibiOS-590c27ea84385d15797224785e80d2a003df8997.tar.gz
ChibiOS-590c27ea84385d15797224785e80d2a003df8997.tar.bz2
ChibiOS-590c27ea84385d15797224785e80d2a003df8997.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9138 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'test/nil')
-rw-r--r--test/nil/configuration.xml66
-rw-r--r--test/nil/patch.xml25
-rw-r--r--test/nil/source/test/test_root.c30
-rw-r--r--test/nil/source/test/test_root.h29
-rw-r--r--test/nil/source/test/test_sequence_001.c28
-rw-r--r--test/nil/source/test/test_sequence_001.h28
-rw-r--r--test/nil/source/test/test_sequence_002.c28
-rw-r--r--test/nil/source/test/test_sequence_002.h28
-rw-r--r--test/nil/source/test/test_sequence_003.c28
-rw-r--r--test/nil/source/test/test_sequence_003.h28
-rw-r--r--test/nil/source/test/test_sequence_004.c28
-rw-r--r--test/nil/source/test/test_sequence_004.h28
-rw-r--r--test/nil/source/test/test_sequence_005.c58
-rw-r--r--test/nil/source/test/test_sequence_005.h28
-rw-r--r--test/nil/source/test/test_sequence_006.c90
-rw-r--r--test/nil/source/test/test_sequence_006.h17
-rw-r--r--test/nil/test.mk3
17 files changed, 372 insertions, 198 deletions
diff --git a/test/nil/configuration.xml b/test/nil/configuration.xml
index 118c70153..2b9fe9cad 100644
--- a/test/nil/configuration.xml
+++ b/test/nil/configuration.xml
@@ -9,6 +9,23 @@
<instance locked="false" id="org.chibios.spc5.components.platform.generic" />
<instance locked="false" id="org.chibios.spc5.components.chibios_unitary_tests_engine">
<description>
+ <copyright>
+ <value><![CDATA[/*
+ ChibiOS - Copyright (C) 2006..2016 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.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/]]></value>
+ </copyright>
<introduction>
<value>Test suite for ChibiOS/NIL. The purpose of this suite is to perform unit tests on the NIL modules and to converge to 100% code coverage through successive improvements.</value>
</introduction>
@@ -930,8 +947,8 @@ test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");]]></value>
<value><![CDATA[#define MEMORY_POOL_SIZE 4
static uint32_t objects[MEMORY_POOL_SIZE];
-static MEMORYPOOL_DECL(mp1, sizeof (uint32_t), NULL);
-static GUARDEDMEMORYPOOL_DECL(gmp1, sizeof (uint32_t));
+static MEMORYPOOL_DECL(mp1, sizeof (uint32_t), NULL);
+static GUARDEDMEMORYPOOL_DECL(gmp1, sizeof (uint32_t));
static void *null_provider(size_t size, unsigned align) {
@@ -950,7 +967,7 @@ static void *null_provider(size_t size, unsigned align) {
<value>The memory pool functionality is tested by loading and empting it, all conditions are tested.</value>
</description>
<condition>
- <value />
+ <value>CH_CFG_USE_MEMPOOLS</value>
</condition>
<various_code>
<setup_code>
@@ -1055,7 +1072,7 @@ test_assert(chPoolAlloc(&mp1) == NULL, "provider returned memory");]]></value>
<value>The memory pool functionality is tested by loading and empting it, all conditions are tested.</value>
</description>
<condition>
- <value />
+ <value>(CH_CFG_USE_MEMPOOLS &amp;&amp; CH_CFG_USE_SEMAPHORES)</value>
</condition>
<various_code>
<setup_code>
@@ -1148,7 +1165,7 @@ test_assert(chPoolAlloc(&mp1) == NULL, "provider returned memory");]]></value>
<value>The timeout features for the Guarded Memory Pools is tested.</value>
</description>
<condition>
- <value />
+ <value>(CH_CFG_USE_MEMPOOLS &amp;&amp; CH_CFG_USE_SEMAPHORES)</value>
</condition>
<various_code>
<setup_code>
@@ -1177,6 +1194,45 @@ test_assert(chPoolAlloc(&mp1) == NULL, "provider returned memory");]]></value>
</case>
</cases>
</sequence>
+ <sequence>
+ <type index="0">
+ <value>Internal Tests</value>
+ </type>
+ <brief>
+ <value>Memory Heaps.</value>
+ </brief>
+ <description>
+ <value>This sequence tests the ChibiOS/NIL functionalities related to memory heaps.</value>
+ </description>
+ <shared_code>
+ <value />
+ </shared_code>
+ <cases>
+ <case>
+ <brief>
+ <value>Allocation and fragmentation.</value>
+ </brief>
+ <description>
+ <value>Series of allocations/deallocations are performed in carefully designed sequences in order to stimulate all the possible code paths inside the allocator. The test expects to find the heap back to the initial status after each sequence.</value>
+ </description>
+ <condition>
+ <value>CH_CFG_USE_HEAP</value>
+ </condition>
+ <various_code>
+ <setup_code>
+ <value><![CDATA[chHeapObjectInit(&test_heap, test.buffer, sizeof(union test_buffers));]]></value>
+ </setup_code>
+ <teardown_code>
+ <value />
+ </teardown_code>
+ <local_variables>
+ <value />
+ </local_variables>
+ </various_code>
+ <steps />
+ </case>
+ </cases>
+ </sequence>
</sequences>
</instance>
</instances>
diff --git a/test/nil/patch.xml b/test/nil/patch.xml
index c617cd8f6..879b2ed23 100644
--- a/test/nil/patch.xml
+++ b/test/nil/patch.xml
@@ -1,28 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<SPC5-Patch version="1.0.0">
<!--It is your patch repository, do not break your XML File.-->
- <files>
- <file componentId="org.chibios.spc5.components.chibios_unitary_tests_engine" version="1.0.0.qualifier" path="component/lib/include/ch_test.h" user="false">
- <diff><![CDATA[--- components/chibios_unit_tests_engine_component/lib/include/ch_test.h
-+++ components/chibios_unit_tests_engine_component/lib/include/ch_test.h
-@@ -1,5 +1,5 @@
- /*
-- ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
-+ ChibiOS - Copyright (C) 2006..2016 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.]]></diff>
- </file>
- <file componentId="org.chibios.spc5.components.chibios_unitary_tests_engine" version="1.0.0.qualifier" path="component/lib/src/ch_test.c" user="false">
- <diff><![CDATA[--- components/chibios_unit_tests_engine_component/lib/src/ch_test.c
-+++ components/chibios_unit_tests_engine_component/lib/src/ch_test.c
-@@ -1,5 +1,5 @@
- /*
-- ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
-+ ChibiOS - Copyright (C) 2006..2016 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.]]></diff>
- </file>
- </files>
+ <files />
</SPC5-Patch>
diff --git a/test/nil/source/test/test_root.c b/test/nil/source/test/test_root.c
index 1516898c5..72a98172e 100644
--- a/test/nil/source/test/test_root.c
+++ b/test/nil/source/test/test_root.c
@@ -1,17 +1,17 @@
-/*
- ChibiOS - Copyright (C) 2006..2016 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.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+/*
+ ChibiOS - Copyright (C) 2006..2016 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.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
*/
/**
@@ -26,6 +26,7 @@
* - @subpage test_sequence_003
* - @subpage test_sequence_004
* - @subpage test_sequence_005
+ * - @subpage test_sequence_006
* .
*/
@@ -54,6 +55,7 @@ const testcase_t * const *test_suite[] = {
test_sequence_003,
test_sequence_004,
test_sequence_005,
+ test_sequence_006,
NULL
};
diff --git a/test/nil/source/test/test_root.h b/test/nil/source/test/test_root.h
index ee0c42d0b..242091b3d 100644
--- a/test/nil/source/test/test_root.h
+++ b/test/nil/source/test/test_root.h
@@ -1,17 +1,17 @@
-/*
- ChibiOS - Copyright (C) 2006..2015 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.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+/*
+ ChibiOS - Copyright (C) 2006..2016 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.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
*/
/**
@@ -30,6 +30,7 @@
#include "test_sequence_003.h"
#include "test_sequence_004.h"
#include "test_sequence_005.h"
+#include "test_sequence_006.h"
/*===========================================================================*/
/* External declarations. */
diff --git a/test/nil/source/test/test_sequence_001.c b/test/nil/source/test/test_sequence_001.c
index 4be1c4785..8073ac10f 100644
--- a/test/nil/source/test/test_sequence_001.c
+++ b/test/nil/source/test/test_sequence_001.c
@@ -1,17 +1,17 @@
-/*
- ChibiOS - Copyright (C) 2006..2015 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.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+/*
+ ChibiOS - Copyright (C) 2006..2016 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.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
*/
#include "hal.h"
diff --git a/test/nil/source/test/test_sequence_001.h b/test/nil/source/test/test_sequence_001.h
index 83ef96518..7a71cfc00 100644
--- a/test/nil/source/test/test_sequence_001.h
+++ b/test/nil/source/test/test_sequence_001.h
@@ -1,17 +1,17 @@
-/*
- ChibiOS - Copyright (C) 2006..2015 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.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+/*
+ ChibiOS - Copyright (C) 2006..2016 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.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
*/
extern const testcase_t * const test_sequence_001[];
diff --git a/test/nil/source/test/test_sequence_002.c b/test/nil/source/test/test_sequence_002.c
index bd626683b..0656d04f0 100644
--- a/test/nil/source/test/test_sequence_002.c
+++ b/test/nil/source/test/test_sequence_002.c
@@ -1,17 +1,17 @@
-/*
- ChibiOS - Copyright (C) 2006..2015 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.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+/*
+ ChibiOS - Copyright (C) 2006..2016 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.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
*/
#include "hal.h"
diff --git a/test/nil/source/test/test_sequence_002.h b/test/nil/source/test/test_sequence_002.h
index bd7b6c764..fdf3a8148 100644
--- a/test/nil/source/test/test_sequence_002.h
+++ b/test/nil/source/test/test_sequence_002.h
@@ -1,17 +1,17 @@
-/*
- ChibiOS - Copyright (C) 2006..2015 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.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+/*
+ ChibiOS - Copyright (C) 2006..2016 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.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
*/
extern const testcase_t * const test_sequence_002[];
diff --git a/test/nil/source/test/test_sequence_003.c b/test/nil/source/test/test_sequence_003.c
index b58bd3b69..b527dec06 100644
--- a/test/nil/source/test/test_sequence_003.c
+++ b/test/nil/source/test/test_sequence_003.c
@@ -1,17 +1,17 @@
-/*
- ChibiOS - Copyright (C) 2006..2015 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.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+/*
+ ChibiOS - Copyright (C) 2006..2016 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.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
*/
#include "hal.h"
diff --git a/test/nil/source/test/test_sequence_003.h b/test/nil/source/test/test_sequence_003.h
index 587acc5de..71ce5cd65 100644
--- a/test/nil/source/test/test_sequence_003.h
+++ b/test/nil/source/test/test_sequence_003.h
@@ -1,17 +1,17 @@
-/*
- ChibiOS - Copyright (C) 2006..2015 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.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+/*
+ ChibiOS - Copyright (C) 2006..2016 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.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
*/
extern const testcase_t * const test_sequence_003[];
diff --git a/test/nil/source/test/test_sequence_004.c b/test/nil/source/test/test_sequence_004.c
index 6cf37b289..2035849bd 100644
--- a/test/nil/source/test/test_sequence_004.c
+++ b/test/nil/source/test/test_sequence_004.c
@@ -1,17 +1,17 @@
-/*
- ChibiOS - Copyright (C) 2006..2015 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.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+/*
+ ChibiOS - Copyright (C) 2006..2016 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.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
*/
#include "hal.h"
diff --git a/test/nil/source/test/test_sequence_004.h b/test/nil/source/test/test_sequence_004.h
index 3ecaa4259..caa3a601c 100644
--- a/test/nil/source/test/test_sequence_004.h
+++ b/test/nil/source/test/test_sequence_004.h
@@ -1,17 +1,17 @@
-/*
- ChibiOS - Copyright (C) 2006..2015 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.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+/*
+ ChibiOS - Copyright (C) 2006..2016 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.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
*/
extern const testcase_t * const test_sequence_004[];
diff --git a/test/nil/source/test/test_sequence_005.c b/test/nil/source/test/test_sequence_005.c
index fa3fc8eab..e75a36252 100644
--- a/test/nil/source/test/test_sequence_005.c
+++ b/test/nil/source/test/test_sequence_005.c
@@ -1,17 +1,17 @@
-/*
- ChibiOS - Copyright (C) 2006..2015 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.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+/*
+ ChibiOS - Copyright (C) 2006..2016 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.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
*/
#include "hal.h"
@@ -56,6 +56,7 @@ static void *null_provider(size_t size, unsigned align) {
* Test cases.
****************************************************************************/
+#if CH_CFG_USE_MEMPOOLS || defined(__DOXYGEN__)
/**
* @page test_005_001 Loading and empting a memory pool
*
@@ -63,6 +64,12 @@ static void *null_provider(size_t size, unsigned align) {
* The memory pool functionality is tested by loading and empting it,
* all conditions are tested.
*
+ * <h2>Conditions</h2>
+ * This test is only executed if the following preprocessor condition
+ * evaluates to true:
+ * - CH_CFG_USE_MEMPOOLS
+ * .
+ *
* <h2>Test Steps</h2>
* - Adding the objects to the pool using chPoolLoadArray().
* - Emptying the pool using chPoolAlloc().
@@ -136,7 +143,9 @@ static const testcase_t test_005_001 = {
NULL,
test_005_001_execute
};
+#endif /* CH_CFG_USE_MEMPOOLS */
+#if (CH_CFG_USE_MEMPOOLS && CH_CFG_USE_SEMAPHORES) || defined(__DOXYGEN__)
/**
* @page test_005_002 Loading and empting a guarded memory pool without waiting
*
@@ -144,6 +153,12 @@ static const testcase_t test_005_001 = {
* The memory pool functionality is tested by loading and empting it,
* all conditions are tested.
*
+ * <h2>Conditions</h2>
+ * This test is only executed if the following preprocessor condition
+ * evaluates to true:
+ * - (CH_CFG_USE_MEMPOOLS && CH_CFG_USE_SEMAPHORES)
+ * .
+ *
* <h2>Test Steps</h2>
* - Adding the objects to the pool using chGuardedPoolLoadArray().
* - Emptying the pool using chGuardedPoolAllocTimeout().
@@ -207,13 +222,21 @@ static const testcase_t test_005_002 = {
NULL,
test_005_002_execute
};
+#endif /* (CH_CFG_USE_MEMPOOLS && CH_CFG_USE_SEMAPHORES) */
+#if (CH_CFG_USE_MEMPOOLS && CH_CFG_USE_SEMAPHORES) || defined(__DOXYGEN__)
/**
* @page test_005_003 Guarded Memory Pools timeout
*
* <h2>Description</h2>
* The timeout features for the Guarded Memory Pools is tested.
*
+ * <h2>Conditions</h2>
+ * This test is only executed if the following preprocessor condition
+ * evaluates to true:
+ * - (CH_CFG_USE_MEMPOOLS && CH_CFG_USE_SEMAPHORES)
+ * .
+ *
* <h2>Test Steps</h2>
* - Trying to allocate with 100mS timeout, must fail because the pool
* is empty.
@@ -240,6 +263,7 @@ static const testcase_t test_005_003 = {
NULL,
test_005_003_execute
};
+#endif /* (CH_CFG_USE_MEMPOOLS && CH_CFG_USE_SEMAPHORES) */
/****************************************************************************
* Exported data.
@@ -249,8 +273,14 @@ static const testcase_t test_005_003 = {
* @brief Memory Pools.
*/
const testcase_t * const test_sequence_005[] = {
+#if CH_CFG_USE_MEMPOOLS || defined(__DOXYGEN__)
&test_005_001,
+#endif
+#if (CH_CFG_USE_MEMPOOLS && CH_CFG_USE_SEMAPHORES) || defined(__DOXYGEN__)
&test_005_002,
+#endif
+#if (CH_CFG_USE_MEMPOOLS && CH_CFG_USE_SEMAPHORES) || defined(__DOXYGEN__)
&test_005_003,
+#endif
NULL
};
diff --git a/test/nil/source/test/test_sequence_005.h b/test/nil/source/test/test_sequence_005.h
index 4cb8e1db0..b65d62ace 100644
--- a/test/nil/source/test/test_sequence_005.h
+++ b/test/nil/source/test/test_sequence_005.h
@@ -1,17 +1,17 @@
-/*
- ChibiOS - Copyright (C) 2006..2015 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.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+/*
+ ChibiOS - Copyright (C) 2006..2016 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.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
*/
extern const testcase_t * const test_sequence_005[];
diff --git a/test/nil/source/test/test_sequence_006.c b/test/nil/source/test/test_sequence_006.c
new file mode 100644
index 000000000..fe3e2aaf6
--- /dev/null
+++ b/test/nil/source/test/test_sequence_006.c
@@ -0,0 +1,90 @@
+/*
+ ChibiOS - Copyright (C) 2006..2016 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.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+#include "hal.h"
+#include "ch_test.h"
+#include "test_root.h"
+
+/**
+ * @page test_sequence_006 Memory Heaps
+ *
+ * File: @ref test_sequence_006.c
+ *
+ * <h2>Description</h2>
+ * This sequence tests the ChibiOS/NIL functionalities related to
+ * memory heaps.
+ *
+ * <h2>Test Cases</h2>
+ * - @subpage test_006_001
+ * .
+ */
+
+/****************************************************************************
+ * Shared code.
+ ****************************************************************************/
+
+
+/****************************************************************************
+ * Test cases.
+ ****************************************************************************/
+
+#if CH_CFG_USE_HEAP || defined(__DOXYGEN__)
+/**
+ * @page test_006_001 Allocation and fragmentation
+ *
+ * <h2>Description</h2>
+ * Series of allocations/deallocations are performed in carefully
+ * designed sequences in order to stimulate all the possible code paths
+ * inside the allocator. The test expects to find the heap back to the
+ * initial status after each sequence.
+ *
+ * <h2>Conditions</h2>
+ * This test is only executed if the following preprocessor condition
+ * evaluates to true:
+ * - CH_CFG_USE_HEAP
+ * .
+ *
+ * <h2>Test Steps</h2>
+ */
+
+static void test_006_001_setup(void) {
+ chHeapObjectInit(&test_heap, test.buffer, sizeof(union test_buffers));
+}
+
+static void test_006_001_execute(void) {
+}
+
+static const testcase_t test_006_001 = {
+ "Allocation and fragmentation",
+ test_006_001_setup,
+ NULL,
+ test_006_001_execute
+};
+#endif /* CH_CFG_USE_HEAP */
+
+/****************************************************************************
+ * Exported data.
+ ****************************************************************************/
+
+/**
+ * @brief Memory Heaps.
+ */
+const testcase_t * const test_sequence_006[] = {
+#if CH_CFG_USE_HEAP || defined(__DOXYGEN__)
+ &test_006_001,
+#endif
+ NULL
+};
diff --git a/test/nil/source/test/test_sequence_006.h b/test/nil/source/test/test_sequence_006.h
new file mode 100644
index 000000000..026d07577
--- /dev/null
+++ b/test/nil/source/test/test_sequence_006.h
@@ -0,0 +1,17 @@
+/*
+ ChibiOS - Copyright (C) 2006..2016 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.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+extern const testcase_t * const test_sequence_006[];
diff --git a/test/nil/test.mk b/test/nil/test.mk
index 04890b633..92c30be25 100644
--- a/test/nil/test.mk
+++ b/test/nil/test.mk
@@ -5,7 +5,8 @@ TESTSRC = ${CHIBIOS}/test/lib/ch_test.c \
${CHIBIOS}/test/nil/source/test/test_sequence_002.c \
${CHIBIOS}/test/nil/source/test/test_sequence_003.c \
${CHIBIOS}/test/nil/source/test/test_sequence_004.c \
- ${CHIBIOS}/test/nil/source/test/test_sequence_005.c
+ ${CHIBIOS}/test/nil/source/test/test_sequence_005.c \
+ ${CHIBIOS}/test/nil/source/test/test_sequence_006.c
# Required include directories
TESTINC = ${CHIBIOS}/test/lib \