diff options
-rw-r--r-- | os/common/oslib/include/chheap.h | 2 | ||||
-rw-r--r-- | os/common/oslib/include/chmemcore.h | 7 | ||||
-rw-r--r-- | os/common/oslib/src/chfactory.c | 4 | ||||
-rw-r--r-- | os/common/oslib/src/chmempools.c | 2 | ||||
-rw-r--r-- | test/nil/configuration.xml | 559 | ||||
-rw-r--r-- | test/nil/source/test/test_sequence_006.c | 3 | ||||
-rw-r--r-- | test/rt/configuration.xml | 2321 | ||||
-rw-r--r-- | test/rt/source/test/test_sequence_010.c | 3 |
8 files changed, 1451 insertions, 1450 deletions
diff --git a/os/common/oslib/include/chheap.h b/os/common/oslib/include/chheap.h index 0447d546d..0b259a329 100644 --- a/os/common/oslib/include/chheap.h +++ b/os/common/oslib/include/chheap.h @@ -95,7 +95,7 @@ union heap_header { * @brief Structure describing a memory heap.
*/
struct memory_heap {
- memgetfunc_t provider; /**< @brief Memory blocks provider for
+ memgetfunc2_t provider; /**< @brief Memory blocks provider for
this heap. */
heap_header_t header; /**< @brief Free blocks list header. */
#if CH_CFG_USE_MUTEXES == TRUE
diff --git a/os/common/oslib/include/chmemcore.h b/os/common/oslib/include/chmemcore.h index 401e9b1a9..759cee78d 100644 --- a/os/common/oslib/include/chmemcore.h +++ b/os/common/oslib/include/chmemcore.h @@ -68,7 +68,12 @@ /**
* @brief Memory get function.
*/
-typedef void *(*memgetfunc_t)(size_t size, unsigned align, size_t offset);
+typedef void *(*memgetfunc_t)(size_t size, unsigned align);
+
+/**
+ * @brief Enhanced memory get function.
+ */
+typedef void *(*memgetfunc2_t)(size_t size, unsigned align, size_t offset);
/**
* @brief Type of memory core object.
diff --git a/os/common/oslib/src/chfactory.c b/os/common/oslib/src/chfactory.c index 2d208d0c4..501f7e59d 100644 --- a/os/common/oslib/src/chfactory.c +++ b/os/common/oslib/src/chfactory.c @@ -235,7 +235,7 @@ void _factory_init(void) { dyn_list_init(&ch_factory.obj_list);
chPoolObjectInit(&ch_factory.obj_pool,
sizeof (registered_object_t),
- chCoreAllocAlignedWithOffsetI);
+ chCoreAllocAlignedI);
#endif
#if CH_CFG_FACTORY_GENERIC_BUFFERS == TRUE
dyn_list_init(&ch_factory.buf_list);
@@ -244,7 +244,7 @@ void _factory_init(void) { dyn_list_init(&ch_factory.sem_list);
chPoolObjectInit(&ch_factory.sem_pool,
sizeof (dyn_semaphore_t),
- chCoreAllocAlignedWithOffsetI);
+ chCoreAllocAlignedI);
#endif
}
diff --git a/os/common/oslib/src/chmempools.c b/os/common/oslib/src/chmempools.c index fe08c45cf..384e2f7ee 100644 --- a/os/common/oslib/src/chmempools.c +++ b/os/common/oslib/src/chmempools.c @@ -130,7 +130,7 @@ void *chPoolAllocI(memory_pool_t *mp) { mp->next = mp->next->next;
}
else if (mp->provider != NULL) {
- objp = mp->provider(mp->object_size, PORT_NATURAL_ALIGN, 0U); /* TODO: Alignment is not properly handled */
+ objp = mp->provider(mp->object_size, PORT_NATURAL_ALIGN); /* TODO: Alignment is not properly handled */
}
/*lint -restore*/
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>
diff --git a/test/nil/source/test/test_sequence_006.c b/test/nil/source/test/test_sequence_006.c index b14c522a7..759ceae52 100644 --- a/test/nil/source/test/test_sequence_006.c +++ b/test/nil/source/test/test_sequence_006.c @@ -58,11 +58,10 @@ static MEMORYPOOL_DECL(mp1, sizeof (uint32_t), NULL); static GUARDEDMEMORYPOOL_DECL(gmp1, sizeof (uint32_t));
#endif
-static void *null_provider(size_t size, unsigned align, size_t offset) {
+static void *null_provider(size_t size, unsigned align) {
(void)size;
(void)align;
- (void)offset;
return NULL;
}
diff --git a/test/rt/configuration.xml b/test/rt/configuration.xml index 3c697723e..162b85bd2 100644 --- a/test/rt/configuration.xml +++ b/test/rt/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,46 +32,46 @@ </description>
<global_data_and_code>
<global_definitions>
- <value><![CDATA[#define TEST_SUITE_NAME "ChibiOS/RT Test Suite" - -/* - * Allowed delay in timeout checks. - */ -#define ALLOWED_DELAY MS2ST(2) - -/* - * Maximum number of test threads. - */ -#define MAX_THREADS 5 - -/* - * Stack size of test threads. - */ -#if defined(CH_ARCHITECTURE_AVR) || defined(CH_ARCHITECTURE_MSP430) -#define THREADS_STACK_SIZE 48 -#elif defined(CH_ARCHITECTURE_STM8) -#define THREADS_STACK_SIZE 64 -#elif defined(CH_ARCHITECTURE_SIMIA32) -#define THREADS_STACK_SIZE 512 -#else -#define THREADS_STACK_SIZE 128 -#endif - -/* - * Working Area size of test threads. - */ -#define WA_SIZE MEM_ALIGN_NEXT(THD_WORKING_AREA_SIZE(THREADS_STACK_SIZE), \ - PORT_WORKING_AREA_ALIGN) + <value><![CDATA[#define TEST_SUITE_NAME "ChibiOS/RT Test Suite"
+
+/*
+ * Allowed delay in timeout checks.
+ */
+#define ALLOWED_DELAY MS2ST(2)
+
+/*
+ * Maximum number of test threads.
+ */
+#define MAX_THREADS 5
+
+/*
+ * Stack size of test threads.
+ */
+#if defined(CH_ARCHITECTURE_AVR) || defined(CH_ARCHITECTURE_MSP430)
+#define THREADS_STACK_SIZE 48
+#elif defined(CH_ARCHITECTURE_STM8)
+#define THREADS_STACK_SIZE 64
+#elif defined(CH_ARCHITECTURE_SIMIA32)
+#define THREADS_STACK_SIZE 512
+#else
+#define THREADS_STACK_SIZE 128
+#endif
+
+/*
+ * Working Area size of test threads.
+ */
+#define WA_SIZE MEM_ALIGN_NEXT(THD_WORKING_AREA_SIZE(THREADS_STACK_SIZE), \
+ PORT_WORKING_AREA_ALIGN)
#define TEST_REPORT_HOOK_HEADER test_print_port_info();
- -extern uint8_t test_buffer[WA_SIZE * 5]; -extern thread_t *threads[MAX_THREADS]; -extern void * ROMCONST wa[5]; -void test_print_port_info(void); -void test_terminate_threads(void); -void test_wait_threads(void); +extern uint8_t test_buffer[WA_SIZE * 5];
+extern thread_t *threads[MAX_THREADS];
+extern void * ROMCONST wa[5];
+
+void test_print_port_info(void);
+void test_terminate_threads(void);
+void test_wait_threads(void);
systime_t test_wait_tick(void);]]></value>
</global_definitions>
<global_code>
@@ -93,56 +93,56 @@ systime_t test_wait_tick(void);]]></value> #endif
}
-/* - * Global test buffer holding 5 working areas. - */ -ALIGNED_VAR(PORT_WORKING_AREA_ALIGN) uint8_t test_buffer[WA_SIZE * 5]; - -/* - * Pointers to the spawned threads. - */ -thread_t *threads[MAX_THREADS]; - -/* - * Pointers to the working areas. - */ -void * ROMCONST wa[5] = {test_buffer + (WA_SIZE * 0), - test_buffer + (WA_SIZE * 1), - test_buffer + (WA_SIZE * 2), - test_buffer + (WA_SIZE * 3), - test_buffer + (WA_SIZE * 4)}; - -/* - * Sets a termination request in all the test-spawned threads. - */ -void test_terminate_threads(void) { - unsigned i; - - for (i = 0; i < MAX_THREADS; i++) - if (threads[i]) - chThdTerminate(threads[i]); -} - -/* - * Waits for the completion of all the test-spawned threads. - */ -void test_wait_threads(void) { - unsigned i; - - for (i = 0; i < MAX_THREADS; i++) - if (threads[i] != NULL) { - chThdWait(threads[i]); - threads[i] = NULL; - } -} - -/* - * Delays execution until next system time tick. - */ -systime_t test_wait_tick(void) { - - chThdSleep(1); - return chVTGetSystemTime(); +/*
+ * Global test buffer holding 5 working areas.
+ */
+ALIGNED_VAR(PORT_WORKING_AREA_ALIGN) uint8_t test_buffer[WA_SIZE * 5];
+
+/*
+ * Pointers to the spawned threads.
+ */
+thread_t *threads[MAX_THREADS];
+
+/*
+ * Pointers to the working areas.
+ */
+void * ROMCONST wa[5] = {test_buffer + (WA_SIZE * 0),
+ test_buffer + (WA_SIZE * 1),
+ test_buffer + (WA_SIZE * 2),
+ test_buffer + (WA_SIZE * 3),
+ test_buffer + (WA_SIZE * 4)};
+
+/*
+ * Sets a termination request in all the test-spawned threads.
+ */
+void test_terminate_threads(void) {
+ unsigned i;
+
+ for (i = 0; i < MAX_THREADS; i++)
+ if (threads[i])
+ chThdTerminate(threads[i]);
+}
+
+/*
+ * Waits for the completion of all the test-spawned threads.
+ */
+void test_wait_threads(void) {
+ unsigned i;
+
+ for (i = 0; i < MAX_THREADS; i++)
+ if (threads[i] != NULL) {
+ chThdWait(threads[i]);
+ threads[i] = NULL;
+ }
+}
+
+/*
+ * Delays execution until next system time tick.
+ */
+systime_t test_wait_tick(void) {
+
+ chThdSleep(1);
+ return chVTGetSystemTime();
}]]></value>
</global_code>
</global_data_and_code>
@@ -365,21 +365,21 @@ test_println("");]]></value> <value />
</condition>
<shared_code>
- <value><![CDATA[/* Timer callback for testing system functions in ISR context.*/ -static void vtcb(void *p) { - syssts_t sts; - - (void)p; - - /* Testing normal case.*/ - chSysLockFromISR(); - chSysUnlockFromISR(); - - /* Reentrant case.*/ - chSysLockFromISR(); - sts = chSysGetStatusAndLockX(); - chSysRestoreStatusX(sts); - chSysUnlockFromISR(); + <value><![CDATA[/* Timer callback for testing system functions in ISR context.*/
+static void vtcb(void *p) {
+ syssts_t sts;
+
+ (void)p;
+
+ /* Testing normal case.*/
+ chSysLockFromISR();
+ chSysUnlockFromISR();
+
+ /* Reentrant case.*/
+ chSysLockFromISR();
+ sts = chSysGetStatusAndLockX();
+ chSysRestoreStatusX(sts);
+ chSysUnlockFromISR();
}]]></value>
</shared_code>
<cases>
@@ -413,9 +413,9 @@ static void vtcb(void *p) { <value />
</tags>
<code>
- <value><![CDATA[chSysLock(); -result = chSysIntegrityCheckI(CH_INTEGRITY_RLIST); -chSysUnlock(); + <value><![CDATA[chSysLock();
+result = chSysIntegrityCheckI(CH_INTEGRITY_RLIST);
+chSysUnlock();
test_assert(result == false, "ready list check failed");]]></value>
</code>
</step>
@@ -427,9 +427,9 @@ test_assert(result == false, "ready list check failed");]]></value> <value />
</tags>
<code>
- <value><![CDATA[chSysLock(); -result = chSysIntegrityCheckI(CH_INTEGRITY_VTLIST); -chSysUnlock(); + <value><![CDATA[chSysLock();
+result = chSysIntegrityCheckI(CH_INTEGRITY_VTLIST);
+chSysUnlock();
test_assert(result == false, "virtual timers list check failed");]]></value>
</code>
</step>
@@ -441,9 +441,9 @@ test_assert(result == false, "virtual timers list check failed");]]></value> <value />
</tags>
<code>
- <value><![CDATA[chSysLock(); -result = chSysIntegrityCheckI(CH_INTEGRITY_REGISTRY); -chSysUnlock(); + <value><![CDATA[chSysLock();
+result = chSysIntegrityCheckI(CH_INTEGRITY_REGISTRY);
+chSysUnlock();
test_assert(result == false, "registry list check failed");]]></value>
</code>
</step>
@@ -455,9 +455,9 @@ test_assert(result == false, "registry list check failed");]]></value> <value />
</tags>
<code>
- <value><![CDATA[chSysLock(); -result = chSysIntegrityCheckI(CH_INTEGRITY_PORT); -chSysUnlock(); + <value><![CDATA[chSysLock();
+result = chSysIntegrityCheckI(CH_INTEGRITY_PORT);
+chSysUnlock();
test_assert(result == false, "port layer check failed");]]></value>
</code>
</step>
@@ -481,7 +481,7 @@ test_assert(result == false, "port layer check failed");]]></value> <value />
</teardown_code>
<local_variables>
- <value><![CDATA[syssts_t sts; + <value><![CDATA[syssts_t sts;
virtual_timer_t vt;]]></value>
</local_variables>
</various_code>
@@ -494,7 +494,7 @@ virtual_timer_t vt;]]></value> <value />
</tags>
<code>
- <value><![CDATA[sts = chSysGetStatusAndLockX(); + <value><![CDATA[sts = chSysGetStatusAndLockX();
chSysRestoreStatusX(sts);]]></value>
</code>
</step>
@@ -506,9 +506,9 @@ chSysRestoreStatusX(sts);]]></value> <value />
</tags>
<code>
- <value><![CDATA[chSysLock(); -sts = chSysGetStatusAndLockX(); -chSysRestoreStatusX(sts); + <value><![CDATA[chSysLock();
+sts = chSysGetStatusAndLockX();
+chSysRestoreStatusX(sts);
chSysUnlock();]]></value>
</code>
</step>
@@ -520,8 +520,8 @@ chSysUnlock();]]></value> <value />
</tags>
<code>
- <value><![CDATA[chSysUnconditionalLock(); -chSysUnconditionalLock(); + <value><![CDATA[chSysUnconditionalLock();
+chSysUnconditionalLock();
chSysUnlock();]]></value>
</code>
</step>
@@ -533,8 +533,8 @@ chSysUnlock();]]></value> <value />
</tags>
<code>
- <value><![CDATA[chSysLock(); -chSysUnconditionalUnlock(); + <value><![CDATA[chSysLock();
+chSysUnconditionalUnlock();
chSysUnconditionalUnlock();]]></value>
</code>
</step>
@@ -546,10 +546,10 @@ chSysUnconditionalUnlock();]]></value> <value />
</tags>
<code>
- <value><![CDATA[chVTObjectInit(&vt); -chVTSet(&vt, 1, vtcb, NULL); -chThdSleep(10); - + <value><![CDATA[chVTObjectInit(&vt);
+chVTSet(&vt, 1, vtcb, NULL);
+chThdSleep(10);
+
test_assert(chVTIsArmed(&vt) == false, "timer still armed");]]></value>
</code>
</step>
@@ -585,9 +585,9 @@ test_assert(chVTIsArmed(&vt) == false, "timer still armed");]]></value> <value />
</tags>
<code>
- <value><![CDATA[chSysSuspend(); -chSysDisable(); -chSysSuspend(); + <value><![CDATA[chSysSuspend();
+chSysDisable();
+chSysSuspend();
chSysEnable();]]></value>
</code>
</step>
@@ -623,11 +623,11 @@ chSysEnable();]]></value> <value />
</tags>
<code>
- <value><![CDATA[systime_t time = chVTGetSystemTimeX(); -while (time == chVTGetSystemTimeX()) { -#if defined(SIMULATOR) - _sim_check_for_interrupts(); -#endif + <value><![CDATA[systime_t time = chVTGetSystemTimeX();
+while (time == chVTGetSystemTimeX()) {
+#if defined(SIMULATOR)
+ _sim_check_for_interrupts();
+#endif
}]]></value>
</code>
</step>
@@ -649,9 +649,9 @@ while (time == chVTGetSystemTimeX()) { <value />
</condition>
<shared_code>
- <value><![CDATA[static THD_FUNCTION(thread, p) { - - test_emit_token(*(char *)p); + <value><![CDATA[static THD_FUNCTION(thread, p) {
+
+ test_emit_token(*(char *)p);
}]]></value>
</shared_code>
<cases>
@@ -685,10 +685,10 @@ while (time == chVTGetSystemTimeX()) { <value />
</tags>
<code>
- <value><![CDATA[time = chVTGetSystemTimeX(); -chThdSleep(100); -test_assert_time_window(time + 100, - time + 100 + CH_CFG_ST_TIMEDELTA + 1, + <value><![CDATA[time = chVTGetSystemTimeX();
+chThdSleep(100);
+test_assert_time_window(time + 100,
+ time + 100 + CH_CFG_ST_TIMEDELTA + 1,
"out of time window");]]></value>
</code>
</step>
@@ -700,10 +700,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) + CH_CFG_ST_TIMEDELTA + 1, + <value><![CDATA[time = chVTGetSystemTimeX();
+chThdSleepMicroseconds(100000);
+test_assert_time_window(time + US2ST(100000),
+ time + US2ST(100000) + CH_CFG_ST_TIMEDELTA + 1,
"out of time window");]]></value>
</code>
</step>
@@ -715,10 +715,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) + CH_CFG_ST_TIMEDELTA + 1, + <value><![CDATA[time = chVTGetSystemTimeX();
+chThdSleepMilliseconds(100);
+test_assert_time_window(time + MS2ST(100),
+ time + MS2ST(100) + CH_CFG_ST_TIMEDELTA + 1,
"out of time window");]]></value>
</code>
</step>
@@ -730,10 +730,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) + CH_CFG_ST_TIMEDELTA + 1, + <value><![CDATA[time = chVTGetSystemTimeX();
+chThdSleepSeconds(1);
+test_assert_time_window(time + S2ST(1),
+ time + S2ST(1) + CH_CFG_ST_TIMEDELTA + 1,
"out of time window");]]></value>
</code>
</step>
@@ -745,10 +745,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 + CH_CFG_ST_TIMEDELTA + 1, + <value><![CDATA[time = chVTGetSystemTimeX();
+chThdSleepUntil(time + 100);
+test_assert_time_window(time + 100,
+ time + 100 + CH_CFG_ST_TIMEDELTA + 1,
"out of time window");]]></value>
</code>
</step>
@@ -784,12 +784,12 @@ test_assert_time_window(time + 100, <value />
</tags>
<code>
- <value><![CDATA[threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX()-5, thread, "E"); -threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriorityX()-4, thread, "D"); -threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriorityX()-3, thread, "C"); -threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriorityX()-2, thread, "B"); -threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriorityX()-1, thread, "A"); -test_wait_threads(); + <value><![CDATA[threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX()-5, thread, "E");
+threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriorityX()-4, thread, "D");
+threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriorityX()-3, thread, "C");
+threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriorityX()-2, thread, "B");
+threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriorityX()-1, thread, "A");
+test_wait_threads();
test_assert_sequence("ABCDE", "invalid sequence");]]></value>
</code>
</step>
@@ -801,12 +801,12 @@ test_assert_sequence("ABCDE", "invalid sequence");]]></value> <value />
</tags>
<code>
- <value><![CDATA[threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriorityX()-1, thread, "A"); -threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriorityX()-2, thread, "B"); -threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriorityX()-3, thread, "C"); -threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriorityX()-4, thread, "D"); -threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX()-5, thread, "E"); -test_wait_threads(); + <value><![CDATA[threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriorityX()-1, thread, "A");
+threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriorityX()-2, thread, "B");
+threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriorityX()-3, thread, "C");
+threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriorityX()-4, thread, "D");
+threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX()-5, thread, "E");
+test_wait_threads();
test_assert_sequence("ABCDE", "invalid sequence");]]></value>
</code>
</step>
@@ -818,12 +818,12 @@ test_assert_sequence("ABCDE", "invalid sequence");]]></value> <value />
</tags>
<code>
- <value><![CDATA[threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriorityX()-4, thread, "D"); -threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX()-5, thread, "E"); -threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriorityX()-1, thread, "A"); -threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriorityX()-2, thread, "B"); -threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriorityX()-3, thread, "C"); -test_wait_threads(); + <value><![CDATA[threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriorityX()-4, thread, "D");
+threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX()-5, thread, "E");
+threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriorityX()-1, thread, "A");
+threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriorityX()-2, thread, "B");
+threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriorityX()-3, thread, "C");
+test_wait_threads();
test_assert_sequence("ABCDE", "invalid sequence");]]></value>
</code>
</step>
@@ -859,9 +859,9 @@ test_assert_sequence("ABCDE", "invalid sequence");]]></value> <value />
</tags>
<code>
- <value><![CDATA[prio = chThdGetPriorityX(); -p1 = chThdSetPriority(prio + 1); -test_assert(p1 == prio, "unexpected returned priority level"); + <value><![CDATA[prio = chThdGetPriorityX();
+p1 = chThdSetPriority(prio + 1);
+test_assert(p1 == prio, "unexpected returned priority level");
test_assert(chThdGetPriorityX() == prio + 1, "unexpected priority level");]]></value>
</code>
</step>
@@ -873,8 +873,8 @@ test_assert(chThdGetPriorityX() == prio + 1, "unexpected priority level");]]></v <value />
</tags>
<code>
- <value><![CDATA[p1 = chThdSetPriority(p1); -test_assert(p1 == prio + 1, "unexpected returned priority level"); + <value><![CDATA[p1 = chThdSetPriority(p1);
+test_assert(p1 == prio + 1, "unexpected returned priority level");
test_assert(chThdGetPriorityX() == prio, "unexpected priority level");]]></value>
</code>
</step>
@@ -910,8 +910,8 @@ test_assert(chThdGetPriorityX() == prio, "unexpected priority level");]]></value <value />
</tags>
<code>
- <value><![CDATA[prio = chThdGetPriorityX(); -chThdGetSelfX()->prio += 2; + <value><![CDATA[prio = chThdGetPriorityX();
+chThdGetSelfX()->prio += 2;
test_assert(chThdGetPriorityX() == prio + 2, "unexpected priority level");]]></value>
</code>
</step>
@@ -923,9 +923,9 @@ test_assert(chThdGetPriorityX() == prio + 2, "unexpected priority level");]]></v <value />
</tags>
<code>
- <value><![CDATA[p1 = chThdSetPriority(prio + 1); -test_assert(p1 == prio, "unexpected returned priority level"); -test_assert(chThdGetSelfX()->prio == prio + 2, "unexpected priority level"); + <value><![CDATA[p1 = chThdSetPriority(prio + 1);
+test_assert(p1 == prio, "unexpected returned priority level");
+test_assert(chThdGetSelfX()->prio == prio + 2, "unexpected priority level");
test_assert(chThdGetSelfX()->realprio == prio + 1, "unexpected returned real priority level");]]></value>
</code>
</step>
@@ -937,9 +937,9 @@ test_assert(chThdGetSelfX()->realprio == prio + 1, "unexpected returned real pri <value />
</tags>
<code>
- <value><![CDATA[p1 = chThdSetPriority(prio + 3); -test_assert(p1 == prio + 1, "unexpected returned priority level"); -test_assert(chThdGetSelfX()->prio == prio + 3, "unexpected priority level"); + <value><![CDATA[p1 = chThdSetPriority(prio + 3);
+test_assert(p1 == prio + 1, "unexpected returned priority level");
+test_assert(chThdGetSelfX()->prio == prio + 3, "unexpected priority level");
test_assert(chThdGetSelfX()->realprio == prio + 3, "unexpected real priority level");]]></value>
</code>
</step>
@@ -951,9 +951,9 @@ test_assert(chThdGetSelfX()->realprio == prio + 3, "unexpected real priority lev <value />
</tags>
<code>
- <value><![CDATA[chSysLock(); -chThdGetSelfX()->prio = prio; -chThdGetSelfX()->realprio = prio; + <value><![CDATA[chSysLock();
+chThdGetSelfX()->prio = prio;
+chThdGetSelfX()->realprio = prio;
chSysUnlock();]]></value>
</code>
</step>
@@ -975,15 +975,15 @@ chSysUnlock();]]></value> <value />
</condition>
<shared_code>
- <value><![CDATA[static thread_reference_t tr1; - -static THD_FUNCTION(thread1, p) { - - chSysLock(); - chThdResumeI(&tr1, MSG_OK); - chSchRescheduleS(); - chSysUnlock(); - test_emit_token(*(char *)p); + <value><![CDATA[static thread_reference_t tr1;
+
+static THD_FUNCTION(thread1, p) {
+
+ chSysLock();
+ chThdResumeI(&tr1, MSG_OK);
+ chSchRescheduleS();
+ chSysUnlock();
+ test_emit_token(*(char *)p);
}]]></value>
</shared_code>
<cases>
@@ -1005,7 +1005,7 @@ static THD_FUNCTION(thread1, p) { <value />
</teardown_code>
<local_variables>
- <value><![CDATA[systime_t time; + <value><![CDATA[systime_t time;
msg_t msg;]]></value>
</local_variables>
</various_code>
@@ -1018,12 +1018,12 @@ msg_t msg;]]></value> <value />
</tags>
<code>
- <value><![CDATA[threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX()-1, thread1, "A"); -chSysLock(); -msg = chThdSuspendTimeoutS(&tr1, TIME_INFINITE); -chSysUnlock(); -test_assert(NULL == tr1, "not NULL"); -test_assert(MSG_OK == msg,"wrong returned message"); + <value><![CDATA[threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX()-1, thread1, "A");
+chSysLock();
+msg = chThdSuspendTimeoutS(&tr1, TIME_INFINITE);
+chSysUnlock();
+test_assert(NULL == tr1, "not NULL");
+test_assert(MSG_OK == msg,"wrong returned message");
test_wait_threads();]]></value>
</code>
</step>
@@ -1035,14 +1035,14 @@ test_wait_threads();]]></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) + CH_CFG_ST_TIMEDELTA + 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) + CH_CFG_ST_TIMEDELTA + 1,
+ "out of time window");
+test_assert(NULL == tr1, "not NULL");
test_assert(MSG_TIMEOUT == msg, "wrong returned message");]]></value>
</code>
</step>
@@ -1064,36 +1064,36 @@ test_assert(MSG_TIMEOUT == msg, "wrong returned message");]]></value> <value>CH_CFG_USE_SEMAPHORES</value>
</condition>
<shared_code>
- <value><![CDATA[#include "ch.h" - -static semaphore_t sem1; - -static THD_FUNCTION(thread1, p) { - - chSemWait(&sem1); - test_emit_token(*(char *)p); -} - -static THD_FUNCTION(thread2, p) { - - (void)p; - chThdSleepMilliseconds(50); - chSysLock(); - chSemSignalI(&sem1); /* For coverage reasons */ - chSchRescheduleS(); - chSysUnlock(); -} - -static THD_FUNCTION(thread3, p) { - - (void)p; - chSemWait(&sem1); - chSemSignal(&sem1); -} - -static THD_FUNCTION(thread4, p) { - - chBSemSignal((binary_semaphore_t *)p); + <value><![CDATA[#include "ch.h"
+
+static semaphore_t sem1;
+
+static THD_FUNCTION(thread1, p) {
+
+ chSemWait(&sem1);
+ test_emit_token(*(char *)p);
+}
+
+static THD_FUNCTION(thread2, p) {
+
+ (void)p;
+ chThdSleepMilliseconds(50);
+ chSysLock();
+ chSemSignalI(&sem1); /* For coverage reasons */
+ chSchRescheduleS();
+ chSysUnlock();
+}
+
+static THD_FUNCTION(thread3, p) {
+
+ (void)p;
+ chSemWait(&sem1);
+ chSemSignal(&sem1);
+}
+
+static THD_FUNCTION(thread4, p) {
+
+ chBSemSignal((binary_semaphore_t *)p);
}]]></value>
</shared_code>
<cases>
@@ -1127,10 +1127,10 @@ static THD_FUNCTION(thread4, p) { <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>
@@ -1142,7 +1142,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>
@@ -1154,7 +1154,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>
@@ -1190,10 +1190,10 @@ test_assert_lock(chSemGetCounterI(&sem1) == 2, "wrong counter value");]]></value <value />
</tags>
<code>
- <value><![CDATA[threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX()+5, thread1, "A"); -threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriorityX()+1, thread1, "B"); -threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriorityX()+3, thread1, "C"); -threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriorityX()+4, thread1, "D"); + <value><![CDATA[threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX()+5, thread1, "A");
+threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriorityX()+1, thread1, "B");
+threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriorityX()+3, thread1, "C");
+threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriorityX()+4, thread1, "D");
threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriorityX()+2, thread1, "E");]]></value>
</code>
</step>
@@ -1205,16 +1205,16 @@ threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriorityX()+2, thread1, " <value />
</tags>
<code>
- <value><![CDATA[chSemSignal(&sem1); -chSemSignal(&sem1); -chSemSignal(&sem1); -chSemSignal(&sem1); -chSemSignal(&sem1); -test_wait_threads(); -#if CH_CFG_USE_SEMAPHORES_PRIORITY -test_assert_sequence("ADCEB", "invalid sequence"); -#else -test_assert_sequence("ABCDE", "invalid sequence"); + <value><![CDATA[chSemSignal(&sem1);
+chSemSignal(&sem1);
+chSemSignal(&sem1);
+chSemSignal(&sem1);
+chSemSignal(&sem1);
+test_wait_threads();
+#if CH_CFG_USE_SEMAPHORES_PRIORITY
+test_assert_sequence("ADCEB", "invalid sequence");
+#else
+test_assert_sequence("ABCDE", "invalid sequence");
#endif]]></value>
</code>
</step>
@@ -1238,8 +1238,8 @@ test_assert_sequence("ABCDE", "invalid sequence"); <value />
</teardown_code>
<local_variables>
- <value><![CDATA[unsigned i; -systime_t target_time; + <value><![CDATA[unsigned i;
+systime_t target_time;
msg_t msg;]]></value>
</local_variables>
</various_code>
@@ -1252,9 +1252,9 @@ msg_t msg;]]></value> <value />
</tags>
<code>
- <value><![CDATA[msg = chSemWaitTimeout(&sem1, TIME_IMMEDIATE); -test_assert(msg == MSG_TIMEOUT, "wrong wake-up message"); -test_assert(queue_isempty(&sem1.queue), "queue not empty"); + <value><![CDATA[msg = chSemWaitTimeout(&sem1, TIME_IMMEDIATE);
+test_assert(msg == MSG_TIMEOUT, "wrong wake-up message");
+test_assert(queue_isempty(&sem1.queue), "queue not empty");
test_assert(sem1.cnt == 0, "counter not zero");]]></value>
</code>
</step>
@@ -1266,12 +1266,12 @@ test_assert(sem1.cnt == 0, "counter not zero");]]></value> <value />
</tags>
<code>
- <value><![CDATA[threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX() - 1, - thread2, 0); -msg = chSemWaitTimeout(&sem1, MS2ST(500)); -test_wait_threads(); -test_assert(msg == MSG_OK, "wrong wake-up message"); -test_assert(queue_isempty(&sem1.queue), "queue not empty"); + <value><![CDATA[threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX() - 1,
+ thread2, 0);
+msg = chSemWaitTimeout(&sem1, MS2ST(500));
+test_wait_threads();
+test_assert(msg == MSG_OK, "wrong wake-up message");
+test_assert(queue_isempty(&sem1.queue), "queue not empty");
test_assert(sem1.cnt == 0, "counter not zero");]]></value>
</code>
</step>
@@ -1283,16 +1283,16 @@ test_assert(sem1.cnt == 0, "counter not zero");]]></value> <value />
</tags>
<code>
- <value><![CDATA[target_time = test_wait_tick() + MS2ST(5 * 50); -for (i = 0; i < 5; i++) { - test_emit_token('A' + i); - msg = chSemWaitTimeout(&sem1, MS2ST(50)); - test_assert(msg == MSG_TIMEOUT, "wrong wake-up message"); - test_assert(queue_isempty(&sem1.queue), "queue not empty"); - test_assert(sem1.cnt == 0, "counter not zero"); -} -test_assert_sequence("ABCDE", "invalid sequence"); -test_assert_time_window(target_time, target_time + ALLOWED_DELAY, + <value><![CDATA[target_time = test_wait_tick() + MS2ST(5 * 50);
+for (i = 0; i < 5; i++) {
+ test_emit_token('A' + i);
+ msg = chSemWaitTimeout(&sem1, MS2ST(50));
+ test_assert(msg == MSG_TIMEOUT, "wrong wake-up message");
+ test_assert(queue_isempty(&sem1.queue), "queue not empty");
+ test_assert(sem1.cnt == 0, "counter not zero");
+}
+test_assert_sequence("ABCDE", "invalid sequence");
+test_assert_time_window(target_time, target_time + ALLOWED_DELAY,
"out of time window");]]></value>
</code>
</step>
@@ -1339,12 +1339,12 @@ test_assert_time_window(target_time, target_time + ALLOWED_DELAY, <value />
</tags>
<code>
- <value><![CDATA[chSysLock(); -chSemAddCounterI(&sem1, 2); -chSchRescheduleS(); -chSysUnlock(); -test_wait_threads(); -test_assert_lock(chSemGetCounterI(&sem1) == 1, "invalid counter"); + <value><![CDATA[chSysLock();
+chSemAddCounterI(&sem1, 2);
+chSchRescheduleS();
+chSysUnlock();
+test_wait_threads();
+test_assert_lock(chSemGetCounterI(&sem1) == 1, "invalid counter");
test_assert_sequence("A", "invalid sequence");]]></value>
</code>
</step>
@@ -1391,8 +1391,8 @@ test_assert_sequence("A", "invalid sequence");]]></value> <value />
</tags>
<code>
- <value><![CDATA[chSemSignalWait(&sem1, &sem1); -test_assert(queue_isempty(&sem1.queue), "queue not empty"); + <value><![CDATA[chSemSignalWait(&sem1, &sem1);
+test_assert(queue_isempty(&sem1.queue), "queue not empty");
test_assert(sem1.cnt == 0, "counter not zero");]]></value>
</code>
</step>
@@ -1404,8 +1404,8 @@ test_assert(sem1.cnt == 0, "counter not zero");]]></value> <value />
</tags>
<code>
- <value><![CDATA[chSemSignalWait(&sem1, &sem1); -test_assert(queue_isempty(&sem1.queue), "queue not empty"); + <value><![CDATA[chSemSignalWait(&sem1, &sem1);
+test_assert(queue_isempty(&sem1.queue), "queue not empty");
test_assert(sem1.cnt == 0, "counter not zero");]]></value>
</code>
</step>
@@ -1429,7 +1429,7 @@ test_assert(sem1.cnt == 0, "counter not zero");]]></value> <value><![CDATA[test_wait_threads();]]></value>
</teardown_code>
<local_variables>
- <value><![CDATA[binary_semaphore_t bsem; + <value><![CDATA[binary_semaphore_t bsem;
msg_t msg;]]></value>
</local_variables>
</various_code>
@@ -1442,7 +1442,7 @@ msg_t msg;]]></value> <value />
</tags>
<code>
- <value><![CDATA[chBSemObjectInit(&bsem, true); + <value><![CDATA[chBSemObjectInit(&bsem, true);
test_assert_lock(chBSemGetStateI(&bsem) == true, "not taken");]]></value>
</code>
</step>
@@ -1454,7 +1454,7 @@ test_assert_lock(chBSemGetStateI(&bsem) == true, "not taken");]]></value> <value />
</tags>
<code>
- <value><![CDATA[chBSemReset(&bsem, true); + <value><![CDATA[chBSemReset(&bsem, true);
test_assert_lock(chBSemGetStateI(&bsem) == true, "not taken");]]></value>
</code>
</step>
@@ -1466,7 +1466,7 @@ test_assert_lock(chBSemGetStateI(&bsem) == true, "not taken");]]></value> <value />
</tags>
<code>
- <value><![CDATA[threads[0] = chThdCreateStatic(wa[0], WA_SIZE, + <value><![CDATA[threads[0] = chThdCreateStatic(wa[0], WA_SIZE,
chThdGetPriorityX()-1, thread4, &bsem);]]></value>
</code>
</step>
@@ -1478,8 +1478,8 @@ test_assert_lock(chBSemGetStateI(&bsem) == true, "not taken");]]></value> <value />
</tags>
<code>
- <value><![CDATA[msg = chBSemWait(&bsem); -test_assert_lock(chBSemGetStateI(&bsem) == true, "not taken"); + <value><![CDATA[msg = chBSemWait(&bsem);
+test_assert_lock(chBSemGetStateI(&bsem) == true, "not taken");
test_assert(msg == MSG_OK, "unexpected message");]]></value>
</code>
</step>
@@ -1491,8 +1491,8 @@ test_assert(msg == MSG_OK, "unexpected message");]]></value> <value />
</tags>
<code>
- <value><![CDATA[chBSemSignal(&bsem); -test_assert_lock(chBSemGetStateI(&bsem) ==false, "still taken"); + <value><![CDATA[chBSemSignal(&bsem);
+test_assert_lock(chBSemGetStateI(&bsem) ==false, "still taken");
test_assert_lock(chSemGetCounterI(&bsem.sem) == 1, "unexpected counter");]]></value>
</code>
</step>
@@ -1504,8 +1504,8 @@ test_assert_lock(chSemGetCounterI(&bsem.sem) == 1, "unexpected counter");]]></va <value />
</tags>
<code>
- <value><![CDATA[chBSemSignal(&bsem); -test_assert_lock(chBSemGetStateI(&bsem) == false, "taken"); + <value><![CDATA[chBSemSignal(&bsem);
+test_assert_lock(chBSemGetStateI(&bsem) == false, "taken");
test_assert_lock(chSemGetCounterI(&bsem.sem) == 1, "unexpected counter");]]></value>
</code>
</step>
@@ -1527,178 +1527,178 @@ test_assert_lock(chSemGetCounterI(&bsem.sem) == 1, "unexpected counter");]]></va <value>CH_CFG_USE_MUTEXES</value>
</condition>
<shared_code>
- <value><![CDATA[static MUTEX_DECL(m1); -static MUTEX_DECL(m2); -#if CH_CFG_USE_CONDVARS || defined(__DOXYGEN__) -static CONDVAR_DECL(c1); -#endif - -#if CH_DBG_THREADS_PROFILING || defined(__DOXYGEN__) -/** - * @brief CPU pulse. - * @note The current implementation is not totally reliable. - * - * @param[in] duration CPU pulse duration in milliseconds - */ -void test_cpu_pulse(unsigned duration) { - systime_t start, end, now; - - start = chThdGetTicksX(chThdGetSelfX()); - end = start + MS2ST(duration); - do { - now = chThdGetTicksX(chThdGetSelfX()); -#if defined(SIMULATOR) - _sim_check_for_interrupts(); -#endif - } - while (chVTIsTimeWithinX(now, start, end)); -} -#endif /* CH_DBG_THREADS_PROFILING */ - -static THD_FUNCTION(thread1, p) { - - chMtxLock(&m1); - test_emit_token(*(char *)p); - chMtxUnlock(&m1); -} - -#if CH_DBG_THREADS_PROFILING || defined(__DOXYGEN__) -/* Low priority thread */ -static THD_FUNCTION(thread2L, p) { - - (void)p; - chMtxLock(&m1); - test_cpu_pulse(40); - chMtxUnlock(&m1); - test_cpu_pulse(10); - test_emit_token('C'); -} - -/* Medium priority thread */ -static THD_FUNCTION(thread2M, p) { - - (void)p; - chThdSleepMilliseconds(20); - test_cpu_pulse(40); - test_emit_token('B'); -} - -/* High priority thread */ -static THD_FUNCTION(thread2H, p) { - - (void)p; - chThdSleepMilliseconds(40); - chMtxLock(&m1); - test_cpu_pulse(10); - chMtxUnlock(&m1); - test_emit_token('A'); -} - -/* Lowest priority thread */ -static THD_FUNCTION(thread3LL, p) { - - (void)p; - chMtxLock(&m1); - test_cpu_pulse(30); - chMtxUnlock(&m1); - test_emit_token('E'); -} - -/* Low priority thread */ -static THD_FUNCTION(thread3L, p) { - - (void)p; - chThdSleepMilliseconds(10); - chMtxLock(&m2); - test_cpu_pulse(20); - chMtxLock(&m1); - test_cpu_pulse(10); - chMtxUnlock(&m1); - test_cpu_pulse(10); - chMtxUnlock(&m2); - test_emit_token('D'); -} - -/* Medium priority thread */ -static THD_FUNCTION(thread3M, p) { - - (void)p; - chThdSleepMilliseconds(20); - chMtxLock(&m2); - test_cpu_pulse(10); - chMtxUnlock(&m2); - test_emit_token('C'); -} - -/* High priority thread */ -static THD_FUNCTION(thread3H, p) { - - (void)p; - chThdSleepMilliseconds(40); - test_cpu_pulse(20); - test_emit_token('B'); -} - -/* Highest priority thread */ -static THD_FUNCTION(thread3HH, p) { - - (void)p; - chThdSleepMilliseconds(50); - chMtxLock(&m2); - test_cpu_pulse(10); - chMtxUnlock(&m2); - test_emit_token('A'); -} -#endif /* CH_DBG_THREADS_PROFILING */ - -static THD_FUNCTION(thread4A, p) { - - (void)p; - chThdSleepMilliseconds(50); - chMtxLock(&m1); - chMtxUnlock(&m1); -} - -static THD_FUNCTION(thread4B, p) { - - (void)p; - chThdSleepMilliseconds(150); - chSysLock(); - chMtxLockS(&m2); /* For coverage of the chMtxLockS() function variant.*/ - chMtxUnlockS(&m2); /* For coverage of the chMtxUnlockS() function variant.*/ - chSchRescheduleS(); - chSysUnlock(); -} - -#if CH_CFG_USE_CONDVARS || defined(__DOXYGEN__) -static THD_FUNCTION(thread6, p) { - - chMtxLock(&m1); - chCondWait(&c1); - test_emit_token(*(char *)p); - chMtxUnlock(&m1); -} - -static THD_FUNCTION(thread8, p) { - - chMtxLock(&m2); - chMtxLock(&m1); -#if CH_CFG_USE_CONDVARS_TIMEOUT || defined(__DOXYGEN__) - chCondWaitTimeout(&c1, TIME_INFINITE); -#else - chCondWait(&c1); -#endif - test_emit_token(*(char *)p); - chMtxUnlock(&m1); - chMtxUnlock(&m2); -} - -static THD_FUNCTION(thread9, p) { - - chMtxLock(&m2); - test_emit_token(*(char *)p); - chMtxUnlock(&m2); -} + <value><![CDATA[static MUTEX_DECL(m1);
+static MUTEX_DECL(m2);
+#if CH_CFG_USE_CONDVARS || defined(__DOXYGEN__)
+static CONDVAR_DECL(c1);
+#endif
+
+#if CH_DBG_THREADS_PROFILING || defined(__DOXYGEN__)
+/**
+ * @brief CPU pulse.
+ * @note The current implementation is not totally reliable.
+ *
+ * @param[in] duration CPU pulse duration in milliseconds
+ */
+void test_cpu_pulse(unsigned duration) {
+ systime_t start, end, now;
+
+ start = chThdGetTicksX(chThdGetSelfX());
+ end = start + MS2ST(duration);
+ do {
+ now = chThdGetTicksX(chThdGetSelfX());
+#if defined(SIMULATOR)
+ _sim_check_for_interrupts();
+#endif
+ }
+ while (chVTIsTimeWithinX(now, start, end));
+}
+#endif /* CH_DBG_THREADS_PROFILING */
+
+static THD_FUNCTION(thread1, p) {
+
+ chMtxLock(&m1);
+ test_emit_token(*(char *)p);
+ chMtxUnlock(&m1);
+}
+
+#if CH_DBG_THREADS_PROFILING || defined(__DOXYGEN__)
+/* Low priority thread */
+static THD_FUNCTION(thread2L, p) {
+
+ (void)p;
+ chMtxLock(&m1);
+ test_cpu_pulse(40);
+ chMtxUnlock(&m1);
+ test_cpu_pulse(10);
+ test_emit_token('C');
+}
+
+/* Medium priority thread */
+static THD_FUNCTION(thread2M, p) {
+
+ (void)p;
+ chThdSleepMilliseconds(20);
+ test_cpu_pulse(40);
+ test_emit_token('B');
+}
+
+/* High priority thread */
+static THD_FUNCTION(thread2H, p) {
+
+ (void)p;
+ chThdSleepMilliseconds(40);
+ chMtxLock(&m1);
+ test_cpu_pulse(10);
+ chMtxUnlock(&m1);
+ test_emit_token('A');
+}
+
+/* Lowest priority thread */
+static THD_FUNCTION(thread3LL, p) {
+
+ (void)p;
+ chMtxLock(&m1);
+ test_cpu_pulse(30);
+ chMtxUnlock(&m1);
+ test_emit_token('E');
+}
+
+/* Low priority thread */
+static THD_FUNCTION(thread3L, p) {
+
+ (void)p;
+ chThdSleepMilliseconds(10);
+ chMtxLock(&m2);
+ test_cpu_pulse(20);
+ chMtxLock(&m1);
+ test_cpu_pulse(10);
+ chMtxUnlock(&m1);
+ test_cpu_pulse(10);
+ chMtxUnlock(&m2);
+ test_emit_token('D');
+}
+
+/* Medium priority thread */
+static THD_FUNCTION(thread3M, p) {
+
+ (void)p;
+ chThdSleepMilliseconds(20);
+ chMtxLock(&m2);
+ test_cpu_pulse(10);
+ chMtxUnlock(&m2);
+ test_emit_token('C');
+}
+
+/* High priority thread */
+static THD_FUNCTION(thread3H, p) {
+
+ (void)p;
+ chThdSleepMilliseconds(40);
+ test_cpu_pulse(20);
+ test_emit_token('B');
+}
+
+/* Highest priority thread */
+static THD_FUNCTION(thread3HH, p) {
+
+ (void)p;
+ chThdSleepMilliseconds(50);
+ chMtxLock(&m2);
+ test_cpu_pulse(10);
+ chMtxUnlock(&m2);
+ test_emit_token('A');
+}
+#endif /* CH_DBG_THREADS_PROFILING */
+
+static THD_FUNCTION(thread4A, p) {
+
+ (void)p;
+ chThdSleepMilliseconds(50);
+ chMtxLock(&m1);
+ chMtxUnlock(&m1);
+}
+
+static THD_FUNCTION(thread4B, p) {
+
+ (void)p;
+ chThdSleepMilliseconds(150);
+ chSysLock();
+ chMtxLockS(&m2); /* For coverage of the chMtxLockS() function variant.*/
+ chMtxUnlockS(&m2); /* For coverage of the chMtxUnlockS() function variant.*/
+ chSchRescheduleS();
+ chSysUnlock();
+}
+
+#if CH_CFG_USE_CONDVARS || defined(__DOXYGEN__)
+static THD_FUNCTION(thread6, p) {
+
+ chMtxLock(&m1);
+ chCondWait(&c1);
+ test_emit_token(*(char *)p);
+ chMtxUnlock(&m1);
+}
+
+static THD_FUNCTION(thread8, p) {
+
+ chMtxLock(&m2);
+ chMtxLock(&m1);
+#if CH_CFG_USE_CONDVARS_TIMEOUT || defined(__DOXYGEN__)
+ chCondWaitTimeout(&c1, TIME_INFINITE);
+#else
+ chCondWait(&c1);
+#endif
+ test_emit_token(*(char *)p);
+ chMtxUnlock(&m1);
+ chMtxUnlock(&m2);
+}
+
+static THD_FUNCTION(thread9, p) {
+
+ chMtxLock(&m2);
+ test_emit_token(*(char *)p);
+ chMtxUnlock(&m2);
+}
#endif /* CH_CFG_USE_CONDVARS */]]></value>
</shared_code>
<cases>
@@ -1754,10 +1754,10 @@ static THD_FUNCTION(thread9, p) { <value />
</tags>
<code>
- <value><![CDATA[threads[0] = chThdCreateStatic(wa[0], WA_SIZE, prio+1, thread1, "E"); -threads[1] = chThdCreateStatic(wa[1], WA_SIZE, prio+2, thread1, "D"); -threads[2] = chThdCreateStatic(wa[2], WA_SIZE, prio+3, thread1, "C"); -threads[3] = chThdCreateStatic(wa[3], WA_SIZE, prio+4, thread1, "B"); + <value><![CDATA[threads[0] = chThdCreateStatic(wa[0], WA_SIZE, prio+1, thread1, "E");
+threads[1] = chThdCreateStatic(wa[1], WA_SIZE, prio+2, thread1, "D");
+threads[2] = chThdCreateStatic(wa[2], WA_SIZE, prio+3, thread1, "C");
+threads[3] = chThdCreateStatic(wa[3], WA_SIZE, prio+4, thread1, "B");
threads[4] = chThdCreateStatic(wa[4], WA_SIZE, prio+5, thread1, "A");]]></value>
</code>
</step>
@@ -1769,9 +1769,9 @@ threads[4] = chThdCreateStatic(wa[4], WA_SIZE, prio+5, thread1, "A");]]></value> <value />
</tags>
<code>
- <value><![CDATA[chMtxUnlock(&m1); -test_wait_threads(); -test_assert(prio == chThdGetPriorityX(), "wrong priority level"); + <value><![CDATA[chMtxUnlock(&m1);
+test_wait_threads();
+test_assert(prio == chThdGetPriorityX(), "wrong priority level");
test_assert_sequence("ABCDE", "invalid sequence");]]></value>
</code>
</step>
@@ -1818,10 +1818,10 @@ test_assert_sequence("ABCDE", "invalid sequence");]]></value> <value />
</tags>
<code>
- <value><![CDATA[threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX()-1, thread2H, 0); -threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriorityX()-2, thread2M, 0); -threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriorityX()-3, thread2L, 0); -test_wait_threads(); + <value><![CDATA[threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX()-1, thread2H, 0);
+threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriorityX()-2, thread2M, 0);
+threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriorityX()-3, thread2L, 0);
+test_wait_threads();
test_assert_sequence("ABC", "invalid sequence");]]></value>
</code>
</step>
@@ -1833,7 +1833,7 @@ test_assert_sequence("ABC", "invalid sequence");]]></value> <value />
</tags>
<code>
- <value><![CDATA[test_assert_time_window(time + MS2ST(100), time + MS2ST(100) + ALLOWED_DELAY, + <value><![CDATA[test_assert_time_window(time + MS2ST(100), time + MS2ST(100) + ALLOWED_DELAY,
"out of time window");]]></value>
</code>
</step>
@@ -1851,7 +1851,7 @@ test_assert_sequence("ABC", "invalid sequence");]]></value> </condition>
<various_code>
<setup_code>
- <value><![CDATA[chMtxObjectInit(&m1); /* Mutex B.*/ + <value><![CDATA[chMtxObjectInit(&m1); /* Mutex B.*/
chMtxObjectInit(&m2); /* Mutex A.*/]]></value>
</setup_code>
<teardown_code>
@@ -1881,12 +1881,12 @@ chMtxObjectInit(&m2); /* Mutex A.*/]]></value> <value />
</tags>
<code>
- <value><![CDATA[threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX()-5, thread3LL, 0); -threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriorityX()-4, thread3L, 0); -threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriorityX()-3, thread3M, 0); -threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriorityX()-2, thread3H, 0); -threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriorityX()-1, thread3HH, 0); -test_wait_threads(); + <value><![CDATA[threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX()-5, thread3LL, 0);
+threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriorityX()-4, thread3L, 0);
+threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriorityX()-3, thread3M, 0);
+threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriorityX()-2, thread3H, 0);
+threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriorityX()-1, thread3HH, 0);
+test_wait_threads();
test_assert_sequence("ABCDE", "invalid sequence");]]></value>
</code>
</step>
@@ -1898,7 +1898,7 @@ test_assert_sequence("ABCDE", "invalid sequence");]]></value> <value />
</tags>
<code>
- <value><![CDATA[test_assert_time_window(time + MS2ST(110), time + MS2ST(110) + ALLOWED_DELAY, + <value><![CDATA[test_assert_time_window(time + MS2ST(110), time + MS2ST(110) + ALLOWED_DELAY,
"out of time window");]]></value>
</code>
</step>
@@ -1917,7 +1917,7 @@ Thread A performs wait(50), lock(m1), unlock(m1), exit. Thread B performs wait(1 </condition>
<various_code>
<setup_code>
- <value><![CDATA[chMtxObjectInit(&m1); + <value><![CDATA[chMtxObjectInit(&m1);
chMtxObjectInit(&m2);]]></value>
</setup_code>
<teardown_code>
@@ -1936,8 +1936,8 @@ chMtxObjectInit(&m2);]]></value> <value />
</tags>
<code>
- <value><![CDATA[p = chThdGetPriorityX(); -pa = p + 1; + <value><![CDATA[p = chThdGetPriorityX();
+pa = p + 1;
pb = p + 2;]]></value>
</code>
</step>
@@ -1949,7 +1949,7 @@ pb = p + 2;]]></value> <value />
</tags>
<code>
- <value><![CDATA[threads[0] = chThdCreateStatic(wa[0], WA_SIZE, pa, thread4A, "A"); + <value><![CDATA[threads[0] = chThdCreateStatic(wa[0], WA_SIZE, pa, thread4A, "A");
threads[1] = chThdCreateStatic(wa[1], WA_SIZE, pb, thread4B, "B");]]></value>
</code>
</step>
@@ -1961,7 +1961,7 @@ threads[1] = chThdCreateStatic(wa[1], WA_SIZE, pb, thread4B, "B");]]></value> <value />
</tags>
<code>
- <value><![CDATA[chMtxLock(&m1); + <value><![CDATA[chMtxLock(&m1);
test_assert(chThdGetPriorityX() == p, "wrong priority level");]]></value>
</code>
</step>
@@ -1973,7 +1973,7 @@ test_assert(chThdGetPriorityX() == p, "wrong priority level");]]></value> <value />
</tags>
<code>
- <value><![CDATA[chThdSleepMilliseconds(100); + <value><![CDATA[chThdSleepMilliseconds(100);
test_assert(chThdGetPriorityX() == pa, "wrong priority level");]]></value>
</code>
</step>
@@ -1985,7 +1985,7 @@ test_assert(chThdGetPriorityX() == pa, "wrong priority level");]]></value> <value />
</tags>
<code>
- <value><![CDATA[chMtxLock(&m2); + <value><![CDATA[chMtxLock(&m2);
test_assert(chThdGetPriorityX() == pa, "wrong priority level");]]></value>
</code>
</step>
@@ -1997,7 +1997,7 @@ test_assert(chThdGetPriorityX() == pa, "wrong priority level");]]></value> <value />
</tags>
<code>
- <value><![CDATA[chThdSleepMilliseconds(100); + <value><![CDATA[chThdSleepMilliseconds(100);
test_assert(chThdGetPriorityX() == pb, "wrong priority level");]]></value>
</code>
</step>
@@ -2009,7 +2009,7 @@ test_assert(chThdGetPriorityX() == pb, "wrong priority level");]]></value> <value />
</tags>
<code>
- <value><![CDATA[chMtxUnlock(&m2); + <value><![CDATA[chMtxUnlock(&m2);
test_assert(chThdGetPriorityX() == pa, "wrong priority level");]]></value>
</code>
</step>
@@ -2021,7 +2021,7 @@ test_assert(chThdGetPriorityX() == pa, "wrong priority level");]]></value> <value />
</tags>
<code>
- <value><![CDATA[chMtxUnlock(&m1); + <value><![CDATA[chMtxUnlock(&m1);
test_assert(chThdGetPriorityX() == p, "wrong priority level");]]></value>
</code>
</step>
@@ -2045,7 +2045,7 @@ test_assert(chThdGetPriorityX() == p, "wrong priority level");]]></value> <value />
</teardown_code>
<local_variables>
- <value><![CDATA[bool b; + <value><![CDATA[bool b;
tprio_t prio;]]></value>
</local_variables>
</various_code>
@@ -2069,7 +2069,7 @@ tprio_t prio;]]></value> <value />
</tags>
<code>
- <value><![CDATA[b = chMtxTryLock(&m1); + <value><![CDATA[b = chMtxTryLock(&m1);
test_assert(b, "already locked");]]></value>
</code>
</step>
@@ -2081,7 +2081,7 @@ test_assert(b, "already locked");]]></value> <value />
</tags>
<code>
- <value><![CDATA[b = chMtxTryLock(&m1); + <value><![CDATA[b = chMtxTryLock(&m1);
test_assert(!b, "not locked");]]></value>
</code>
</step>
@@ -2093,8 +2093,8 @@ test_assert(!b, "not locked");]]></value> <value />
</tags>
<code>
- <value><![CDATA[chMtxUnlock(&m1); -test_assert(m1.owner == NULL, "still owned"); + <value><![CDATA[chMtxUnlock(&m1);
+test_assert(m1.owner == NULL, "still owned");
test_assert(queue_isempty(&m1.queue), "queue not empty");]]></value>
</code>
</step>
@@ -2117,13 +2117,13 @@ test_assert(queue_isempty(&m1.queue), "queue not empty");]]></value> <value />
</tags>
<code>
- <value><![CDATA[b = chMtxTryLock(&m1); -test_assert(b, "already locked"); -b = chMtxTryLock(&m1); -test_assert(!b, "not locked"); - -chMtxUnlockAll(); -test_assert(m1.owner == NULL, "still owned"); + <value><![CDATA[b = chMtxTryLock(&m1);
+test_assert(b, "already locked");
+b = chMtxTryLock(&m1);
+test_assert(!b, "not locked");
+
+chMtxUnlockAll();
+test_assert(m1.owner == NULL, "still owned");
test_assert(queue_isempty(&m1.queue), "queue not empty");]]></value>
</code>
</step>
@@ -2158,7 +2158,7 @@ test_assert(queue_isempty(&m1.queue), "queue not empty");]]></value> <value />
</teardown_code>
<local_variables>
- <value><![CDATA[bool b; + <value><![CDATA[bool b;
tprio_t prio;]]></value>
</local_variables>
</various_code>
@@ -2182,7 +2182,7 @@ tprio_t prio;]]></value> <value />
</tags>
<code>
- <value><![CDATA[b = chMtxTryLock(&m1); + <value><![CDATA[b = chMtxTryLock(&m1);
test_assert(b, "already locked");]]></value>
</code>
</step>
@@ -2194,7 +2194,7 @@ test_assert(b, "already locked");]]></value> <value />
</tags>
<code>
- <value><![CDATA[b = chMtxTryLock(&m1); + <value><![CDATA[b = chMtxTryLock(&m1);
test_assert(b, "already locked");]]></value>
</code>
</step>
@@ -2206,7 +2206,7 @@ test_assert(b, "already locked");]]></value> <value />
</tags>
<code>
- <value><![CDATA[chMtxUnlock(&m1); + <value><![CDATA[chMtxUnlock(&m1);
test_assert(m1.owner != NULL, "not owned");]]></value>
</code>
</step>
@@ -2218,8 +2218,8 @@ test_assert(m1.owner != NULL, "not owned");]]></value> <value />
</tags>
<code>
- <value><![CDATA[chMtxUnlock(&m1); -test_assert(m1.owner == NULL, "still owned"); + <value><![CDATA[chMtxUnlock(&m1);
+test_assert(m1.owner == NULL, "still owned");
test_assert(queue_isempty(&m1.queue), "queue not empty");]]></value>
</code>
</step>
@@ -2242,18 +2242,18 @@ test_assert(queue_isempty(&m1.queue), "queue not empty");]]></value> <value />
</tags>
<code>
- <value><![CDATA[b = chMtxTryLock(&m1); -test_assert(b, "already locked"); -chSysLock(); -b = chMtxTryLockS(&m1); -chSysUnlock(); -test_assert(b, "already locked"); -test_assert(m1.cnt == 2, "invalid recursion counter"); -chSysLock(); -chMtxUnlockAllS(); -chSysUnlock(); -test_assert(m1.owner == NULL, "still owned"); -test_assert(queue_isempty(&m1.queue), "queue not empty"); + <value><![CDATA[b = chMtxTryLock(&m1);
+test_assert(b, "already locked");
+chSysLock();
+b = chMtxTryLockS(&m1);
+chSysUnlock();
+test_assert(b, "already locked");
+test_assert(m1.cnt == 2, "invalid recursion counter");
+chSysLock();
+chMtxUnlockAllS();
+chSysUnlock();
+test_assert(m1.owner == NULL, "still owned");
+test_assert(queue_isempty(&m1.queue), "queue not empty");
test_assert(m1.cnt == 0, "invalid recursion counter");]]></value>
</code>
</step>
@@ -2265,16 +2265,16 @@ test_assert(m1.cnt == 0, "invalid recursion counter");]]></value> <value />
</tags>
<code>
- <value><![CDATA[chMtxLock(&m1); -test_assert(m1.owner != NULL, "not owned"); -chSysLock(); -chMtxLockS(&m1); -chSysUnlock(); -test_assert(m1.owner != NULL, "not owned"); -test_assert(m1.cnt == 2, "invalid recursion counter"); -chMtxUnlockAll(); -test_assert(m1.owner == NULL, "still owned"); -test_assert(queue_isempty(&m1.queue), "queue not empty"); + <value><![CDATA[chMtxLock(&m1);
+test_assert(m1.owner != NULL, "not owned");
+chSysLock();
+chMtxLockS(&m1);
+chSysUnlock();
+test_assert(m1.owner != NULL, "not owned");
+test_assert(m1.cnt == 2, "invalid recursion counter");
+chMtxUnlockAll();
+test_assert(m1.owner == NULL, "still owned");
+test_assert(queue_isempty(&m1.queue), "queue not empty");
test_assert(m1.cnt == 0, "invalid recursion counter");]]></value>
</code>
</step>
@@ -2304,7 +2304,7 @@ The test expects the threads to reach their goal in increasing priority order re </condition>
<various_code>
<setup_code>
- <value><![CDATA[chCondObjectInit(&c1); + <value><![CDATA[chCondObjectInit(&c1);
chMtxObjectInit(&m1);]]></value>
</setup_code>
<teardown_code>
@@ -2323,11 +2323,11 @@ chMtxObjectInit(&m1);]]></value> <value />
</tags>
<code>
- <value><![CDATA[tprio_t prio = chThdGetPriorityX(); -threads[0] = chThdCreateStatic(wa[0], WA_SIZE, prio+1, thread6, "E"); -threads[1] = chThdCreateStatic(wa[1], WA_SIZE, prio+2, thread6, "D"); -threads[2] = chThdCreateStatic(wa[2], WA_SIZE, prio+3, thread6, "C"); -threads[3] = chThdCreateStatic(wa[3], WA_SIZE, prio+4, thread6, "B"); + <value><![CDATA[tprio_t prio = chThdGetPriorityX();
+threads[0] = chThdCreateStatic(wa[0], WA_SIZE, prio+1, thread6, "E");
+threads[1] = chThdCreateStatic(wa[1], WA_SIZE, prio+2, thread6, "D");
+threads[2] = chThdCreateStatic(wa[2], WA_SIZE, prio+3, thread6, "C");
+threads[3] = chThdCreateStatic(wa[3], WA_SIZE, prio+4, thread6, "B");
threads[4] = chThdCreateStatic(wa[4], WA_SIZE, prio+5, thread6, "A");]]></value>
</code>
</step>
@@ -2339,15 +2339,15 @@ threads[4] = chThdCreateStatic(wa[4], WA_SIZE, prio+5, thread6, "A");]]></value> <value />
</tags>
<code>
- <value><![CDATA[chSysLock(); -chCondSignalI(&c1); -chCondSignalI(&c1); -chCondSignalI(&c1); -chCondSignalI(&c1); -chCondSignalI(&c1); -chSchRescheduleS(); -chSysUnlock(); -test_wait_threads(); + <value><![CDATA[chSysLock();
+chCondSignalI(&c1);
+chCondSignalI(&c1);
+chCondSignalI(&c1);
+chCondSignalI(&c1);
+chCondSignalI(&c1);
+chSchRescheduleS();
+chSysUnlock();
+test_wait_threads();
test_assert_sequence("ABCDE", "invalid sequence");]]></value>
</code>
</step>
@@ -2366,7 +2366,7 @@ The test expects the threads to reach their goal in increasing priority order re </condition>
<various_code>
<setup_code>
- <value><![CDATA[chCondObjectInit(&c1); + <value><![CDATA[chCondObjectInit(&c1);
chMtxObjectInit(&m1);]]></value>
</setup_code>
<teardown_code>
@@ -2385,11 +2385,11 @@ chMtxObjectInit(&m1);]]></value> <value />
</tags>
<code>
- <value><![CDATA[tprio_t prio = chThdGetPriorityX(); -threads[0] = chThdCreateStatic(wa[0], WA_SIZE, prio+1, thread6, "E"); -threads[1] = chThdCreateStatic(wa[1], WA_SIZE, prio+2, thread6, "D"); -threads[2] = chThdCreateStatic(wa[2], WA_SIZE, prio+3, thread6, "C"); -threads[3] = chThdCreateStatic(wa[3], WA_SIZE, prio+4, thread6, "B"); + <value><![CDATA[tprio_t prio = chThdGetPriorityX();
+threads[0] = chThdCreateStatic(wa[0], WA_SIZE, prio+1, thread6, "E");
+threads[1] = chThdCreateStatic(wa[1], WA_SIZE, prio+2, thread6, "D");
+threads[2] = chThdCreateStatic(wa[2], WA_SIZE, prio+3, thread6, "C");
+threads[3] = chThdCreateStatic(wa[3], WA_SIZE, prio+4, thread6, "B");
threads[4] = chThdCreateStatic(wa[4], WA_SIZE, prio+5, thread6, "A");]]></value>
</code>
</step>
@@ -2401,8 +2401,8 @@ threads[4] = chThdCreateStatic(wa[4], WA_SIZE, prio+5, thread6, "A");]]></value> <value />
</tags>
<code>
- <value><![CDATA[chCondBroadcast(&c1); -test_wait_threads(); + <value><![CDATA[chCondBroadcast(&c1);
+test_wait_threads();
test_assert_sequence("ABCDE", "invalid sequence");]]></value>
</code>
</step>
@@ -2420,8 +2420,8 @@ test_assert_sequence("ABCDE", "invalid sequence");]]></value> </condition>
<various_code>
<setup_code>
- <value><![CDATA[chCondObjectInit(&c1); -chMtxObjectInit(&m1); + <value><![CDATA[chCondObjectInit(&c1);
+chMtxObjectInit(&m1);
chMtxObjectInit(&m2);]]></value>
</setup_code>
<teardown_code>
@@ -2506,7 +2506,7 @@ chMtxObjectInit(&m2);]]></value> <value />
</tags>
<code>
- <value><![CDATA[test_wait_threads(); + <value><![CDATA[test_wait_threads();
test_assert_sequence("ABC", "invalid sequence");]]></value>
</code>
</step>
@@ -2528,12 +2528,12 @@ test_assert_sequence("ABC", "invalid sequence");]]></value> <value>CH_CFG_USE_MESSAGES</value>
</condition>
<shared_code>
- <value><![CDATA[static THD_FUNCTION(msg_thread1, p) { - - chMsgSend(p, 'A'); - chMsgSend(p, 'B'); - chMsgSend(p, 'C'); - chMsgSend(p, 'D'); + <value><![CDATA[static THD_FUNCTION(msg_thread1, p) {
+
+ chMsgSend(p, 'A');
+ chMsgSend(p, 'B');
+ chMsgSend(p, 'C');
+ chMsgSend(p, 'D');
}]]></value>
</shared_code>
<cases>
@@ -2556,7 +2556,7 @@ The test expect to receive the messages in the correct sequence and to not find <value />
</teardown_code>
<local_variables>
- <value><![CDATA[thread_t *tp; + <value><![CDATA[thread_t *tp;
msg_t msg;]]></value>
</local_variables>
</various_code>
@@ -2569,7 +2569,7 @@ msg_t msg;]]></value> <value />
</tags>
<code>
- <value><![CDATA[threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX() + 1, + <value><![CDATA[threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX() + 1,
msg_thread1, chThdGetSelfX());]]></value>
</code>
</step>
@@ -2581,15 +2581,15 @@ msg_t msg;]]></value> <value />
</tags>
<code>
- <value><![CDATA[unsigned i; - -for (i = 0; i < 4; i++) { - tp = chMsgWait(); - msg = chMsgGet(tp); - chMsgRelease(tp, msg); - test_emit_token(msg); -} -test_wait_threads(); + <value><![CDATA[unsigned i;
+
+for (i = 0; i < 4; i++) {
+ tp = chMsgWait();
+ msg = chMsgGet(tp);
+ chMsgRelease(tp, msg);
+ test_emit_token(msg);
+}
+test_wait_threads();
test_assert_sequence("ABCD", "invalid sequence");]]></value>
</code>
</step>
@@ -2611,26 +2611,26 @@ test_assert_sequence("ABCD", "invalid sequence");]]></value> <value>CH_CFG_USE_EVENTS</value>
</condition>
<shared_code>
- <value><![CDATA[static EVENTSOURCE_DECL(es1); -static EVENTSOURCE_DECL(es2); - -static void h1(eventid_t id) {(void)id;test_emit_token('A');} -static void h2(eventid_t id) {(void)id;test_emit_token('B');} -static void h3(eventid_t id) {(void)id;test_emit_token('C');} -static ROMCONST evhandler_t evhndl[] = {h1, h2, h3}; - -static THD_FUNCTION(evt_thread3, p) { - - chThdSleepMilliseconds(50); - chEvtSignal((thread_t *)p, 1); -} - -static THD_FUNCTION(evt_thread7, p) { - - (void)p; - chEvtBroadcast(&es1); - chThdSleepMilliseconds(50); - chEvtBroadcast(&es2); + <value><![CDATA[static EVENTSOURCE_DECL(es1);
+static EVENTSOURCE_DECL(es2);
+
+static void h1(eventid_t id) {(void)id;test_emit_token('A');}
+static void h2(eventid_t id) {(void)id;test_emit_token('B');}
+static void h3(eventid_t id) {(void)id;test_emit_token('C');}
+static ROMCONST evhandler_t evhndl[] = {h1, h2, h3};
+
+static THD_FUNCTION(evt_thread3, p) {
+
+ chThdSleepMilliseconds(50);
+ chEvtSignal((thread_t *)p, 1);
+}
+
+static THD_FUNCTION(evt_thread7, p) {
+
+ (void)p;
+ chEvtBroadcast(&es1);
+ chThdSleepMilliseconds(50);
+ chEvtBroadcast(&es2);
}]]></value>
</shared_code>
<cases>
@@ -2676,8 +2676,8 @@ The test expects that the even source has listeners after the registrations and <value />
</tags>
<code>
- <value><![CDATA[chEvtRegisterMask(&es1, &el1, 1); -chEvtRegisterMask(&es1, &el2, 2); + <value><![CDATA[chEvtRegisterMask(&es1, &el1, 1);
+chEvtRegisterMask(&es1, &el2, 2);
test_assert_lock(chEvtIsListeningI(&es1), "no listener");]]></value>
</code>
</step>
@@ -2689,7 +2689,7 @@ test_assert_lock(chEvtIsListeningI(&es1), "no listener");]]></value> <value />
</tags>
<code>
- <value><![CDATA[chEvtUnregister(&es1, &el1); + <value><![CDATA[chEvtUnregister(&es1, &el1);
test_assert_lock(chEvtIsListeningI(&es1), "no listener");]]></value>
</code>
</step>
@@ -2701,7 +2701,7 @@ test_assert_lock(chEvtIsListeningI(&es1), "no listener");]]></value> <value />
</tags>
<code>
- <value><![CDATA[chEvtUnregister(&es1, &el2); + <value><![CDATA[chEvtUnregister(&es1, &el2);
test_assert_lock(!chEvtIsListeningI(&es1), "stuck listener");]]></value>
</code>
</step>
@@ -2737,7 +2737,7 @@ test_assert_lock(!chEvtIsListeningI(&es1), "stuck listener");]]></value> <value />
</tags>
<code>
- <value><![CDATA[chEvtDispatch(evhndl, 7); + <value><![CDATA[chEvtDispatch(evhndl, 7);
test_assert_sequence("ABC", "invalid sequence");]]></value>
</code>
</step>
@@ -2761,7 +2761,7 @@ test_assert_sequence("ABC", "invalid sequence");]]></value> <value />
</teardown_code>
<local_variables>
- <value><![CDATA[eventmask_t m; + <value><![CDATA[eventmask_t m;
systime_t target_time;]]></value>
</local_variables>
</various_code>
@@ -2785,13 +2785,13 @@ systime_t target_time;]]></value> <value />
</tags>
<code>
- <value><![CDATA[m = chEvtWaitOne(ALL_EVENTS); -test_assert(m == 1, "single event error"); -m = chEvtWaitOne(ALL_EVENTS); -test_assert(m == 2, "single event error"); -m = chEvtWaitOne(ALL_EVENTS); -test_assert(m == 4, "single event error"); -m = chEvtGetAndClearEvents(ALL_EVENTS); + <value><![CDATA[m = chEvtWaitOne(ALL_EVENTS);
+test_assert(m == 1, "single event error");
+m = chEvtWaitOne(ALL_EVENTS);
+test_assert(m == 2, "single event error");
+m = chEvtWaitOne(ALL_EVENTS);
+test_assert(m == 4, "single event error");
+m = chEvtGetAndClearEvents(ALL_EVENTS);
test_assert(m == 0, "stuck event");]]></value>
</code>
</step>
@@ -2803,8 +2803,8 @@ test_assert(m == 0, "stuck event");]]></value> <value />
</tags>
<code>
- <value><![CDATA[target_time = test_wait_tick() + MS2ST(50); -threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX() - 1, + <value><![CDATA[target_time = test_wait_tick() + MS2ST(50);
+threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX() - 1,
evt_thread3, chThdGetSelfX());]]></value>
</code>
</step>
@@ -2816,12 +2816,12 @@ threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX() - 1, <value />
</tags>
<code>
- <value><![CDATA[m = chEvtWaitOne(ALL_EVENTS); -test_assert_time_window(target_time, target_time + ALLOWED_DELAY, - "out of time window"); -test_assert(m == 1, "event flag error"); -m = chEvtGetAndClearEvents(ALL_EVENTS); -test_assert(m == 0, "stuck event"); + <value><![CDATA[m = chEvtWaitOne(ALL_EVENTS);
+test_assert_time_window(target_time, target_time + ALLOWED_DELAY,
+ "out of time window");
+test_assert(m == 1, "event flag error");
+m = chEvtGetAndClearEvents(ALL_EVENTS);
+test_assert(m == 0, "stuck event");
test_wait_threads();]]></value>
</code>
</step>
@@ -2845,7 +2845,7 @@ test_wait_threads();]]></value> <value />
</teardown_code>
<local_variables>
- <value><![CDATA[eventmask_t m; + <value><![CDATA[eventmask_t m;
systime_t target_time;]]></value>
</local_variables>
</various_code>
@@ -2869,9 +2869,9 @@ systime_t target_time;]]></value> <value />
</tags>
<code>
- <value><![CDATA[m = chEvtWaitAny(ALL_EVENTS); -test_assert(m == 5, "unexpected pending bit"); -m = chEvtGetAndClearEvents(ALL_EVENTS); + <value><![CDATA[m = chEvtWaitAny(ALL_EVENTS);
+test_assert(m == 5, "unexpected pending bit");
+m = chEvtGetAndClearEvents(ALL_EVENTS);
test_assert(m == 0, "stuck event");]]></value>
</code>
</step>
@@ -2883,8 +2883,8 @@ test_assert(m == 0, "stuck event");]]></value> <value />
</tags>
<code>
- <value><![CDATA[target_time = test_wait_tick() + MS2ST(50); -threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX() - 1, + <value><![CDATA[target_time = test_wait_tick() + MS2ST(50);
+threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX() - 1,
evt_thread3, chThdGetSelfX());]]></value>
</code>
</step>
@@ -2896,12 +2896,12 @@ threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX() - 1, <value />
</tags>
<code>
- <value><![CDATA[m = chEvtWaitAny(ALL_EVENTS); -test_assert_time_window(target_time, target_time + ALLOWED_DELAY, - "out of time window"); -test_assert(m == 1, "event flag error"); -m = chEvtGetAndClearEvents(ALL_EVENTS); -test_assert(m == 0, "stuck event"); + <value><![CDATA[m = chEvtWaitAny(ALL_EVENTS);
+test_assert_time_window(target_time, target_time + ALLOWED_DELAY,
+ "out of time window");
+test_assert(m == 1, "event flag error");
+m = chEvtGetAndClearEvents(ALL_EVENTS);
+test_assert(m == 0, "stuck event");
test_wait_threads();]]></value>
</code>
</step>
@@ -2925,7 +2925,7 @@ test_wait_threads();]]></value> <value />
</teardown_code>
<local_variables>
- <value><![CDATA[eventmask_t m; + <value><![CDATA[eventmask_t m;
systime_t target_time;]]></value>
</local_variables>
</various_code>
@@ -2949,9 +2949,9 @@ systime_t target_time;]]></value> <value />
</tags>
<code>
- <value><![CDATA[m = chEvtWaitAll(5); -test_assert(m == 5, "unexpected pending bit"); -m = chEvtGetAndClearEvents(ALL_EVENTS); + <value><![CDATA[m = chEvtWaitAll(5);
+test_assert(m == 5, "unexpected pending bit");
+m = chEvtGetAndClearEvents(ALL_EVENTS);
test_assert(m == 0, "stuck event");]]></value>
</code>
</step>
@@ -2974,8 +2974,8 @@ test_assert(m == 0, "stuck event");]]></value> <value />
</tags>
<code>
- <value><![CDATA[target_time = test_wait_tick() + MS2ST(50); -threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX() - 1, + <value><![CDATA[target_time = test_wait_tick() + MS2ST(50);
+threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX() - 1,
evt_thread3, chThdGetSelfX());]]></value>
</code>
</step>
@@ -2987,12 +2987,12 @@ threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX() - 1, <value />
</tags>
<code>
- <value><![CDATA[m = chEvtWaitAll(5); -test_assert_time_window(target_time, target_time + ALLOWED_DELAY, - "out of time window"); -test_assert(m == 5, "event flags error"); -m = chEvtGetAndClearEvents(ALL_EVENTS); -test_assert(m == 0, "stuck event"); + <value><![CDATA[m = chEvtWaitAll(5);
+test_assert_time_window(target_time, target_time + ALLOWED_DELAY,
+ "out of time window");
+test_assert(m == 5, "event flags error");
+m = chEvtGetAndClearEvents(ALL_EVENTS);
+test_assert(m == 0, "stuck event");
test_wait_threads();]]></value>
</code>
</step>
@@ -3028,11 +3028,11 @@ test_wait_threads();]]></value> <value />
</tags>
<code>
- <value><![CDATA[m = chEvtWaitOneTimeout(ALL_EVENTS, TIME_IMMEDIATE); -test_assert(m == 0, "spurious event"); -m = chEvtWaitAnyTimeout(ALL_EVENTS, TIME_IMMEDIATE); -test_assert(m == 0, "spurious event"); -m = chEvtWaitAllTimeout(ALL_EVENTS, TIME_IMMEDIATE); + <value><![CDATA[m = chEvtWaitOneTimeout(ALL_EVENTS, TIME_IMMEDIATE);
+test_assert(m == 0, "spurious event");
+m = chEvtWaitAnyTimeout(ALL_EVENTS, TIME_IMMEDIATE);
+test_assert(m == 0, "spurious event");
+m = chEvtWaitAllTimeout(ALL_EVENTS, TIME_IMMEDIATE);
test_assert(m == 0, "spurious event");]]></value>
</code>
</step>
@@ -3044,11 +3044,11 @@ test_assert(m == 0, "spurious event");]]></value> <value />
</tags>
<code>
- <value><![CDATA[m = chEvtWaitOneTimeout(ALL_EVENTS, MS2ST(50)); -test_assert(m == 0, "spurious event"); -m = chEvtWaitAnyTimeout(ALL_EVENTS, MS2ST(50)); -test_assert(m == 0, "spurious event"); -m = chEvtWaitAllTimeout(ALL_EVENTS, MS2ST(50)); + <value><![CDATA[m = chEvtWaitOneTimeout(ALL_EVENTS, MS2ST(50));
+test_assert(m == 0, "spurious event");
+m = chEvtWaitAnyTimeout(ALL_EVENTS, MS2ST(50));
+test_assert(m == 0, "spurious event");
+m = chEvtWaitAllTimeout(ALL_EVENTS, MS2ST(50));
test_assert(m == 0, "spurious event");]]></value>
</code>
</step>
@@ -3066,16 +3066,16 @@ test_assert(m == 0, "spurious event");]]></value> </condition>
<various_code>
<setup_code>
- <value><![CDATA[chEvtGetAndClearEvents(ALL_EVENTS); -chEvtObjectInit(&es1); + <value><![CDATA[chEvtGetAndClearEvents(ALL_EVENTS);
+chEvtObjectInit(&es1);
chEvtObjectInit(&es2);]]></value>
</setup_code>
<teardown_code>
<value />
</teardown_code>
<local_variables>
- <value><![CDATA[eventmask_t m; -event_listener_t el1, el2; + <value><![CDATA[eventmask_t m;
+event_listener_t el1, el2;
systime_t target_time;]]></value>
</local_variables>
</various_code>
@@ -3088,7 +3088,7 @@ systime_t target_time;]]></value> <value />
</tags>
<code>
- <value><![CDATA[chEvtRegisterMask(&es1, &el1, 1); + <value><![CDATA[chEvtRegisterMask(&es1, &el1, 1);
chEvtRegisterMask(&es2, &el2, 4);]]></value>
</code>
</step>
@@ -3100,8 +3100,8 @@ chEvtRegisterMask(&es2, &el2, 4);]]></value> <value />
</tags>
<code>
- <value><![CDATA[target_time = test_wait_tick() + MS2ST(50); -threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX() - 1, + <value><![CDATA[target_time = test_wait_tick() + MS2ST(50);
+threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX() - 1,
evt_thread7, "A");]]></value>
</code>
</step>
@@ -3113,11 +3113,11 @@ threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX() - 1, <value />
</tags>
<code>
- <value><![CDATA[m = chEvtWaitAll(5); -test_assert_time_window(target_time, target_time + ALLOWED_DELAY, - "out of time window"); -m = chEvtGetAndClearEvents(ALL_EVENTS); -test_assert(m == 0, "stuck event"); + <value><![CDATA[m = chEvtWaitAll(5);
+test_assert_time_window(target_time, target_time + ALLOWED_DELAY,
+ "out of time window");
+m = chEvtGetAndClearEvents(ALL_EVENTS);
+test_assert(m == 0, "stuck event");
test_wait_threads();]]></value>
</code>
</step>
@@ -3129,9 +3129,9 @@ test_wait_threads();]]></value> <value />
</tags>
<code>
- <value><![CDATA[chEvtUnregister(&es1, &el1); -chEvtUnregister(&es2, &el2); -test_assert(!chEvtIsListeningI(&es1), "stuck listener"); + <value><![CDATA[chEvtUnregister(&es1, &el1);
+chEvtUnregister(&es2, &el2);
+test_assert(!chEvtIsListeningI(&es1), "stuck listener");
test_assert(!chEvtIsListeningI(&es2), "stuck listener");]]></value>
</code>
</step>
@@ -3153,9 +3153,9 @@ test_assert(!chEvtIsListeningI(&es2), "stuck listener");]]></value> <value>CH_CFG_USE_MAILBOXES</value>
</condition>
<shared_code>
- <value><![CDATA[#define MB_SIZE 4 - -static msg_t mb_buffer[MB_SIZE]; + <value><![CDATA[#define MB_SIZE 4
+
+static msg_t mb_buffer[MB_SIZE];
static MAILBOX_DECL(mb1, mb_buffer, MB_SIZE);]]></value>
</shared_code>
<cases>
@@ -3177,7 +3177,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>
@@ -3201,10 +3201,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>
@@ -3233,11 +3233,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>
@@ -3249,8 +3249,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>
@@ -3262,11 +3262,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>
@@ -3278,9 +3278,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>
@@ -3292,9 +3292,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>
@@ -3318,7 +3318,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>
@@ -3342,12 +3342,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>
@@ -3360,15 +3360,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>
@@ -3380,8 +3380,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>
@@ -3393,13 +3393,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>
@@ -3411,9 +3411,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>
@@ -3425,9 +3425,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>
@@ -3451,7 +3451,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>
@@ -3464,9 +3464,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>
@@ -3478,17 +3478,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>
@@ -3512,11 +3512,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>
@@ -3538,22 +3538,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), NULL); - -#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; + <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));
+#endif
+
+static void *null_provider(size_t size, unsigned align) {
+
+ (void)size;
(void)align;
- (void)offset; - - return NULL; +
+ return NULL;
}]]></value>
</shared_code>
<cases>
@@ -3598,7 +3597,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>
@@ -3621,7 +3620,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>
@@ -3633,7 +3632,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>
@@ -3656,7 +3655,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>
@@ -3703,7 +3702,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>
@@ -3726,7 +3725,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>
@@ -3738,7 +3737,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>
@@ -3806,9 +3805,9 @@ 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) - + <value><![CDATA[#define ALLOC_SIZE 16
+#define HEAP_SIZE (ALLOC_SIZE * 8)
+
memory_heap_t test_heap;]]></value>
</shared_code>
<cases>
@@ -3830,7 +3829,7 @@ memory_heap_t test_heap;]]></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>
@@ -3854,7 +3853,7 @@ size_t n, sz;]]></value> <value />
</tags>
<code>
- <value><![CDATA[p1 = chHeapAlloc(&test_heap, sizeof test_buffer * 2); + <value><![CDATA[p1 = chHeapAlloc(&test_heap, sizeof test_buffer * 2);
test_assert(p1 == NULL, "allocation not failed");]]></value>
</code>
</step>
@@ -3866,8 +3865,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>
@@ -3879,11 +3878,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>
@@ -3895,12 +3894,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>
@@ -3912,12 +3911,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>
@@ -3929,17 +3928,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>
@@ -3951,13 +3950,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>
@@ -3969,10 +3968,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>
@@ -3984,7 +3983,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>
@@ -4008,7 +4007,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>
@@ -4021,9 +4020,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>
@@ -4035,7 +4034,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>
@@ -4057,16 +4056,16 @@ test_assert(p1 == NULL, "allocation not failed");]]></value> <value>CH_CFG_USE_DYNAMIC</value>
</condition>
<shared_code>
- <value><![CDATA[#if CH_CFG_USE_HEAP -static memory_heap_t heap1; -#endif -#if CH_CFG_USE_MEMPOOLS -static memory_pool_t mp1; -#endif - -static THD_FUNCTION(dyn_thread1, p) { - - test_emit_token(*(char *)p); + <value><![CDATA[#if CH_CFG_USE_HEAP
+static memory_heap_t heap1;
+#endif
+#if CH_CFG_USE_MEMPOOLS
+static memory_pool_t mp1;
+#endif
+
+static THD_FUNCTION(dyn_thread1, p) {
+
+ test_emit_token(*(char *)p);
}]]></value>
</shared_code>
<cases>
@@ -4089,8 +4088,8 @@ The test expects the first two threads to successfully start and the third one t <value />
</teardown_code>
<local_variables>
- <value><![CDATA[size_t n1, total1, largest1; -size_t n2, total2, largest2; + <value><![CDATA[size_t n1, total1, largest1;
+size_t n2, total2, largest2;
tprio_t prio;]]></value>
</local_variables>
</various_code>
@@ -4114,7 +4113,7 @@ tprio_t prio;]]></value> <value />
</tags>
<code>
- <value><![CDATA[n1 = chHeapStatus(&heap1, &total1, &largest1); + <value><![CDATA[n1 = chHeapStatus(&heap1, &total1, &largest1);
test_assert(n1 == 1, "heap fragmented");]]></value>
</code>
</step>
@@ -4126,10 +4125,10 @@ test_assert(n1 == 1, "heap fragmented");]]></value> <value />
</tags>
<code>
- <value><![CDATA[threads[0] = chThdCreateFromHeap(&heap1, - THD_WORKING_AREA_SIZE(THREADS_STACK_SIZE), - "dyn1", - prio-1, dyn_thread1, "A"); + <value><![CDATA[threads[0] = chThdCreateFromHeap(&heap1,
+ THD_WORKING_AREA_SIZE(THREADS_STACK_SIZE),
+ "dyn1",
+ prio-1, dyn_thread1, "A");
test_assert(threads[0] != NULL, "thread creation failed");]]></value>
</code>
</step>
@@ -4141,10 +4140,10 @@ test_assert(threads[0] != NULL, "thread creation failed");]]></value> <value />
</tags>
<code>
- <value><![CDATA[threads[1] = chThdCreateFromHeap(&heap1, - THD_WORKING_AREA_SIZE(THREADS_STACK_SIZE), - "dyn2", - prio-2, dyn_thread1, "B"); + <value><![CDATA[threads[1] = chThdCreateFromHeap(&heap1,
+ THD_WORKING_AREA_SIZE(THREADS_STACK_SIZE),
+ "dyn2",
+ prio-2, dyn_thread1, "B");
test_assert(threads[1] != NULL, "thread creation failed");]]></value>
</code>
</step>
@@ -4156,10 +4155,10 @@ test_assert(threads[1] != NULL, "thread creation failed");]]></value> <value />
</tags>
<code>
- <value><![CDATA[threads[2] = chThdCreateFromHeap(&heap1, - THD_WORKING_AREA_SIZE(THREADS_STACK_SIZE * 1024), - "dyn3", - prio-3, dyn_thread1, "C"); + <value><![CDATA[threads[2] = chThdCreateFromHeap(&heap1,
+ THD_WORKING_AREA_SIZE(THREADS_STACK_SIZE * 1024),
+ "dyn3",
+ prio-3, dyn_thread1, "C");
test_assert(threads[2] == NULL, "thread creation not failed");]]></value>
</code>
</step>
@@ -4171,7 +4170,7 @@ test_assert(threads[2] == NULL, "thread creation not failed");]]></value> <value />
</tags>
<code>
- <value><![CDATA[test_wait_threads(); + <value><![CDATA[test_wait_threads();
test_assert_sequence("AB", "invalid sequence");]]></value>
</code>
</step>
@@ -4183,9 +4182,9 @@ test_assert_sequence("AB", "invalid sequence");]]></value> <value />
</tags>
<code>
- <value><![CDATA[n2 = chHeapStatus(&heap1, &total2, &largest2); -test_assert(n1 == n2, "fragmentation changed"); -test_assert(total1 == total2, "total free space changed"); + <value><![CDATA[n2 = chHeapStatus(&heap1, &total2, &largest2);
+test_assert(n1 == n2, "fragmentation changed");
+test_assert(total1 == total2, "total free space changed");
test_assert(largest1 == largest2, "largest fragment size changed");]]></value>
</code>
</step>
@@ -4210,7 +4209,7 @@ The test expects the first four threads to successfully start and the last one t <value />
</teardown_code>
<local_variables>
- <value><![CDATA[unsigned i; + <value><![CDATA[unsigned i;
tprio_t prio;]]></value>
</local_variables>
</various_code>
@@ -4223,7 +4222,7 @@ tprio_t prio;]]></value> <value />
</tags>
<code>
- <value><![CDATA[for (i = 0; i < 4; i++) + <value><![CDATA[for (i = 0; i < 4; i++)
chPoolFree(&mp1, wa[i]);]]></value>
</code>
</step>
@@ -4246,10 +4245,10 @@ tprio_t prio;]]></value> <value />
</tags>
<code>
- <value><![CDATA[threads[0] = chThdCreateFromMemoryPool(&mp1, "dyn1", prio-1, dyn_thread1, "A"); -threads[1] = chThdCreateFromMemoryPool(&mp1, "dyn2", prio-2, dyn_thread1, "B"); -threads[2] = chThdCreateFromMemoryPool(&mp1, "dyn3", prio-3, dyn_thread1, "C"); -threads[3] = chThdCreateFromMemoryPool(&mp1, "dyn4", prio-4, dyn_thread1, "D"); + <value><![CDATA[threads[0] = chThdCreateFromMemoryPool(&mp1, "dyn1", prio-1, dyn_thread1, "A");
+threads[1] = chThdCreateFromMemoryPool(&mp1, "dyn2", prio-2, dyn_thread1, "B");
+threads[2] = chThdCreateFromMemoryPool(&mp1, "dyn3", prio-3, dyn_thread1, "C");
+threads[3] = chThdCreateFromMemoryPool(&mp1, "dyn4", prio-4, dyn_thread1, "D");
threads[4] = chThdCreateFromMemoryPool(&mp1, "dyn5", prio-5, dyn_thread1, "E");]]></value>
</code>
</step>
@@ -4261,12 +4260,12 @@ threads[4] = chThdCreateFromMemoryPool(&mp1, "dyn5", prio-5, dyn_thread1, "E");] <value />
</tags>
<code>
- <value><![CDATA[test_assert((threads[0] != NULL) && - (threads[1] != NULL) && - (threads[2] != NULL) && - (threads[3] != NULL), - "thread creation failed"); -test_assert(threads[4] == NULL, + <value><![CDATA[test_assert((threads[0] != NULL) &&
+ (threads[1] != NULL) &&
+ (threads[2] != NULL) &&
+ (threads[3] != NULL),
+ "thread creation failed");
+test_assert(threads[4] == NULL,
"thread creation not failed");]]></value>
</code>
</step>
@@ -4278,7 +4277,7 @@ test_assert(threads[4] == NULL, <value />
</tags>
<code>
- <value><![CDATA[test_wait_threads(); + <value><![CDATA[test_wait_threads();
test_assert_sequence("ABCD", "invalid sequence");]]></value>
</code>
</step>
@@ -4290,8 +4289,8 @@ test_assert_sequence("ABCD", "invalid sequence");]]></value> <value />
</tags>
<code>
- <value><![CDATA[for (i = 0; i < 4; i++) - test_assert(chPoolAlloc(&mp1) != NULL, "pool list empty"); + <value><![CDATA[for (i = 0; i < 4; i++)
+ test_assert(chPoolAlloc(&mp1) != NULL, "pool list empty");
test_assert(chPoolAlloc(&mp1) == NULL, "pool list not empty");]]></value>
</code>
</step>
@@ -4314,85 +4313,85 @@ Objective of the test sequence is to provide a performance index for the most cr <value />
</condition>
<shared_code>
- <value><![CDATA[#if CH_CFG_USE_SEMAPHORES || defined(__DOXYGEN__) -static semaphore_t sem1; -#endif -#if CH_CFG_USE_MUTEXES || defined(__DOXYGEN__) -static mutex_t mtx1; -#endif - -static void tmo(void *param) {(void)param;} - -#if CH_CFG_USE_MESSAGES -static THD_FUNCTION(bmk_thread1, p) { - thread_t *tp; - msg_t msg; - - (void)p; - do { - tp = chMsgWait(); - msg = chMsgGet(tp); - chMsgRelease(tp, msg); - } while (msg); -} - -NOINLINE static unsigned int msg_loop_test(thread_t *tp) { - systime_t start, end; - - uint32_t n = 0; - start = test_wait_tick(); - end = start + MS2ST(1000); - do { - (void)chMsgSend(tp, 1); - n++; -#if defined(SIMULATOR) - _sim_check_for_interrupts(); -#endif - } while (chVTIsSystemTimeWithinX(start, end)); - (void)chMsgSend(tp, 0); - return n; -} -#endif - -static THD_FUNCTION(bmk_thread3, p) { - - chThdExit((msg_t)p); -} - -static THD_FUNCTION(bmk_thread4, p) { - msg_t msg; - thread_t *self = chThdGetSelfX(); - - (void)p; - chSysLock(); - do { - chSchGoSleepS(CH_STATE_SUSPENDED); - msg = self->u.rdymsg; - } while (msg == MSG_OK); - chSysUnlock(); -} - -#if CH_CFG_USE_SEMAPHORES -static THD_FUNCTION(bmk_thread7, p) { - - (void)p; - while (!chThdShouldTerminateX()) - chSemWait(&sem1); -} -#endif - -static THD_FUNCTION(bmk_thread8, p) { - - do { - chThdYield(); - chThdYield(); - chThdYield(); - chThdYield(); - (*(uint32_t *)p) += 4; -#if defined(SIMULATOR) - _sim_check_for_interrupts(); -#endif - } while(!chThdShouldTerminateX()); + <value><![CDATA[#if CH_CFG_USE_SEMAPHORES || defined(__DOXYGEN__)
+static semaphore_t sem1;
+#endif
+#if CH_CFG_USE_MUTEXES || defined(__DOXYGEN__)
+static mutex_t mtx1;
+#endif
+
+static void tmo(void *param) {(void)param;}
+
+#if CH_CFG_USE_MESSAGES
+static THD_FUNCTION(bmk_thread1, p) {
+ thread_t *tp;
+ msg_t msg;
+
+ (void)p;
+ do {
+ tp = chMsgWait();
+ msg = chMsgGet(tp);
+ chMsgRelease(tp, msg);
+ } while (msg);
+}
+
+NOINLINE static unsigned int msg_loop_test(thread_t *tp) {
+ systime_t start, end;
+
+ uint32_t n = 0;
+ start = test_wait_tick();
+ end = start + MS2ST(1000);
+ do {
+ (void)chMsgSend(tp, 1);
+ n++;
+#if defined(SIMULATOR)
+ _sim_check_for_interrupts();
+#endif
+ } while (chVTIsSystemTimeWithinX(start, end));
+ (void)chMsgSend(tp, 0);
+ return n;
+}
+#endif
+
+static THD_FUNCTION(bmk_thread3, p) {
+
+ chThdExit((msg_t)p);
+}
+
+static THD_FUNCTION(bmk_thread4, p) {
+ msg_t msg;
+ thread_t *self = chThdGetSelfX();
+
+ (void)p;
+ chSysLock();
+ do {
+ chSchGoSleepS(CH_STATE_SUSPENDED);
+ msg = self->u.rdymsg;
+ } while (msg == MSG_OK);
+ chSysUnlock();
+}
+
+#if CH_CFG_USE_SEMAPHORES
+static THD_FUNCTION(bmk_thread7, p) {
+
+ (void)p;
+ while (!chThdShouldTerminateX())
+ chSemWait(&sem1);
+}
+#endif
+
+static THD_FUNCTION(bmk_thread8, p) {
+
+ do {
+ chThdYield();
+ chThdYield();
+ chThdYield();
+ chThdYield();
+ (*(uint32_t *)p) += 4;
+#if defined(SIMULATOR)
+ _sim_check_for_interrupts();
+#endif
+ } while(!chThdShouldTerminateX());
}]]></value>
</shared_code>
<cases>
@@ -4437,7 +4436,7 @@ static THD_FUNCTION(bmk_thread8, p) { <value />
</tags>
<code>
- <value><![CDATA[n = msg_loop_test(threads[0]); + <value><![CDATA[n = msg_loop_test(threads[0]);
test_wait_threads();]]></value>
</code>
</step>
@@ -4449,10 +4448,10 @@ test_wait_threads();]]></value> <value />
</tags>
<code>
- <value><![CDATA[test_print("--- Score : "); -test_printn(n); -test_print(" msgs/S, "); -test_printn(n << 1); + <value><![CDATA[test_print("--- Score : ");
+test_printn(n);
+test_print(" msgs/S, ");
+test_printn(n << 1);
test_println(" ctxswc/S");]]></value>
</code>
</step>
@@ -4499,7 +4498,7 @@ test_println(" ctxswc/S");]]></value> <value />
</tags>
<code>
- <value><![CDATA[n = msg_loop_test(threads[0]); + <value><![CDATA[n = msg_loop_test(threads[0]);
test_wait_threads();]]></value>
</code>
</step>
@@ -4511,10 +4510,10 @@ test_wait_threads();]]></value> <value />
</tags>
<code>
- <value><![CDATA[test_print("--- Score : "); -test_printn(n); -test_print(" msgs/S, "); -test_printn(n << 1); + <value><![CDATA[test_print("--- Score : ");
+test_printn(n);
+test_print(" msgs/S, ");
+test_printn(n << 1);
test_println(" ctxswc/S");]]></value>
</code>
</step>
@@ -4561,9 +4560,9 @@ test_println(" ctxswc/S");]]></value> <value />
</tags>
<code>
- <value><![CDATA[threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriorityX()-2, bmk_thread3, NULL); -threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriorityX()-3, bmk_thread3, NULL); -threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriorityX()-4, bmk_thread3, NULL); + <value><![CDATA[threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriorityX()-2, bmk_thread3, NULL);
+threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriorityX()-3, bmk_thread3, NULL);
+threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriorityX()-4, bmk_thread3, NULL);
threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriorityX()-5, bmk_thread3, NULL);]]></value>
</code>
</step>
@@ -4575,7 +4574,7 @@ threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriorityX()-5, bmk_thread <value />
</tags>
<code>
- <value><![CDATA[n = msg_loop_test(threads[0]); + <value><![CDATA[n = msg_loop_test(threads[0]);
test_wait_threads();]]></value>
</code>
</step>
@@ -4587,10 +4586,10 @@ test_wait_threads();]]></value> <value />
</tags>
<code>
- <value><![CDATA[test_print("--- Score : "); -test_printn(n); -test_print(" msgs/S, "); -test_printn(n << 1); + <value><![CDATA[test_print("--- Score : ");
+test_printn(n);
+test_print(" msgs/S, ");
+test_printn(n << 1);
test_println(" ctxswc/S");]]></value>
</code>
</step>
@@ -4615,7 +4614,7 @@ The Context Switch performance is calculated by measuring the number of iteratio <value />
</teardown_code>
<local_variables>
- <value><![CDATA[thread_t *tp; + <value><![CDATA[thread_t *tp;
uint32_t n;]]></value>
</local_variables>
</various_code>
@@ -4628,7 +4627,7 @@ uint32_t n;]]></value> <value />
</tags>
<code>
- <value><![CDATA[tp = threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX()+1, + <value><![CDATA[tp = threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX()+1,
bmk_thread4, NULL);]]></value>
</code>
</step>
@@ -4640,22 +4639,22 @@ uint32_t n;]]></value> <value />
</tags>
<code>
- <value><![CDATA[systime_t start, end; - -n = 0; -start = test_wait_tick(); -end = start + MS2ST(1000); -do { - chSysLock(); - chSchWakeupS(tp, MSG_OK); - chSchWakeupS(tp, MSG_OK); - chSchWakeupS(tp, MSG_OK); - chSchWakeupS(tp, MSG_OK); - chSysUnlock(); - n += 4; -#if defined(SIMULATOR) - _sim_check_for_interrupts(); -#endif + <value><![CDATA[systime_t start, end;
+
+n = 0;
+start = test_wait_tick();
+end = start + MS2ST(1000);
+do {
+ chSysLock();
+ chSchWakeupS(tp, MSG_OK);
+ chSchWakeupS(tp, MSG_OK);
+ chSchWakeupS(tp, MSG_OK);
+ chSchWakeupS(tp, MSG_OK);
+ chSysUnlock();
+ n += 4;
+#if defined(SIMULATOR)
+ _sim_check_for_interrupts();
+#endif
} while (chVTIsSystemTimeWithinX(start, end));]]></value>
</code>
</step>
@@ -4667,9 +4666,9 @@ do { <value />
</tags>
<code>
- <value><![CDATA[chSysLock(); -chSchWakeupS(tp, MSG_TIMEOUT); -chSysUnlock(); + <value><![CDATA[chSysLock();
+chSchWakeupS(tp, MSG_TIMEOUT);
+chSysUnlock();
test_wait_threads();]]></value>
</code>
</step>
@@ -4681,8 +4680,8 @@ test_wait_threads();]]></value> <value />
</tags>
<code>
- <value><![CDATA[test_print("--- Score : "); -test_printn(n * 2); + <value><![CDATA[test_print("--- Score : ");
+test_printn(n * 2);
test_println(" ctxswc/S");]]></value>
</code>
</step>
@@ -4707,8 +4706,8 @@ The performance is calculated by measuring the number of iterations after a seco <value />
</teardown_code>
<local_variables>
- <value><![CDATA[uint32_t n; -tprio_t prio = chThdGetPriorityX() - 1; + <value><![CDATA[uint32_t n;
+tprio_t prio = chThdGetPriorityX() - 1;
systime_t start, end;]]></value>
</local_variables>
</various_code>
@@ -4721,15 +4720,15 @@ systime_t start, end;]]></value> <value />
</tags>
<code>
- <value><![CDATA[n = 0; -start = test_wait_tick(); -end = start + MS2ST(1000); -do { - chThdWait(chThdCreateStatic(wa[0], WA_SIZE, prio, bmk_thread3, NULL)); - n++; -#if defined(SIMULATOR) - _sim_check_for_interrupts(); -#endif + <value><![CDATA[n = 0;
+start = test_wait_tick();
+end = start + MS2ST(1000);
+do {
+ chThdWait(chThdCreateStatic(wa[0], WA_SIZE, prio, bmk_thread3, NULL));
+ n++;
+#if defined(SIMULATOR)
+ _sim_check_for_interrupts();
+#endif
} while (chVTIsSystemTimeWithinX(start, end));]]></value>
</code>
</step>
@@ -4741,8 +4740,8 @@ do { <value />
</tags>
<code>
- <value><![CDATA[test_print("--- Score : "); -test_printn(n); + <value><![CDATA[test_print("--- Score : ");
+test_printn(n);
test_println(" threads/S");]]></value>
</code>
</step>
@@ -4766,8 +4765,8 @@ test_println(" threads/S");]]></value> <value />
</teardown_code>
<local_variables>
- <value><![CDATA[uint32_t n; -tprio_t prio = chThdGetPriorityX() + 1; + <value><![CDATA[uint32_t n;
+tprio_t prio = chThdGetPriorityX() + 1;
systime_t start, end;]]></value>
</local_variables>
</various_code>
@@ -4780,19 +4779,19 @@ systime_t start, end;]]></value> <value />
</tags>
<code>
- <value><![CDATA[n = 0; -start = test_wait_tick(); -end = start + MS2ST(1000); -do { -#if CH_CFG_USE_REGISTRY - chThdRelease(chThdCreateStatic(wa[0], WA_SIZE, prio, bmk_thread3, NULL)); -#else - chThdCreateStatic(wa[0], WA_SIZE, prio, bmk_thread3, NULL); -#endif - n++; -#if defined(SIMULATOR) - _sim_check_for_interrupts(); -#endif + <value><![CDATA[n = 0;
+start = test_wait_tick();
+end = start + MS2ST(1000);
+do {
+#if CH_CFG_USE_REGISTRY
+ chThdRelease(chThdCreateStatic(wa[0], WA_SIZE, prio, bmk_thread3, NULL));
+#else
+ chThdCreateStatic(wa[0], WA_SIZE, prio, bmk_thread3, NULL);
+#endif
+ n++;
+#if defined(SIMULATOR)
+ _sim_check_for_interrupts();
+#endif
} while (chVTIsSystemTimeWithinX(start, end));]]></value>
</code>
</step>
@@ -4804,8 +4803,8 @@ do { <value />
</tags>
<code>
- <value><![CDATA[test_print("--- Score : "); -test_printn(n); + <value><![CDATA[test_print("--- Score : ");
+test_printn(n);
test_println(" threads/S");]]></value>
</code>
</step>
@@ -4842,10 +4841,10 @@ The performance is calculated by measuring the number of iterations after a seco <value />
</tags>
<code>
- <value><![CDATA[threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX()+5, bmk_thread7, NULL); -threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriorityX()+4, bmk_thread7, NULL); -threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriorityX()+3, bmk_thread7, NULL); -threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriorityX()+2, bmk_thread7, NULL); + <value><![CDATA[threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX()+5, bmk_thread7, NULL);
+threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriorityX()+4, bmk_thread7, NULL);
+threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriorityX()+3, bmk_thread7, NULL);
+threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriorityX()+2, bmk_thread7, NULL);
threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriorityX()+1, bmk_thread7, NULL);]]></value>
</code>
</step>
@@ -4857,17 +4856,17 @@ threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriorityX()+1, bmk_thread <value />
</tags>
<code>
- <value><![CDATA[systime_t start, end; - -n = 0; -start = test_wait_tick(); -end = start + MS2ST(1000); -do { - chSemReset(&sem1, 0); - n++; -#if defined(SIMULATOR) - _sim_check_for_interrupts(); -#endif + <value><![CDATA[systime_t start, end;
+
+n = 0;
+start = test_wait_tick();
+end = start + MS2ST(1000);
+do {
+ chSemReset(&sem1, 0);
+ n++;
+#if defined(SIMULATOR)
+ _sim_check_for_interrupts();
+#endif
} while (chVTIsSystemTimeWithinX(start, end));]]></value>
</code>
</step>
@@ -4879,8 +4878,8 @@ do { <value />
</tags>
<code>
- <value><![CDATA[test_terminate_threads(); -chSemReset(&sem1, 0); + <value><![CDATA[test_terminate_threads();
+chSemReset(&sem1, 0);
test_wait_threads();]]></value>
</code>
</step>
@@ -4892,10 +4891,10 @@ test_wait_threads();]]></value> <value />
</tags>
<code>
- <value><![CDATA[test_print("--- Score : "); -test_printn(n); -test_print(" reschedules/S, "); -test_printn(n * 6); + <value><![CDATA[test_print("--- Score : ");
+test_printn(n);
+test_print(" reschedules/S, ");
+test_printn(n * 6);
test_println(" ctxswc/S");]]></value>
</code>
</step>
@@ -4932,12 +4931,12 @@ The performance is calculated by measuring the number of iterations after a seco <value />
</tags>
<code>
- <value><![CDATA[n = 0; -test_wait_tick();threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX()-1, bmk_thread8, (void *)&n); - -threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriorityX()-1, bmk_thread8, (void *)&n); -threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriorityX()-1, bmk_thread8, (void *)&n); -threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriorityX()-1, bmk_thread8, (void *)&n); + <value><![CDATA[n = 0;
+test_wait_tick();threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX()-1, bmk_thread8, (void *)&n);
+
+threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriorityX()-1, bmk_thread8, (void *)&n);
+threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriorityX()-1, bmk_thread8, (void *)&n);
+threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriorityX()-1, bmk_thread8, (void *)&n);
threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriorityX()-1, bmk_thread8, (void *)&n);]]></value>
</code>
</step>
@@ -4949,8 +4948,8 @@ threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriorityX()-1, bmk_thread <value />
</tags>
<code>
- <value><![CDATA[chThdSleepSeconds(1); -test_terminate_threads(); + <value><![CDATA[chThdSleepSeconds(1);
+test_terminate_threads();
test_wait_threads();]]></value>
</code>
</step>
@@ -4962,8 +4961,8 @@ test_wait_threads();]]></value> <value />
</tags>
<code>
- <value><![CDATA[test_print("--- Score : "); -test_printn(n); + <value><![CDATA[test_print("--- Score : ");
+test_printn(n);
test_println(" ctxswc/S");]]></value>
</code>
</step>
@@ -4988,7 +4987,7 @@ The performance is calculated by measuring the number of iterations after a seco <value />
</teardown_code>
<local_variables>
- <value><![CDATA[static virtual_timer_t vt1, vt2; + <value><![CDATA[static virtual_timer_t vt1, vt2;
uint32_t n;]]></value>
</local_variables>
</various_code>
@@ -5001,22 +5000,22 @@ uint32_t n;]]></value> <value />
</tags>
<code>
- <value><![CDATA[systime_t start, end; - -n = 0; -start = test_wait_tick(); -end = start + MS2ST(1000); -do { - chSysLock(); - chVTDoSetI(&vt1, 1, tmo, NULL); - chVTDoSetI(&vt2, 10000, tmo, NULL); - chVTDoResetI(&vt1); - chVTDoResetI(&vt2); - chSysUnlock(); - n++; -#if defined(SIMULATOR) - _sim_check_for_interrupts(); -#endif + <value><![CDATA[systime_t start, end;
+
+n = 0;
+start = test_wait_tick();
+end = start + MS2ST(1000);
+do {
+ chSysLock();
+ chVTDoSetI(&vt1, 1, tmo, NULL);
+ chVTDoSetI(&vt2, 10000, tmo, NULL);
+ chVTDoResetI(&vt1);
+ chVTDoResetI(&vt2);
+ chSysUnlock();
+ n++;
+#if defined(SIMULATOR)
+ _sim_check_for_interrupts();
+#endif
} while (chVTIsSystemTimeWithinX(start, end));]]></value>
</code>
</step>
@@ -5028,8 +5027,8 @@ do { <value />
</tags>
<code>
- <value><![CDATA[test_print("--- Score : "); -test_printn(n * 2); + <value><![CDATA[test_print("--- Score : ");
+test_printn(n * 2);
test_println(" timers/S");]]></value>
</code>
</step>
@@ -5066,24 +5065,24 @@ The performance is calculated by measuring the number of iterations after a seco <value />
</tags>
<code>
- <value><![CDATA[systime_t start, end; - -n = 0; -start = test_wait_tick(); -end = start + MS2ST(1000); -do { - chSemWait(&sem1); - chSemSignal(&sem1); - chSemWait(&sem1); - chSemSignal(&sem1); - chSemWait(&sem1); - chSemSignal(&sem1); - chSemWait(&sem1); - chSemSignal(&sem1); - n++; -#if defined(SIMULATOR) - _sim_check_for_interrupts(); -#endif + <value><![CDATA[systime_t start, end;
+
+n = 0;
+start = test_wait_tick();
+end = start + MS2ST(1000);
+do {
+ chSemWait(&sem1);
+ chSemSignal(&sem1);
+ chSemWait(&sem1);
+ chSemSignal(&sem1);
+ chSemWait(&sem1);
+ chSemSignal(&sem1);
+ chSemWait(&sem1);
+ chSemSignal(&sem1);
+ n++;
+#if defined(SIMULATOR)
+ _sim_check_for_interrupts();
+#endif
} while (chVTIsSystemTimeWithinX(start, end));]]></value>
</code>
</step>
@@ -5095,8 +5094,8 @@ do { <value />
</tags>
<code>
- <value><![CDATA[test_print("--- Score : "); -test_printn(n * 4); + <value><![CDATA[test_print("--- Score : ");
+test_printn(n * 4);
test_println(" wait+signal/S");]]></value>
</code>
</step>
@@ -5133,24 +5132,24 @@ The performance is calculated by measuring the number of iterations after a seco <value />
</tags>
<code>
- <value><![CDATA[systime_t start, end; - -n = 0; -start = test_wait_tick(); -end = start + MS2ST(1000); -do { - chMtxLock(&mtx1); - chMtxUnlock(&mtx1); - chMtxLock(&mtx1); - chMtxUnlock(&mtx1); - chMtxLock(&mtx1); - chMtxUnlock(&mtx1); - chMtxLock(&mtx1); - chMtxUnlock(&mtx1); - n++; -#if defined(SIMULATOR) - _sim_check_for_interrupts(); -#endif + <value><![CDATA[systime_t start, end;
+
+n = 0;
+start = test_wait_tick();
+end = start + MS2ST(1000);
+do {
+ chMtxLock(&mtx1);
+ chMtxUnlock(&mtx1);
+ chMtxLock(&mtx1);
+ chMtxUnlock(&mtx1);
+ chMtxLock(&mtx1);
+ chMtxUnlock(&mtx1);
+ chMtxLock(&mtx1);
+ chMtxUnlock(&mtx1);
+ n++;
+#if defined(SIMULATOR)
+ _sim_check_for_interrupts();
+#endif
} while (chVTIsSystemTimeWithinX(start, end));]]></value>
</code>
</step>
@@ -5162,8 +5161,8 @@ do { <value />
</tags>
<code>
- <value><![CDATA[test_print("--- Score : "); -test_printn(n * 4); + <value><![CDATA[test_print("--- Score : ");
+test_printn(n * 4);
test_println(" lock+unlock/S");]]></value>
</code>
</step>
@@ -5199,8 +5198,8 @@ test_println(" lock+unlock/S");]]></value> <value />
</tags>
<code>
- <value><![CDATA[test_print("--- System: "); -test_printn(sizeof(ch_system_t)); + <value><![CDATA[test_print("--- System: ");
+test_printn(sizeof(ch_system_t));
test_println(" bytes");]]></value>
</code>
</step>
@@ -5212,8 +5211,8 @@ test_println(" bytes");]]></value> <value />
</tags>
<code>
- <value><![CDATA[test_print("--- Thread: "); -test_printn(sizeof(thread_t)); + <value><![CDATA[test_print("--- Thread: ");
+test_printn(sizeof(thread_t));
test_println(" bytes");]]></value>
</code>
</step>
@@ -5225,8 +5224,8 @@ test_println(" bytes");]]></value> <value />
</tags>
<code>
- <value><![CDATA[test_print("--- Timer : "); -test_printn(sizeof(virtual_timer_t)); + <value><![CDATA[test_print("--- Timer : ");
+test_printn(sizeof(virtual_timer_t));
test_println(" bytes");]]></value>
</code>
</step>
@@ -5238,10 +5237,10 @@ test_println(" bytes");]]></value> <value />
</tags>
<code>
- <value><![CDATA[#if CH_CFG_USE_SEMAPHORES || defined(__DOXYGEN__) -test_print("--- Semaph: "); -test_printn(sizeof(semaphore_t)); -test_println(" bytes"); + <value><![CDATA[#if CH_CFG_USE_SEMAPHORES || defined(__DOXYGEN__)
+test_print("--- Semaph: ");
+test_printn(sizeof(semaphore_t));
+test_println(" bytes");
#endif]]></value>
</code>
</step>
@@ -5253,10 +5252,10 @@ test_println(" bytes"); <value />
</tags>
<code>
- <value><![CDATA[#if CH_CFG_USE_MUTEXES || defined(__DOXYGEN__) -test_print("--- Mutex : "); -test_printn(sizeof(mutex_t)); -test_println(" bytes"); + <value><![CDATA[#if CH_CFG_USE_MUTEXES || defined(__DOXYGEN__)
+test_print("--- Mutex : ");
+test_printn(sizeof(mutex_t));
+test_println(" bytes");
#endif]]></value>
</code>
</step>
@@ -5268,10 +5267,10 @@ test_println(" bytes"); <value />
</tags>
<code>
- <value><![CDATA[#if CH_CFG_USE_CONDVARS || defined(__DOXYGEN__) -test_print("--- CondV.: "); -test_printn(sizeof(condition_variable_t)); -test_println(" bytes"); + <value><![CDATA[#if CH_CFG_USE_CONDVARS || defined(__DOXYGEN__)
+test_print("--- CondV.: ");
+test_printn(sizeof(condition_variable_t));
+test_println(" bytes");
#endif]]></value>
</code>
</step>
@@ -5283,10 +5282,10 @@ test_println(" bytes"); <value />
</tags>
<code>
- <value><![CDATA[#if CH_CFG_USE_EVENTS || defined(__DOXYGEN__) -test_print("--- EventS: "); -test_printn(sizeof(event_source_t)); -test_println(" bytes"); + <value><![CDATA[#if CH_CFG_USE_EVENTS || defined(__DOXYGEN__)
+test_print("--- EventS: ");
+test_printn(sizeof(event_source_t));
+test_println(" bytes");
#endif]]></value>
</code>
</step>
@@ -5298,10 +5297,10 @@ test_println(" bytes"); <value />
</tags>
<code>
- <value><![CDATA[#if CH_CFG_USE_EVENTS || defined(__DOXYGEN__) -test_print("--- EventL: "); -test_printn(sizeof(event_listener_t)); -test_println(" bytes"); + <value><![CDATA[#if CH_CFG_USE_EVENTS || defined(__DOXYGEN__)
+test_print("--- EventL: ");
+test_printn(sizeof(event_listener_t));
+test_println(" bytes");
#endif]]></value>
</code>
</step>
@@ -5313,10 +5312,10 @@ test_println(" bytes"); <value />
</tags>
<code>
- <value><![CDATA[#if CH_CFG_USE_MAILBOXES || defined(__DOXYGEN__) -test_print("--- MailB.: "); -test_printn(sizeof(mailbox_t)); -test_println(" bytes"); + <value><![CDATA[#if CH_CFG_USE_MAILBOXES || defined(__DOXYGEN__)
+test_print("--- MailB.: ");
+test_printn(sizeof(mailbox_t));
+test_println(" bytes");
#endif]]></value>
</code>
</step>
diff --git a/test/rt/source/test/test_sequence_010.c b/test/rt/source/test/test_sequence_010.c index 58ed0b73e..1a5833778 100644 --- a/test/rt/source/test/test_sequence_010.c +++ b/test/rt/source/test/test_sequence_010.c @@ -58,11 +58,10 @@ static MEMORYPOOL_DECL(mp1, sizeof (uint32_t), NULL); static GUARDEDMEMORYPOOL_DECL(gmp1, sizeof (uint32_t));
#endif
-static void *null_provider(size_t size, unsigned align, size_t offset) {
+static void *null_provider(size_t size, unsigned align) {
(void)size;
(void)align;
- (void)offset;
return NULL;
}
|