diff options
author | Giovanni Di Sirio <gdisirio@gmail.com> | 2017-10-01 19:23:02 +0000 |
---|---|---|
committer | Giovanni Di Sirio <gdisirio@gmail.com> | 2017-10-01 19:23:02 +0000 |
commit | 23c7476ac4f0ebfc7b09d9858149d9bf79f1122e (patch) | |
tree | 2480580f82d813952d9327846bdfbb0f688e4c7f /test/nil/configuration.xml | |
parent | cc61794d1a00a74f31c650522988a2f327b6cfab (diff) | |
download | ChibiOS-23c7476ac4f0ebfc7b09d9858149d9bf79f1122e.tar.gz ChibiOS-23c7476ac4f0ebfc7b09d9858149d9bf79f1122e.tar.bz2 ChibiOS-23c7476ac4f0ebfc7b09d9858149d9bf79f1122e.zip |
Changed my mind, modified types.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10742 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'test/nil/configuration.xml')
-rw-r--r-- | test/nil/configuration.xml | 559 |
1 files changed, 279 insertions, 280 deletions
diff --git a/test/nil/configuration.xml b/test/nil/configuration.xml index 297cb804a..2eaa24bd0 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>
@@ -32,15 +32,15 @@ </description>
<global_data_and_code>
<global_definitions>
- <value><![CDATA[#define TEST_SUITE_NAME "ChibiOS/NIL Test Suite" + <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); +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>
@@ -62,38 +62,38 @@ THD_FUNCTION(test_support, arg);]]></value> #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); - } +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>
@@ -295,8 +295,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 +332,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 +347,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 +362,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 +377,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 +392,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 +417,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 +452,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 +467,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 +479,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 +515,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 +530,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 +557,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 +570,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 +587,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 +635,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 +648,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 +663,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 +694,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 +707,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 +722,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 +737,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 +763,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 +788,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 +812,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>
@@ -844,11 +844,11 @@ chMBResumeX(&mb1);]]></value> <value />
</tags>
<code>
- <value><![CDATA[for (i = 0; i < MB_SIZE - 1; i++) { - msg1 = chMBPost(&mb1, 'B' + i, TIME_INFINITE); - test_assert(msg1 == MSG_OK, "wrong wake-up message"); -} -msg1 = chMBPostAhead(&mb1, 'A', TIME_INFINITE); + <value><![CDATA[for (i = 0; i < MB_SIZE - 1; i++) {
+ msg1 = chMBPost(&mb1, 'B' + i, TIME_INFINITE);
+ test_assert(msg1 == MSG_OK, "wrong wake-up message");
+}
+msg1 = chMBPostAhead(&mb1, 'A', TIME_INFINITE);
test_assert(msg1 == MSG_OK, "wrong wake-up message");]]></value>
</code>
</step>
@@ -860,8 +860,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 +873,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 = chMBFetch(&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 = chMBFetch(&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 +889,9 @@ test_assert_sequence("ABCD", "wrong get sequence");]]></value> <value />
</tags>
<code>
- <value><![CDATA[msg1 = chMBPost(&mb1, 'B' + i, TIME_INFINITE); -test_assert(msg1 == MSG_OK, "wrong wake-up message"); -msg1 = chMBFetch(&mb1, &msg2, TIME_INFINITE); + <value><![CDATA[msg1 = chMBPost(&mb1, 'B' + i, TIME_INFINITE);
+test_assert(msg1 == MSG_OK, "wrong wake-up message");
+msg1 = chMBFetch(&mb1, &msg2, TIME_INFINITE);
test_assert(msg1 == MSG_OK, "wrong wake-up message");]]></value>
</code>
</step>
@@ -903,9 +903,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 +929,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,12 +953,12 @@ 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"); + <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>
@@ -971,15 +971,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 +991,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 +1004,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 +1022,9 @@ test_assert_sequence("ABCD", "wrong get sequence");]]></value> <value />
</tags>
<code>
- <value><![CDATA[msg1 = chMBPost(&mb1, 'B' + i, TIME_INFINITE); -test_assert(msg1 == MSG_OK, "wrong wake-up message"); -msg1 = chMBFetch(&mb1, &msg2, TIME_INFINITE); + <value><![CDATA[msg1 = chMBPost(&mb1, 'B' + i, TIME_INFINITE);
+test_assert(msg1 == MSG_OK, "wrong wake-up message");
+msg1 = chMBFetch(&mb1, &msg2, TIME_INFINITE);
test_assert(msg1 == MSG_OK, "wrong wake-up message");]]></value>
</code>
</step>
@@ -1036,9 +1036,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 +1062,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 +1075,9 @@ unsigned i;]]></value> <value />
</tags>
<code>
- <value><![CDATA[for (i = 0; i < MB_SIZE; i++) { - msg1 = chMBPost(&mb1, 'B' + i, TIME_INFINITE); - test_assert(msg1 == MSG_OK, "wrong wake-up message"); + <value><![CDATA[for (i = 0; i < MB_SIZE; i++) {
+ msg1 = chMBPost(&mb1, 'B' + i, TIME_INFINITE);
+ test_assert(msg1 == MSG_OK, "wrong wake-up message");
}]]></value>
</code>
</step>
@@ -1089,17 +1089,17 @@ unsigned i;]]></value> <value />
</tags>
<code>
- <value><![CDATA[msg1 = chMBPost(&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 = chMBPostAhead(&mb1, 'X', 1); -test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message"); -chSysLock(); -msg1 = chMBPostAheadI(&mb1, 'X'); -chSysUnlock(); + <value><![CDATA[msg1 = chMBPost(&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 = chMBPostAhead(&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>
@@ -1123,11 +1123,11 @@ chMBResumeX(&mb1);]]></value> <value />
</tags>
<code>
- <value><![CDATA[msg1 = chMBFetch(&mb1, &msg2, 1); -test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message"); -chSysLock(); -msg1 = chMBFetchI(&mb1, &msg2); -chSysUnlock(); + <value><![CDATA[msg1 = chMBFetch(&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,22 +1149,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]; + <value><![CDATA[#define MEMORY_POOL_SIZE 4
+
+static uint32_t objects[MEMORY_POOL_SIZE];
static MEMORYPOOL_DECL(mp1, sizeof (uint32_t), NULL);
-#if CH_CFG_USE_SEMAPHORES -static GUARDEDMEMORYPOOL_DECL(gmp1, sizeof (uint32_t)); +#if CH_CFG_USE_SEMAPHORES
+static GUARDEDMEMORYPOOL_DECL(gmp1, sizeof (uint32_t));
#endif
- -static void *null_provider(size_t size, unsigned align, size_t offset) { - - (void)size; +
+static void *null_provider(size_t size, unsigned align) {
+
+ (void)size;
(void)align;
- (void)offset; - - return NULL; +
+ return NULL;
}]]></value>
</shared_code>
<cases>
@@ -1209,7 +1208,7 @@ static void *null_provider(size_t size, unsigned align, size_t offset) { <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>
@@ -1232,7 +1231,7 @@ static void *null_provider(size_t size, unsigned align, size_t offset) { <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>
@@ -1244,7 +1243,7 @@ static void *null_provider(size_t size, unsigned align, size_t offset) { <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>
@@ -1267,7 +1266,7 @@ static void *null_provider(size_t size, unsigned align, size_t offset) { <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>
@@ -1314,7 +1313,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>
@@ -1337,7 +1336,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>
@@ -1349,7 +1348,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>
@@ -1417,10 +1416,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>
@@ -1442,7 +1441,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>
@@ -1466,7 +1465,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>
@@ -1478,8 +1477,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>
@@ -1491,11 +1490,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>
@@ -1507,12 +1506,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>
@@ -1524,12 +1523,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>
@@ -1541,17 +1540,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>
@@ -1563,13 +1562,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>
@@ -1581,10 +1580,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>
@@ -1596,7 +1595,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>
@@ -1620,7 +1619,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>
@@ -1633,9 +1632,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>
@@ -1647,7 +1646,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>
|