diff options
author | Giovanni Di Sirio <gdisirio@gmail.com> | 2017-10-16 15:09:11 +0000 |
---|---|---|
committer | Giovanni Di Sirio <gdisirio@gmail.com> | 2017-10-16 15:09:11 +0000 |
commit | eb6b6685f09fbc4822492a1db9eaa367f46c657c (patch) | |
tree | e6b73b5865ff9559fd766a38054cbffc2e9466a3 /test/nil | |
parent | 6bbfd2126f0cd20c733b78682d322250d8223d93 (diff) | |
download | ChibiOS-eb6b6685f09fbc4822492a1db9eaa367f46c657c.tar.gz ChibiOS-eb6b6685f09fbc4822492a1db9eaa367f46c657c.tar.bz2 ChibiOS-eb6b6685f09fbc4822492a1db9eaa367f46c657c.zip |
Enhancements in the test engine, not finished.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10835 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'test/nil')
-rw-r--r-- | test/nil/.cproject | 2 | ||||
-rw-r--r-- | test/nil/configuration.xml | 749 |
2 files changed, 377 insertions, 374 deletions
diff --git a/test/nil/.cproject b/test/nil/.cproject index a3d27ffcd..d3500207c 100644 --- a/test/nil/.cproject +++ b/test/nil/.cproject @@ -36,8 +36,8 @@ </toolChain>
</folderInfo>
<sourceEntries>
- <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="components"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="source"/>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="components"/>
</sourceEntries>
</configuration>
</storageModule>
diff --git a/test/nil/configuration.xml b/test/nil/configuration.xml index c62e00a37..c808728ae 100644 --- a/test/nil/configuration.xml +++ b/test/nil/configuration.xml @@ -10,20 +10,20 @@ <instance locked="false" id="org.chibios.spc5.components.portable.chibios_unitary_tests_engine">
<description>
<copyright>
- <value><![CDATA[/*
- 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.
- 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><![CDATA[/* + 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. + 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>
@@ -31,69 +31,72 @@ </introduction>
</description>
<global_data_and_code>
+ <code_prefix>
+ <value>nil_</value>
+ </code_prefix>
<global_definitions>
- <value><![CDATA[#define TEST_SUITE_NAME "ChibiOS/NIL Test Suite"
-
-#define TEST_REPORT_HOOK_HEADER test_print_port_info();
-
-extern semaphore_t gsem1, gsem2;
-extern thread_reference_t gtr1;
-extern THD_WORKING_AREA(wa_test_support, 128);
-
-void test_print_port_info(void);
+ <value><![CDATA[#define TEST_SUITE_NAME "ChibiOS/NIL Test Suite" + +#define TEST_REPORT_HOOK_HEADER test_print_port_info(); + +extern semaphore_t gsem1, gsem2; +extern thread_reference_t gtr1; +extern THD_WORKING_AREA(wa_test_support, 128); + +void test_print_port_info(void); THD_FUNCTION(test_support, arg);]]></value>
</global_definitions>
<global_code>
- <value><![CDATA[void test_print_port_info(void) {
-
-#ifdef PORT_COMPILER_NAME
- test_print("*** Compiler: ");
- test_println(PORT_COMPILER_NAME);
-#endif
- test_print("*** Architecture: ");
- test_println(PORT_ARCHITECTURE_NAME);
-#ifdef PORT_CORE_VARIANT_NAME
- test_print("*** Core Variant: ");
- test_println(PORT_CORE_VARIANT_NAME);
-#endif
-#ifdef PORT_INFO
- test_print("*** Port Info: ");
- test_println(PORT_INFO);
-#endif
-}
-
-semaphore_t gsem1, gsem2;
-thread_reference_t gtr1;
-
-/*
- * Support thread.
- */
-THD_WORKING_AREA(wa_test_support, 128);
-THD_FUNCTION(test_support, arg) {
-#if CH_CFG_USE_EVENTS == TRUE
- thread_t *tp = (thread_t *)arg;
-#else
- (void)arg;
-#endif
-
- /* Initializing global resources.*/
- chSemObjectInit(&gsem1, 0);
- chSemObjectInit(&gsem2, 0);
-
- while (true) {
- chSysLock();
- if (chSemGetCounterI(&gsem1) < 0)
- chSemSignalI(&gsem1);
- chSemResetI(&gsem2, 0);
- chThdResumeI(>r1, MSG_OK);
-#if CH_CFG_USE_EVENTS == TRUE
- chEvtSignalI(tp, 0x55);
-#endif
- chSchRescheduleS();
- chSysUnlock();
-
- chThdSleepMilliseconds(250);
- }
+ <value><![CDATA[void test_print_port_info(void) { + +#ifdef PORT_COMPILER_NAME + test_print("*** Compiler: "); + test_println(PORT_COMPILER_NAME); +#endif + test_print("*** Architecture: "); + test_println(PORT_ARCHITECTURE_NAME); +#ifdef PORT_CORE_VARIANT_NAME + test_print("*** Core Variant: "); + test_println(PORT_CORE_VARIANT_NAME); +#endif +#ifdef PORT_INFO + test_print("*** Port Info: "); + test_println(PORT_INFO); +#endif +} + +semaphore_t gsem1, gsem2; +thread_reference_t gtr1; + +/* + * Support thread. + */ +THD_WORKING_AREA(wa_test_support, 128); +THD_FUNCTION(test_support, arg) { +#if CH_CFG_USE_EVENTS == TRUE + thread_t *tp = (thread_t *)arg; +#else + (void)arg; +#endif + + /* Initializing global resources.*/ + chSemObjectInit(&gsem1, 0); + chSemObjectInit(&gsem2, 0); + + while (true) { + chSysLock(); + if (chSemGetCounterI(&gsem1) < 0) + chSemSignalI(&gsem1); + chSemResetI(&gsem2, 0); + chThdResumeI(>r1, MSG_OK); +#if CH_CFG_USE_EVENTS == TRUE + chEvtSignalI(tp, 0x55); +#endif + chSchRescheduleS(); + chSysUnlock(); + + chThdSleepMilliseconds(250); + } }]]></value>
</global_code>
</global_data_and_code>
@@ -145,20 +148,20 @@ THD_FUNCTION(test_support, arg) { <value />
</tags>
<code>
- <value><![CDATA[test_println("--- Product: ChibiOS/NIL");
-test_print("--- Stable Flag: ");
-test_printn(CH_KERNEL_STABLE);
-test_println("");
-test_print("--- Version String: ");
-test_println(CH_KERNEL_VERSION);
-test_print("--- Major Number: ");
-test_printn(CH_KERNEL_MAJOR);
-test_println("");
-test_print("--- Minor Number: ");
-test_printn(CH_KERNEL_MINOR);
-test_println("");
-test_print("--- Patch Number: ");
-test_printn(CH_KERNEL_PATCH);
+ <value><![CDATA[test_println("--- Product: ChibiOS/NIL"); +test_print("--- Stable Flag: "); +test_printn(CH_KERNEL_STABLE); +test_println(""); +test_print("--- Version String: "); +test_println(CH_KERNEL_VERSION); +test_print("--- Major Number: "); +test_printn(CH_KERNEL_MAJOR); +test_println(""); +test_print("--- Minor Number: "); +test_printn(CH_KERNEL_MINOR); +test_println(""); +test_print("--- Patch Number: "); +test_printn(CH_KERNEL_PATCH); test_println("");]]></value>
</code>
</step>
@@ -194,53 +197,53 @@ test_println("");]]></value> <value />
</tags>
<code>
- <value><![CDATA[test_print("--- CH_CFG_NUM_THREADS: ");
-test_printn(CH_CFG_NUM_THREADS);
-test_println("");
-test_print("--- CH_CFG_ST_RESOLUTION: ");
-test_printn(CH_CFG_ST_RESOLUTION);
-test_println("");
-test_print("--- CH_CFG_ST_FREQUENCY: ");
-test_printn(CH_CFG_ST_FREQUENCY);
-test_println("");
-test_print("--- CH_CFG_ST_TIMEDELTA: ");
-test_printn(CH_CFG_ST_TIMEDELTA);
-test_println("");
-test_print("--- CH_CFG_USE_SEMAPHORES: ");
-test_printn(CH_CFG_USE_SEMAPHORES);
-test_println("");
-test_print("--- CH_CFG_USE_MUTEXES: ");
-test_printn(CH_CFG_USE_MUTEXES);
-test_println("");
-test_print("--- CH_CFG_USE_EVENTS: ");
-test_printn(CH_CFG_USE_EVENTS);
-test_println("");
-test_print("--- CH_CFG_USE_MAILBOXES: ");
-test_printn(CH_CFG_USE_MAILBOXES);
-test_println("");
-test_print("--- CH_CFG_USE_MEMCORE: ");
-test_printn(CH_CFG_USE_MEMCORE);
-test_println("");
-test_print("--- CH_CFG_USE_HEAP: ");
-test_printn(CH_CFG_USE_HEAP);
-test_println("");
-test_print("--- CH_CFG_USE_MEMPOOLS: ");
-test_printn(CH_CFG_USE_MEMPOOLS);
-test_println("");
-test_print("--- CH_DBG_STATISTICS: ");
-test_printn(CH_DBG_STATISTICS);
-test_println("");
-test_print("--- CH_DBG_SYSTEM_STATE_CHECK: ");
-test_printn(CH_DBG_SYSTEM_STATE_CHECK);
-test_println("");
-test_print("--- CH_DBG_ENABLE_CHECKS: ");
-test_printn(CH_DBG_ENABLE_CHECKS);
-test_println("");
-test_print("--- CH_DBG_ENABLE_ASSERTS: ");
-test_printn(CH_DBG_ENABLE_ASSERTS);
-test_println("");
-test_print("--- CH_DBG_ENABLE_STACK_CHECK: ");
-test_printn(CH_DBG_ENABLE_STACK_CHECK);
+ <value><![CDATA[test_print("--- CH_CFG_NUM_THREADS: "); +test_printn(CH_CFG_NUM_THREADS); +test_println(""); +test_print("--- CH_CFG_ST_RESOLUTION: "); +test_printn(CH_CFG_ST_RESOLUTION); +test_println(""); +test_print("--- CH_CFG_ST_FREQUENCY: "); +test_printn(CH_CFG_ST_FREQUENCY); +test_println(""); +test_print("--- CH_CFG_ST_TIMEDELTA: "); +test_printn(CH_CFG_ST_TIMEDELTA); +test_println(""); +test_print("--- CH_CFG_USE_SEMAPHORES: "); +test_printn(CH_CFG_USE_SEMAPHORES); +test_println(""); +test_print("--- CH_CFG_USE_MUTEXES: "); +test_printn(CH_CFG_USE_MUTEXES); +test_println(""); +test_print("--- CH_CFG_USE_EVENTS: "); +test_printn(CH_CFG_USE_EVENTS); +test_println(""); +test_print("--- CH_CFG_USE_MAILBOXES: "); +test_printn(CH_CFG_USE_MAILBOXES); +test_println(""); +test_print("--- CH_CFG_USE_MEMCORE: "); +test_printn(CH_CFG_USE_MEMCORE); +test_println(""); +test_print("--- CH_CFG_USE_HEAP: "); +test_printn(CH_CFG_USE_HEAP); +test_println(""); +test_print("--- CH_CFG_USE_MEMPOOLS: "); +test_printn(CH_CFG_USE_MEMPOOLS); +test_println(""); +test_print("--- CH_DBG_STATISTICS: "); +test_printn(CH_DBG_STATISTICS); +test_println(""); +test_print("--- CH_DBG_SYSTEM_STATE_CHECK: "); +test_printn(CH_DBG_SYSTEM_STATE_CHECK); +test_println(""); +test_print("--- CH_DBG_ENABLE_CHECKS: "); +test_printn(CH_DBG_ENABLE_CHECKS); +test_println(""); +test_print("--- CH_DBG_ENABLE_ASSERTS: "); +test_printn(CH_DBG_ENABLE_ASSERTS); +test_println(""); +test_print("--- CH_DBG_ENABLE_STACK_CHECK: "); +test_printn(CH_DBG_ENABLE_STACK_CHECK); test_println("");]]></value>
</code>
</step>
@@ -295,8 +298,8 @@ test_println("");]]></value> <value />
</tags>
<code>
- <value><![CDATA[systime_t time = chVTGetSystemTimeX();
-while (time == chVTGetSystemTimeX()) {
+ <value><![CDATA[systime_t time = chVTGetSystemTimeX(); +while (time == chVTGetSystemTimeX()) { }]]></value>
</code>
</step>
@@ -332,10 +335,10 @@ while (time == chVTGetSystemTimeX()) { <value />
</tags>
<code>
- <value><![CDATA[time = chVTGetSystemTimeX();
-chThdSleep(100);
-test_assert_time_window(time + 100,
- time + 100 + 1,
+ <value><![CDATA[time = chVTGetSystemTimeX(); +chThdSleep(100); +test_assert_time_window(time + 100, + time + 100 + 1, "out of time window");]]></value>
</code>
</step>
@@ -347,10 +350,10 @@ test_assert_time_window(time + 100, <value />
</tags>
<code>
- <value><![CDATA[time = chVTGetSystemTimeX();
-chThdSleepMicroseconds(100000);
-test_assert_time_window(time + US2ST(100000),
- time + US2ST(100000) + 1,
+ <value><![CDATA[time = chVTGetSystemTimeX(); +chThdSleepMicroseconds(100000); +test_assert_time_window(time + US2ST(100000), + time + US2ST(100000) + 1, "out of time window");]]></value>
</code>
</step>
@@ -362,10 +365,10 @@ test_assert_time_window(time + US2ST(100000), <value />
</tags>
<code>
- <value><![CDATA[time = chVTGetSystemTimeX();
-chThdSleepMilliseconds(100);
-test_assert_time_window(time + MS2ST(100),
- time + MS2ST(100) + 1,
+ <value><![CDATA[time = chVTGetSystemTimeX(); +chThdSleepMilliseconds(100); +test_assert_time_window(time + MS2ST(100), + time + MS2ST(100) + 1, "out of time window");]]></value>
</code>
</step>
@@ -377,10 +380,10 @@ test_assert_time_window(time + MS2ST(100), <value />
</tags>
<code>
- <value><![CDATA[time = chVTGetSystemTimeX();
-chThdSleepSeconds(1);
-test_assert_time_window(time + S2ST(1),
- time + S2ST(1) + 1,
+ <value><![CDATA[time = chVTGetSystemTimeX(); +chThdSleepSeconds(1); +test_assert_time_window(time + S2ST(1), + time + S2ST(1) + 1, "out of time window");]]></value>
</code>
</step>
@@ -392,10 +395,10 @@ test_assert_time_window(time + S2ST(1), <value />
</tags>
<code>
- <value><![CDATA[time = chVTGetSystemTimeX();
-chThdSleepUntil(time + 100);
-test_assert_time_window(time + 100,
- time + 100 + 1,
+ <value><![CDATA[time = chVTGetSystemTimeX(); +chThdSleepUntil(time + 100); +test_assert_time_window(time + 100, + time + 100 + 1, "out of time window");]]></value>
</code>
</step>
@@ -417,8 +420,8 @@ test_assert_time_window(time + 100, <value>CH_CFG_USE_SEMAPHORES</value>
</condition>
<shared_code>
- <value><![CDATA[#include "ch.h"
-
+ <value><![CDATA[#include "ch.h" + static semaphore_t sem1;]]></value>
</shared_code>
<cases>
@@ -452,10 +455,10 @@ static semaphore_t sem1;]]></value> <value />
</tags>
<code>
- <value><![CDATA[msg_t msg;
-
-msg = chSemWait(&sem1);
-test_assert_lock(chSemGetCounterI(&sem1) == 0, "wrong counter value");
+ <value><![CDATA[msg_t msg; + +msg = chSemWait(&sem1); +test_assert_lock(chSemGetCounterI(&sem1) == 0, "wrong counter value"); test_assert(MSG_OK == msg, "wrong returned message");]]></value>
</code>
</step>
@@ -467,7 +470,7 @@ test_assert(MSG_OK == msg, "wrong returned message");]]></value> <value />
</tags>
<code>
- <value><![CDATA[chSemSignal(&sem1);
+ <value><![CDATA[chSemSignal(&sem1); test_assert_lock(chSemGetCounterI(&sem1) == 1, "wrong counter value");]]></value>
</code>
</step>
@@ -479,7 +482,7 @@ test_assert_lock(chSemGetCounterI(&sem1) == 1, "wrong counter value");]]></value <value />
</tags>
<code>
- <value><![CDATA[chSemReset(&sem1, 2);
+ <value><![CDATA[chSemReset(&sem1, 2); test_assert_lock(chSemGetCounterI(&sem1) == 2, "wrong counter value");]]></value>
</code>
</step>
@@ -515,10 +518,10 @@ test_assert_lock(chSemGetCounterI(&sem1) == 2, "wrong counter value");]]></value <value />
</tags>
<code>
- <value><![CDATA[msg_t msg;
-
-msg = chSemWait(&gsem1);
-test_assert_lock(chSemGetCounterI(&gsem1) == 0, "wrong counter value");
+ <value><![CDATA[msg_t msg; + +msg = chSemWait(&gsem1); +test_assert_lock(chSemGetCounterI(&gsem1) == 0, "wrong counter value"); test_assert(MSG_OK == msg, "wrong returned message");]]></value>
</code>
</step>
@@ -530,10 +533,10 @@ test_assert(MSG_OK == msg, "wrong returned message");]]></value> <value />
</tags>
<code>
- <value><![CDATA[msg_t msg;
-
-msg = chSemWait(&gsem2);
-test_assert_lock(chSemGetCounterI(&gsem2) == 0,"wrong counter value");
+ <value><![CDATA[msg_t msg; + +msg = chSemWait(&gsem2); +test_assert_lock(chSemGetCounterI(&gsem2) == 0,"wrong counter value"); test_assert(MSG_RESET == msg, "wrong returned message");]]></value>
</code>
</step>
@@ -557,7 +560,7 @@ test_assert(MSG_RESET == msg, "wrong returned message");]]></value> <value><![CDATA[chSemReset(&sem1, 0);]]></value>
</teardown_code>
<local_variables>
- <value><![CDATA[systime_t time;
+ <value><![CDATA[systime_t time; msg_t msg;]]></value>
</local_variables>
</various_code>
@@ -570,12 +573,12 @@ msg_t msg;]]></value> <value />
</tags>
<code>
- <value><![CDATA[time = chVTGetSystemTimeX();
-msg = chSemWaitTimeout(&sem1, MS2ST(1000));
-test_assert_time_window(time + MS2ST(1000),
- time + MS2ST(1000) + 1,
- "out of time window");
-test_assert_lock(chSemGetCounterI(&sem1) == 0, "wrong counter value");
+ <value><![CDATA[time = chVTGetSystemTimeX(); +msg = chSemWaitTimeout(&sem1, MS2ST(1000)); +test_assert_time_window(time + MS2ST(1000), + time + MS2ST(1000) + 1, + "out of time window"); +test_assert_lock(chSemGetCounterI(&sem1) == 0, "wrong counter value"); test_assert(MSG_TIMEOUT == msg, "wrong timeout message");]]></value>
</code>
</step>
@@ -587,12 +590,12 @@ test_assert(MSG_TIMEOUT == msg, "wrong timeout message");]]></value> <value />
</tags>
<code>
- <value><![CDATA[time = chVTGetSystemTimeX();
-msg = chSemWaitTimeout(&sem1, MS2ST(1000));
-test_assert_time_window(time + MS2ST(1000),
- time + MS2ST(1000) + 1,
- "out of time window");
-test_assert_lock(chSemGetCounterI(&sem1) == 0, "wrong counter value");
+ <value><![CDATA[time = chVTGetSystemTimeX(); +msg = chSemWaitTimeout(&sem1, MS2ST(1000)); +test_assert_time_window(time + MS2ST(1000), + time + MS2ST(1000) + 1, + "out of time window"); +test_assert_lock(chSemGetCounterI(&sem1) == 0, "wrong counter value"); test_assert(MSG_TIMEOUT == msg, "wrong timeout message");]]></value>
</code>
</step>
@@ -635,7 +638,7 @@ test_assert(MSG_TIMEOUT == msg, "wrong timeout message");]]></value> <value />
</teardown_code>
<local_variables>
- <value><![CDATA[systime_t time;
+ <value><![CDATA[systime_t time; msg_t msg;]]></value>
</local_variables>
</various_code>
@@ -648,10 +651,10 @@ msg_t msg;]]></value> <value />
</tags>
<code>
- <value><![CDATA[chSysLock();
-msg = chThdSuspendTimeoutS(>r1, TIME_INFINITE);
-chSysUnlock();
-test_assert(NULL == gtr1, "not NULL");
+ <value><![CDATA[chSysLock(); +msg = chThdSuspendTimeoutS(>r1, TIME_INFINITE); +chSysUnlock(); +test_assert(NULL == gtr1, "not NULL"); test_assert(MSG_OK == msg,"wrong returned message");]]></value>
</code>
</step>
@@ -663,14 +666,14 @@ test_assert(MSG_OK == msg,"wrong returned message");]]></value> <value />
</tags>
<code>
- <value><![CDATA[chSysLock();
-time = chVTGetSystemTimeX();
-msg = chThdSuspendTimeoutS(&tr1, MS2ST(1000));
-chSysUnlock();
-test_assert_time_window(time + MS2ST(1000),
- time + MS2ST(1000) + 1,
- "out of time window");
-test_assert(NULL == tr1, "not NULL");
+ <value><![CDATA[chSysLock(); +time = chVTGetSystemTimeX(); +msg = chThdSuspendTimeoutS(&tr1, MS2ST(1000)); +chSysUnlock(); +test_assert_time_window(time + MS2ST(1000), + time + MS2ST(1000) + 1, + "out of time window"); +test_assert(NULL == tr1, "not NULL"); test_assert(MSG_TIMEOUT == msg, "wrong returned message");]]></value>
</code>
</step>
@@ -694,7 +697,7 @@ test_assert(MSG_TIMEOUT == msg, "wrong returned message");]]></value> <value />
</teardown_code>
<local_variables>
- <value><![CDATA[systime_t time;
+ <value><![CDATA[systime_t time; eventmask_t events;]]></value>
</local_variables>
</various_code>
@@ -707,10 +710,10 @@ eventmask_t events;]]></value> <value />
</tags>
<code>
- <value><![CDATA[time = chVTGetSystemTimeX();
-chEvtSignal(chThdGetSelfX(), 0x55);
-events = chEvtWaitAnyTimeout(ALL_EVENTS, MS2ST(1000));
-test_assert((eventmask_t)0 != events, "timed out");
+ <value><![CDATA[time = chVTGetSystemTimeX(); +chEvtSignal(chThdGetSelfX(), 0x55); +events = chEvtWaitAnyTimeout(ALL_EVENTS, MS2ST(1000)); +test_assert((eventmask_t)0 != events, "timed out"); test_assert((eventmask_t)0x55 == events, "wrong events mask");]]></value>
</code>
</step>
@@ -722,10 +725,10 @@ test_assert((eventmask_t)0x55 == events, "wrong events mask");]]></value> <value />
</tags>
<code>
- <value><![CDATA[time = chVTGetSystemTimeX();
-chThdGetSelfX()->epmask = 0;
-events = chEvtWaitAnyTimeout(ALL_EVENTS, MS2ST(1000));
-test_assert((eventmask_t)0 != events, "timed out");
+ <value><![CDATA[time = chVTGetSystemTimeX(); +chThdGetSelfX()->epmask = 0; +events = chEvtWaitAnyTimeout(ALL_EVENTS, MS2ST(1000)); +test_assert((eventmask_t)0 != events, "timed out"); test_assert((eventmask_t)0x55 == events, "wrong events mask");]]></value>
</code>
</step>
@@ -737,11 +740,11 @@ test_assert((eventmask_t)0x55 == events, "wrong events mask");]]></value> <value />
</tags>
<code>
- <value><![CDATA[time = chVTGetSystemTimeX();
-events = chEvtWaitAnyTimeout(0, MS2ST(1000));
-test_assert_time_window(time + MS2ST(1000),
- time + MS2ST(1000) + 1,
- "out of time window");
+ <value><![CDATA[time = chVTGetSystemTimeX(); +events = chEvtWaitAnyTimeout(0, MS2ST(1000)); +test_assert_time_window(time + MS2ST(1000), + time + MS2ST(1000) + 1, + "out of time window"); test_assert((eventmask_t)0 == events, "wrong events mask");]]></value>
</code>
</step>
@@ -763,10 +766,10 @@ test_assert((eventmask_t)0 == events, "wrong events mask");]]></value> <value>CH_CFG_USE_MAILBOXES</value>
</condition>
<shared_code>
- <value><![CDATA[#define ALLOWED_DELAY MS2ST(5)
-#define MB_SIZE 4
-
-static msg_t mb_buffer[MB_SIZE];
+ <value><![CDATA[#define ALLOWED_DELAY MS2ST(5) +#define MB_SIZE 4 + +static msg_t mb_buffer[MB_SIZE]; static MAILBOX_DECL(mb1, mb_buffer, MB_SIZE);]]></value>
</shared_code>
<cases>
@@ -788,7 +791,7 @@ static MAILBOX_DECL(mb1, mb_buffer, MB_SIZE);]]></value> <value><![CDATA[chMBReset(&mb1);]]></value>
</teardown_code>
<local_variables>
- <value><![CDATA[msg_t msg1, msg2;
+ <value><![CDATA[msg_t msg1, msg2; unsigned i;]]></value>
</local_variables>
</various_code>
@@ -812,10 +815,10 @@ unsigned i;]]></value> <value />
</tags>
<code>
- <value><![CDATA[chMBReset(&mb1);
-test_assert_lock(chMBGetFreeCountI(&mb1) == MB_SIZE, "not empty");
-test_assert_lock(chMBGetUsedCountI(&mb1) == 0, "still full");
-test_assert_lock(mb1.buffer == mb1.wrptr, "write pointer not aligned to base");
+ <value><![CDATA[chMBReset(&mb1); +test_assert_lock(chMBGetFreeCountI(&mb1) == MB_SIZE, "not empty"); +test_assert_lock(chMBGetUsedCountI(&mb1) == 0, "still full"); +test_assert_lock(mb1.buffer == mb1.wrptr, "write pointer not aligned to base"); test_assert_lock(mb1.buffer == mb1.rdptr, "read pointer not aligned to base");]]></value>
</code>
</step>
@@ -827,12 +830,12 @@ test_assert_lock(mb1.buffer == mb1.rdptr, "read pointer not aligned to base");]] <value />
</tags>
<code>
- <value><![CDATA[msg1 = chMBPostTimeout(&mb1, (msg_t)0, TIME_INFINITE);
-test_assert(msg1 == MSG_RESET, "not in reset state");
-msg1 = chMBPostAheadTimeout(&mb1, (msg_t)0, TIME_INFINITE);
-test_assert(msg1 == MSG_RESET, "not in reset state");
-msg1 = chMBFetchTimeout(&mb1, &msg2, TIME_INFINITE);
-test_assert(msg1 == MSG_RESET, "not in reset state");
+ <value><![CDATA[msg1 = chMBPostTimeout(&mb1, (msg_t)0, TIME_INFINITE); +test_assert(msg1 == MSG_RESET, "not in reset state"); +msg1 = chMBPostAheadTimeout(&mb1, (msg_t)0, TIME_INFINITE); +test_assert(msg1 == MSG_RESET, "not in reset state"); +msg1 = chMBFetchTimeout(&mb1, &msg2, TIME_INFINITE); +test_assert(msg1 == MSG_RESET, "not in reset state"); chMBResumeX(&mb1);]]></value>
</code>
</step>
@@ -844,11 +847,11 @@ chMBResumeX(&mb1);]]></value> <value />
</tags>
<code>
- <value><![CDATA[for (i = 0; i < MB_SIZE - 1; i++) {
- msg1 = chMBPostTimeout(&mb1, 'B' + i, TIME_INFINITE);
- test_assert(msg1 == MSG_OK, "wrong wake-up message");
-}
-msg1 = chMBPostAheadTimeout(&mb1, 'A', TIME_INFINITE);
+ <value><![CDATA[for (i = 0; i < MB_SIZE - 1; i++) { + msg1 = chMBPostTimeout(&mb1, 'B' + i, TIME_INFINITE); + test_assert(msg1 == MSG_OK, "wrong wake-up message"); +} +msg1 = chMBPostAheadTimeout(&mb1, 'A', TIME_INFINITE); test_assert(msg1 == MSG_OK, "wrong wake-up message");]]></value>
</code>
</step>
@@ -860,8 +863,8 @@ test_assert(msg1 == MSG_OK, "wrong wake-up message");]]></value> <value />
</tags>
<code>
- <value><![CDATA[test_assert_lock(chMBGetFreeCountI(&mb1) == 0, "still empty");
-test_assert_lock(chMBGetUsedCountI(&mb1) == MB_SIZE, "not full");
+ <value><![CDATA[test_assert_lock(chMBGetFreeCountI(&mb1) == 0, "still empty"); +test_assert_lock(chMBGetUsedCountI(&mb1) == MB_SIZE, "not full"); test_assert_lock(mb1.rdptr == mb1.wrptr, "pointers not aligned");]]></value>
</code>
</step>
@@ -873,11 +876,11 @@ test_assert_lock(mb1.rdptr == mb1.wrptr, "pointers not aligned");]]></value> <value />
</tags>
<code>
- <value><![CDATA[for (i = 0; i < MB_SIZE; i++) {
- msg1 = chMBFetchTimeout(&mb1, &msg2, TIME_INFINITE);
- test_assert(msg1 == MSG_OK, "wrong wake-up message");
- test_emit_token(msg2);
-}
+ <value><![CDATA[for (i = 0; i < MB_SIZE; i++) { + msg1 = chMBFetchTimeout(&mb1, &msg2, TIME_INFINITE); + test_assert(msg1 == MSG_OK, "wrong wake-up message"); + test_emit_token(msg2); +} test_assert_sequence("ABCD", "wrong get sequence");]]></value>
</code>
</step>
@@ -889,9 +892,9 @@ test_assert_sequence("ABCD", "wrong get sequence");]]></value> <value />
</tags>
<code>
- <value><![CDATA[msg1 = chMBPostTimeout(&mb1, 'B' + i, TIME_INFINITE);
-test_assert(msg1 == MSG_OK, "wrong wake-up message");
-msg1 = chMBFetchTimeout(&mb1, &msg2, TIME_INFINITE);
+ <value><![CDATA[msg1 = chMBPostTimeout(&mb1, 'B' + i, TIME_INFINITE); +test_assert(msg1 == MSG_OK, "wrong wake-up message"); +msg1 = chMBFetchTimeout(&mb1, &msg2, TIME_INFINITE); test_assert(msg1 == MSG_OK, "wrong wake-up message");]]></value>
</code>
</step>
@@ -903,9 +906,9 @@ test_assert(msg1 == MSG_OK, "wrong wake-up message");]]></value> <value />
</tags>
<code>
- <value><![CDATA[test_assert_lock(chMBGetFreeCountI(&mb1) == MB_SIZE, "not empty");
-test_assert_lock(chMBGetUsedCountI(&mb1) == 0, "still full");
-test_assert(mb1.buffer == mb1.wrptr, "write pointer not aligned to base");
+ <value><![CDATA[test_assert_lock(chMBGetFreeCountI(&mb1) == MB_SIZE, "not empty"); +test_assert_lock(chMBGetUsedCountI(&mb1) == 0, "still full"); +test_assert(mb1.buffer == mb1.wrptr, "write pointer not aligned to base"); test_assert(mb1.buffer == mb1.rdptr, "read pointer not aligned to base");]]></value>
</code>
</step>
@@ -929,7 +932,7 @@ test_assert(mb1.buffer == mb1.rdptr, "read pointer not aligned to base");]]></va <value><![CDATA[chMBReset(&mb1);]]></value>
</teardown_code>
<local_variables>
- <value><![CDATA[msg_t msg1, msg2;
+ <value><![CDATA[msg_t msg1, msg2; unsigned i;]]></value>
</local_variables>
</various_code>
@@ -953,13 +956,13 @@ unsigned i;]]></value> <value />
</tags>
<code>
- <value><![CDATA[chSysLock();
-chMBResetI(&mb1);
-chSysUnlock();
-test_assert_lock(chMBGetFreeCountI(&mb1) == MB_SIZE, "not empty");
-test_assert_lock(chMBGetUsedCountI(&mb1) == 0, "still full");
-test_assert_lock(mb1.buffer == mb1.wrptr, "write pointer not aligned to base");
-test_assert_lock(mb1.buffer == mb1.rdptr, "read pointer not aligned to base");
+ <value><![CDATA[chSysLock(); +chMBResetI(&mb1); +chSysUnlock(); +test_assert_lock(chMBGetFreeCountI(&mb1) == MB_SIZE, "not empty"); +test_assert_lock(chMBGetUsedCountI(&mb1) == 0, "still full"); +test_assert_lock(mb1.buffer == mb1.wrptr, "write pointer not aligned to base"); +test_assert_lock(mb1.buffer == mb1.rdptr, "read pointer not aligned to base"); chMBResumeX(&mb1);]]></value>
</code>
</step>
@@ -971,15 +974,15 @@ chMBResumeX(&mb1);]]></value> <value />
</tags>
<code>
- <value><![CDATA[for (i = 0; i < MB_SIZE - 1; i++) {
- chSysLock();
- msg1 = chMBPostI(&mb1, 'B' + i);
- chSysUnlock();
- test_assert(msg1 == MSG_OK, "wrong wake-up message");
-}
-chSysLock();
-msg1 = chMBPostAheadI(&mb1, 'A');
-chSysUnlock();
+ <value><![CDATA[for (i = 0; i < MB_SIZE - 1; i++) { + chSysLock(); + msg1 = chMBPostI(&mb1, 'B' + i); + chSysUnlock(); + test_assert(msg1 == MSG_OK, "wrong wake-up message"); +} +chSysLock(); +msg1 = chMBPostAheadI(&mb1, 'A'); +chSysUnlock(); test_assert(msg1 == MSG_OK, "wrong wake-up message");]]></value>
</code>
</step>
@@ -991,8 +994,8 @@ test_assert(msg1 == MSG_OK, "wrong wake-up message");]]></value> <value />
</tags>
<code>
- <value><![CDATA[test_assert_lock(chMBGetFreeCountI(&mb1) == 0, "still empty");
-test_assert_lock(chMBGetUsedCountI(&mb1) == MB_SIZE, "not full");
+ <value><![CDATA[test_assert_lock(chMBGetFreeCountI(&mb1) == 0, "still empty"); +test_assert_lock(chMBGetUsedCountI(&mb1) == MB_SIZE, "not full"); test_assert_lock(mb1.rdptr == mb1.wrptr, "pointers not aligned");]]></value>
</code>
</step>
@@ -1004,13 +1007,13 @@ test_assert_lock(mb1.rdptr == mb1.wrptr, "pointers not aligned");]]></value> <value />
</tags>
<code>
- <value><![CDATA[for (i = 0; i < MB_SIZE; i++) {
- chSysLock();
- msg1 = chMBFetchI(&mb1, &msg2);
- chSysUnlock();
- test_assert(msg1 == MSG_OK, "wrong wake-up message");
- test_emit_token(msg2);
-}
+ <value><![CDATA[for (i = 0; i < MB_SIZE; i++) { + chSysLock(); + msg1 = chMBFetchI(&mb1, &msg2); + chSysUnlock(); + test_assert(msg1 == MSG_OK, "wrong wake-up message"); + test_emit_token(msg2); +} test_assert_sequence("ABCD", "wrong get sequence");]]></value>
</code>
</step>
@@ -1022,9 +1025,9 @@ test_assert_sequence("ABCD", "wrong get sequence");]]></value> <value />
</tags>
<code>
- <value><![CDATA[msg1 = chMBPostTimeout(&mb1, 'B' + i, TIME_INFINITE);
-test_assert(msg1 == MSG_OK, "wrong wake-up message");
-msg1 = chMBFetchTimeout(&mb1, &msg2, TIME_INFINITE);
+ <value><![CDATA[msg1 = chMBPostTimeout(&mb1, 'B' + i, TIME_INFINITE); +test_assert(msg1 == MSG_OK, "wrong wake-up message"); +msg1 = chMBFetchTimeout(&mb1, &msg2, TIME_INFINITE); test_assert(msg1 == MSG_OK, "wrong wake-up message");]]></value>
</code>
</step>
@@ -1036,9 +1039,9 @@ test_assert(msg1 == MSG_OK, "wrong wake-up message");]]></value> <value />
</tags>
<code>
- <value><![CDATA[test_assert_lock(chMBGetFreeCountI(&mb1) == MB_SIZE, "not empty");
-test_assert_lock(chMBGetUsedCountI(&mb1) == 0, "still full");
-test_assert(mb1.buffer == mb1.wrptr, "write pointer not aligned to base");
+ <value><![CDATA[test_assert_lock(chMBGetFreeCountI(&mb1) == MB_SIZE, "not empty"); +test_assert_lock(chMBGetUsedCountI(&mb1) == 0, "still full"); +test_assert(mb1.buffer == mb1.wrptr, "write pointer not aligned to base"); test_assert(mb1.buffer == mb1.rdptr, "read pointer not aligned to base");]]></value>
</code>
</step>
@@ -1062,7 +1065,7 @@ test_assert(mb1.buffer == mb1.rdptr, "read pointer not aligned to base");]]></va <value><![CDATA[chMBReset(&mb1);]]></value>
</teardown_code>
<local_variables>
- <value><![CDATA[msg_t msg1, msg2;
+ <value><![CDATA[msg_t msg1, msg2; unsigned i;]]></value>
</local_variables>
</various_code>
@@ -1075,9 +1078,9 @@ unsigned i;]]></value> <value />
</tags>
<code>
- <value><![CDATA[for (i = 0; i < MB_SIZE; i++) {
- msg1 = chMBPostTimeout(&mb1, 'B' + i, TIME_INFINITE);
- test_assert(msg1 == MSG_OK, "wrong wake-up message");
+ <value><![CDATA[for (i = 0; i < MB_SIZE; i++) { + msg1 = chMBPostTimeout(&mb1, 'B' + i, TIME_INFINITE); + test_assert(msg1 == MSG_OK, "wrong wake-up message"); }]]></value>
</code>
</step>
@@ -1089,17 +1092,17 @@ unsigned i;]]></value> <value />
</tags>
<code>
- <value><![CDATA[msg1 = chMBPostTimeout(&mb1, 'X', 1);
-test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");
-chSysLock();
-msg1 = chMBPostI(&mb1, 'X');
-chSysUnlock();
-test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");
-msg1 = chMBPostAheadTimeout(&mb1, 'X', 1);
-test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");
-chSysLock();
-msg1 = chMBPostAheadI(&mb1, 'X');
-chSysUnlock();
+ <value><![CDATA[msg1 = chMBPostTimeout(&mb1, 'X', 1); +test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message"); +chSysLock(); +msg1 = chMBPostI(&mb1, 'X'); +chSysUnlock(); +test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message"); +msg1 = chMBPostAheadTimeout(&mb1, 'X', 1); +test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message"); +chSysLock(); +msg1 = chMBPostAheadI(&mb1, 'X'); +chSysUnlock(); test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");]]></value>
</code>
</step>
@@ -1111,7 +1114,7 @@ test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");]]></value> <value />
</tags>
<code>
- <value><![CDATA[chMBReset(&mb1);;
+ <value><![CDATA[chMBReset(&mb1);; chMBResumeX(&mb1);]]></value>
</code>
</step>
@@ -1123,11 +1126,11 @@ chMBResumeX(&mb1);]]></value> <value />
</tags>
<code>
- <value><![CDATA[msg1 = chMBFetchTimeout(&mb1, &msg2, 1);
-test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");
-chSysLock();
-msg1 = chMBFetchI(&mb1, &msg2);
-chSysUnlock();
+ <value><![CDATA[msg1 = chMBFetchTimeout(&mb1, &msg2, 1); +test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message"); +chSysLock(); +msg1 = chMBFetchI(&mb1, &msg2); +chSysUnlock(); test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");]]></value>
</code>
</step>
@@ -1149,21 +1152,21 @@ test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");]]></value> <value>CH_CFG_USE_MEMPOOLS</value>
</condition>
<shared_code>
- <value><![CDATA[#define MEMORY_POOL_SIZE 4
-
-static uint32_t objects[MEMORY_POOL_SIZE];
-static MEMORYPOOL_DECL(mp1, sizeof (uint32_t), PORT_NATURAL_ALIGN, NULL);
-
-#if CH_CFG_USE_SEMAPHORES
-static GUARDEDMEMORYPOOL_DECL(gmp1, sizeof (uint32_t), PORT_NATURAL_ALIGN);
-#endif
-
-static void *null_provider(size_t size, unsigned align) {
-
- (void)size;
- (void)align;
-
- return NULL;
+ <value><![CDATA[#define MEMORY_POOL_SIZE 4 + +static uint32_t objects[MEMORY_POOL_SIZE]; +static MEMORYPOOL_DECL(mp1, sizeof (uint32_t), PORT_NATURAL_ALIGN, NULL); + +#if CH_CFG_USE_SEMAPHORES +static GUARDEDMEMORYPOOL_DECL(gmp1, sizeof (uint32_t), PORT_NATURAL_ALIGN); +#endif + +static void *null_provider(size_t size, unsigned align) { + + (void)size; + (void)align; + + return NULL; }]]></value>
</shared_code>
<cases>
@@ -1208,7 +1211,7 @@ static void *null_provider(size_t size, unsigned align) { <value />
</tags>
<code>
- <value><![CDATA[for (i = 0; i < MEMORY_POOL_SIZE; i++)
+ <value><![CDATA[for (i = 0; i < MEMORY_POOL_SIZE; i++) test_assert(chPoolAlloc(&mp1) != NULL, "list empty");]]></value>
</code>
</step>
@@ -1231,7 +1234,7 @@ static void *null_provider(size_t size, unsigned align) { <value />
</tags>
<code>
- <value><![CDATA[for (i = 0; i < MEMORY_POOL_SIZE; i++)
+ <value><![CDATA[for (i = 0; i < MEMORY_POOL_SIZE; i++) chPoolFree(&mp1, &objects[i]);]]></value>
</code>
</step>
@@ -1243,7 +1246,7 @@ static void *null_provider(size_t size, unsigned align) { <value />
</tags>
<code>
- <value><![CDATA[for (i = 0; i < MEMORY_POOL_SIZE; i++)
+ <value><![CDATA[for (i = 0; i < MEMORY_POOL_SIZE; i++) test_assert(chPoolAlloc(&mp1) != NULL, "list empty");]]></value>
</code>
</step>
@@ -1266,7 +1269,7 @@ static void *null_provider(size_t size, unsigned align) { <value />
</tags>
<code>
- <value><![CDATA[chPoolObjectInit(&mp1, sizeof (uint32_t), null_provider);
+ <value><![CDATA[chPoolObjectInit(&mp1, sizeof (uint32_t), null_provider); test_assert(chPoolAlloc(&mp1) == NULL, "provider returned memory");]]></value>
</code>
</step>
@@ -1313,7 +1316,7 @@ test_assert(chPoolAlloc(&mp1) == NULL, "provider returned memory");]]></value> <value />
</tags>
<code>
- <value><![CDATA[for (i = 0; i < MEMORY_POOL_SIZE; i++)
+ <value><![CDATA[for (i = 0; i < MEMORY_POOL_SIZE; i++) test_assert(chGuardedPoolAllocTimeout(&gmp1, TIME_IMMEDIATE) != NULL, "list empty");]]></value>
</code>
</step>
@@ -1336,7 +1339,7 @@ test_assert(chPoolAlloc(&mp1) == NULL, "provider returned memory");]]></value> <value />
</tags>
<code>
- <value><![CDATA[for (i = 0; i < MEMORY_POOL_SIZE; i++)
+ <value><![CDATA[for (i = 0; i < MEMORY_POOL_SIZE; i++) chGuardedPoolFree(&gmp1, &objects[i]);]]></value>
</code>
</step>
@@ -1348,7 +1351,7 @@ test_assert(chPoolAlloc(&mp1) == NULL, "provider returned memory");]]></value> <value />
</tags>
<code>
- <value><![CDATA[for (i = 0; i < MEMORY_POOL_SIZE; i++)
+ <value><![CDATA[for (i = 0; i < MEMORY_POOL_SIZE; i++) test_assert(chGuardedPoolAllocTimeout(&gmp1, TIME_IMMEDIATE) != NULL, "list empty");]]></value>
</code>
</step>
@@ -1416,10 +1419,10 @@ test_assert(chPoolAlloc(&mp1) == NULL, "provider returned memory");]]></value> <value>CH_CFG_USE_HEAP</value>
</condition>
<shared_code>
- <value><![CDATA[#define ALLOC_SIZE 16
-#define HEAP_SIZE (ALLOC_SIZE * 8)
-
-static memory_heap_t test_heap;
+ <value><![CDATA[#define ALLOC_SIZE 16 +#define HEAP_SIZE (ALLOC_SIZE * 8) + +static memory_heap_t test_heap; static CH_HEAP_AREA(myheap, HEAP_SIZE);]]></value>
</shared_code>
<cases>
@@ -1441,7 +1444,7 @@ static CH_HEAP_AREA(myheap, HEAP_SIZE);]]></value> <value />
</teardown_code>
<local_variables>
- <value><![CDATA[void *p1, *p2, *p3;
+ <value><![CDATA[void *p1, *p2, *p3; size_t n, sz;]]></value>
</local_variables>
</various_code>
@@ -1465,7 +1468,7 @@ size_t n, sz;]]></value> <value />
</tags>
<code>
- <value><![CDATA[p1 = chHeapAlloc(&test_heap, HEAP_SIZE * 2);
+ <value><![CDATA[p1 = chHeapAlloc(&test_heap, HEAP_SIZE * 2); test_assert(p1 == NULL, "allocation not failed");]]></value>
</code>
</step>
@@ -1477,8 +1480,8 @@ test_assert(p1 == NULL, "allocation not failed");]]></value> <value />
</tags>
<code>
- <value><![CDATA[p1 = chHeapAlloc(&test_heap, ALLOC_SIZE);
-test_assert(p1 != NULL, "allocation failed");
+ <value><![CDATA[p1 = chHeapAlloc(&test_heap, ALLOC_SIZE); +test_assert(p1 != NULL, "allocation failed"); chHeapFree(p1);]]></value>
</code>
</step>
@@ -1490,11 +1493,11 @@ chHeapFree(p1);]]></value> <value />
</tags>
<code>
- <value><![CDATA[size_t total_size, largest_size;
-
-n = chHeapStatus(&test_heap, &total_size, &largest_size);
-test_assert(n == 1, "missing free block");
-test_assert(total_size >= ALLOC_SIZE, "unexpected heap state");
+ <value><![CDATA[size_t total_size, largest_size; + +n = chHeapStatus(&test_heap, &total_size, &largest_size); +test_assert(n == 1, "missing free block"); +test_assert(total_size >= ALLOC_SIZE, "unexpected heap state"); test_assert(total_size == largest_size, "unexpected heap state");]]></value>
</code>
</step>
@@ -1506,12 +1509,12 @@ test_assert(total_size == largest_size, "unexpected heap state");]]></value> <value />
</tags>
<code>
- <value><![CDATA[p1 = chHeapAlloc(&test_heap, ALLOC_SIZE);
-p2 = chHeapAlloc(&test_heap, ALLOC_SIZE);
-p3 = chHeapAlloc(&test_heap, ALLOC_SIZE);
-chHeapFree(p1); /* Does not merge.*/
-chHeapFree(p2); /* Merges backward.*/
-chHeapFree(p3); /* Merges both sides.*/
+ <value><![CDATA[p1 = chHeapAlloc(&test_heap, ALLOC_SIZE); +p2 = chHeapAlloc(&test_heap, ALLOC_SIZE); +p3 = chHeapAlloc(&test_heap, ALLOC_SIZE); +chHeapFree(p1); /* Does not merge.*/ +chHeapFree(p2); /* Merges backward.*/ +chHeapFree(p3); /* Merges both sides.*/ test_assert(chHeapStatus(&test_heap, &n, NULL) == 1, "heap fragmented");]]></value>
</code>
</step>
@@ -1523,12 +1526,12 @@ test_assert(chHeapStatus(&test_heap, &n, NULL) == 1, "heap fragmented");]]></val <value />
</tags>
<code>
- <value><![CDATA[p1 = chHeapAlloc(&test_heap, ALLOC_SIZE);
-p2 = chHeapAlloc(&test_heap, ALLOC_SIZE);
-p3 = chHeapAlloc(&test_heap, ALLOC_SIZE);
-chHeapFree(p3); /* Merges forward.*/
-chHeapFree(p2); /* Merges forward.*/
-chHeapFree(p1); /* Merges forward.*/
+ <value><![CDATA[p1 = chHeapAlloc(&test_heap, ALLOC_SIZE); +p2 = chHeapAlloc(&test_heap, ALLOC_SIZE); +p3 = chHeapAlloc(&test_heap, ALLOC_SIZE); +chHeapFree(p3); /* Merges forward.*/ +chHeapFree(p2); /* Merges forward.*/ +chHeapFree(p1); /* Merges forward.*/ test_assert(chHeapStatus(&test_heap, &n, NULL) == 1, "heap fragmented");]]></value>
</code>
</step>
@@ -1540,17 +1543,17 @@ test_assert(chHeapStatus(&test_heap, &n, NULL) == 1, "heap fragmented");]]></val <value />
</tags>
<code>
- <value><![CDATA[p1 = chHeapAlloc(&test_heap, ALLOC_SIZE + 1);
-p2 = chHeapAlloc(&test_heap, ALLOC_SIZE);
-chHeapFree(p1);
-test_assert(chHeapStatus(&test_heap, &n, NULL) == 2, "invalid state");
-p1 = chHeapAlloc(&test_heap, ALLOC_SIZE);
-/* Note, the first situation happens when the alignment size is smaller
- than the header size, the second in the other cases.*/
-test_assert((chHeapStatus(&test_heap, &n, NULL) == 1) ||
- (chHeapStatus(&test_heap, &n, NULL) == 2), "heap fragmented");
-chHeapFree(p2);
-chHeapFree(p1);
+ <value><![CDATA[p1 = chHeapAlloc(&test_heap, ALLOC_SIZE + 1); +p2 = chHeapAlloc(&test_heap, ALLOC_SIZE); +chHeapFree(p1); +test_assert(chHeapStatus(&test_heap, &n, NULL) == 2, "invalid state"); +p1 = chHeapAlloc(&test_heap, ALLOC_SIZE); +/* Note, the first situation happens when the alignment size is smaller + than the header size, the second in the other cases.*/ +test_assert((chHeapStatus(&test_heap, &n, NULL) == 1) || + (chHeapStatus(&test_heap, &n, NULL) == 2), "heap fragmented"); +chHeapFree(p2); +chHeapFree(p1); test_assert(chHeapStatus(&test_heap, &n, NULL) == 1, "heap fragmented");]]></value>
</code>
</step>
@@ -1562,13 +1565,13 @@ test_assert(chHeapStatus(&test_heap, &n, NULL) == 1, "heap fragmented");]]></val <value />
</tags>
<code>
- <value><![CDATA[p1 = chHeapAlloc(&test_heap, ALLOC_SIZE);
-p2 = chHeapAlloc(&test_heap, ALLOC_SIZE);
-chHeapFree(p1);
-test_assert( chHeapStatus(&test_heap, &n, NULL) == 2, "invalid state");
-p1 = chHeapAlloc(&test_heap, ALLOC_SIZE * 2); /* Skips first fragment.*/
-chHeapFree(p1);
-chHeapFree(p2);
+ <value><![CDATA[p1 = chHeapAlloc(&test_heap, ALLOC_SIZE); +p2 = chHeapAlloc(&test_heap, ALLOC_SIZE); +chHeapFree(p1); +test_assert( chHeapStatus(&test_heap, &n, NULL) == 2, "invalid state"); +p1 = chHeapAlloc(&test_heap, ALLOC_SIZE * 2); /* Skips first fragment.*/ +chHeapFree(p1); +chHeapFree(p2); test_assert(chHeapStatus(&test_heap, &n, NULL) == 1, "heap fragmented");]]></value>
</code>
</step>
@@ -1580,10 +1583,10 @@ test_assert(chHeapStatus(&test_heap, &n, NULL) == 1, "heap fragmented");]]></val <value />
</tags>
<code>
- <value><![CDATA[(void)chHeapStatus(&test_heap, &n, NULL);
-p1 = chHeapAlloc(&test_heap, n);
-test_assert(p1 != NULL, "allocation failed");
-test_assert(chHeapStatus(&test_heap, NULL, NULL) == 0, "not empty");
+ <value><![CDATA[(void)chHeapStatus(&test_heap, &n, NULL); +p1 = chHeapAlloc(&test_heap, n); +test_assert(p1 != NULL, "allocation failed"); +test_assert(chHeapStatus(&test_heap, NULL, NULL) == 0, "not empty"); chHeapFree(p1);]]></value>
</code>
</step>
@@ -1595,7 +1598,7 @@ chHeapFree(p1);]]></value> <value />
</tags>
<code>
- <value><![CDATA[test_assert(chHeapStatus(&test_heap, &n, NULL) == 1, "heap fragmented");
+ <value><![CDATA[test_assert(chHeapStatus(&test_heap, &n, NULL) == 1, "heap fragmented"); test_assert(n == sz, "size changed");]]></value>
</code>
</step>
@@ -1619,7 +1622,7 @@ test_assert(n == sz, "size changed");]]></value> <value />
</teardown_code>
<local_variables>
- <value><![CDATA[void *p1;
+ <value><![CDATA[void *p1; size_t total_size, largest_size;]]></value>
</local_variables>
</various_code>
@@ -1632,9 +1635,9 @@ size_t total_size, largest_size;]]></value> <value />
</tags>
<code>
- <value><![CDATA[(void)chHeapStatus(NULL, &total_size, &largest_size);
-p1 = chHeapAlloc(&test_heap, ALLOC_SIZE);
-test_assert(p1 != NULL, "allocation failed");
+ <value><![CDATA[(void)chHeapStatus(NULL, &total_size, &largest_size); +p1 = chHeapAlloc(&test_heap, ALLOC_SIZE); +test_assert(p1 != NULL, "allocation failed"); chHeapFree(p1);]]></value>
</code>
</step>
@@ -1646,7 +1649,7 @@ chHeapFree(p1);]]></value> <value />
</tags>
<code>
- <value><![CDATA[p1 = chHeapAlloc(NULL, (size_t)-256);
+ <value><![CDATA[p1 = chHeapAlloc(NULL, (size_t)-256); test_assert(p1 == NULL, "allocation not failed");]]></value>
</code>
</step>
|