diff options
Diffstat (limited to 'test/rt/configuration.xml')
-rw-r--r-- | test/rt/configuration.xml | 2615 |
1 files changed, 1309 insertions, 1306 deletions
diff --git a/test/rt/configuration.xml b/test/rt/configuration.xml index 056687afe..75e1b1966 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>
@@ -31,118 +31,121 @@ </introduction>
</description>
<global_data_and_code>
+ <code_prefix>
+ <value>rt_</value>
+ </code_prefix>
<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)
-
-#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);
+ <value><![CDATA[#define TEST_SUITE_NAME "ChibiOS/RT Test Suite" + +/* + * Allowed delay in timeout checks. + */ +#define ALLOWED_DELAY TIME_MS2I(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); systime_t test_wait_tick(void);]]></value>
</global_definitions>
<global_code>
- <value><![CDATA[void test_print_port_info(void) {
-
-#ifdef PORT_COMPILER_NAME
- test_print("*** Compiler: ");
- test_println(PORT_COMPILER_NAME);
-#endif
- test_print("*** Architecture: ");
- test_println(PORT_ARCHITECTURE_NAME);
-#ifdef PORT_CORE_VARIANT_NAME
- test_print("*** Core Variant: ");
- test_println(PORT_CORE_VARIANT_NAME);
-#endif
-#ifdef PORT_INFO
- test_print("*** Port Info: ");
- test_println(PORT_INFO);
-#endif
-}
-
-/*
- * 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><![CDATA[void test_print_port_info(void) { + +#ifdef PORT_COMPILER_NAME + test_print("*** Compiler: "); + test_println(PORT_COMPILER_NAME); +#endif + test_print("*** Architecture: "); + test_println(PORT_ARCHITECTURE_NAME); +#ifdef PORT_CORE_VARIANT_NAME + test_print("*** Core Variant: "); + test_println(PORT_CORE_VARIANT_NAME); +#endif +#ifdef PORT_INFO + test_print("*** Port Info: "); + test_println(PORT_INFO); +#endif +} + +/* + * 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>
@@ -194,20 +197,20 @@ systime_t test_wait_tick(void) { <value />
</tags>
<code>
- <value><![CDATA[test_println("--- Product: ChibiOS/RT");
-test_print("--- Stable Flag: ");
-test_printn(CH_KERNEL_STABLE);
-test_println("");
-test_print("--- Version String: ");
-test_println(CH_KERNEL_VERSION);
-test_print("--- Major Number: ");
-test_printn(CH_KERNEL_MAJOR);
-test_println("");
-test_print("--- Minor Number: ");
-test_printn(CH_KERNEL_MINOR);
-test_println("");
-test_print("--- Patch Number: ");
-test_printn(CH_KERNEL_PATCH);
+ <value><![CDATA[test_println("--- Product: ChibiOS/RT"); +test_print("--- Stable Flag: "); +test_printn(CH_KERNEL_STABLE); +test_println(""); +test_print("--- Version String: "); +test_println(CH_KERNEL_VERSION); +test_print("--- Major Number: "); +test_printn(CH_KERNEL_MAJOR); +test_println(""); +test_print("--- Minor Number: "); +test_printn(CH_KERNEL_MINOR); +test_println(""); +test_print("--- Patch Number: "); +test_printn(CH_KERNEL_PATCH); test_println("");]]></value>
</code>
</step>
@@ -243,107 +246,107 @@ test_println("");]]></value> <value />
</tags>
<code>
- <value><![CDATA[test_print("--- CH_CFG_ST_RESOLUTION: ");
-test_printn(CH_CFG_ST_RESOLUTION);
-test_println("");
-test_print("--- CH_CFG_ST_FREQUENCY: ");
-test_printn(CH_CFG_ST_FREQUENCY);
-test_println("");
-test_print("--- CH_CFG_ST_TIMEDELTA: ");
-test_printn(CH_CFG_ST_TIMEDELTA);
-test_println("");
-test_print("--- CH_CFG_TIME_QUANTUM: ");
-test_printn(CH_CFG_TIME_QUANTUM);
-test_println("");
-test_print("--- CH_CFG_MEMCORE_SIZE: ");
-test_printn(CH_CFG_MEMCORE_SIZE);
-test_println("");
-test_print("--- CH_CFG_NO_IDLE_THREAD: ");
-test_printn(CH_CFG_NO_IDLE_THREAD);
-test_println("");
-test_print("--- CH_CFG_OPTIMIZE_SPEED: ");
-test_printn(CH_CFG_OPTIMIZE_SPEED);
-test_println("");
-test_print("--- CH_CFG_USE_TM: ");
-test_printn(CH_CFG_USE_TM);
-test_println("");
-test_print("--- CH_CFG_USE_REGISTRY: ");
-test_printn(CH_CFG_USE_REGISTRY);
-test_println("");
-test_print("--- CH_CFG_USE_WAITEXIT: ");
-test_printn(CH_CFG_USE_WAITEXIT);
-test_println("");
-test_print("--- CH_CFG_USE_SEMAPHORES: ");
-test_printn(CH_CFG_USE_SEMAPHORES);
-test_println("");
-test_print("--- CH_CFG_USE_SEMAPHORES_PRI: ");
-test_printn(CH_CFG_USE_SEMAPHORES_PRIORITY);
-test_println("");
-test_print("--- CH_CFG_USE_MUTEXES: ");
-test_printn(CH_CFG_USE_MUTEXES);
-test_println("");
-test_print("--- CH_CFG_USE_MUTEXES_RECURS: ");
-test_printn(CH_CFG_USE_MUTEXES_RECURSIVE);
-test_println("");
-test_print("--- CH_CFG_USE_CONDVARS: ");
-test_printn(CH_CFG_USE_CONDVARS);
-test_println("");
-test_print("--- CH_CFG_USE_CONDVARS_TIMEO: ");
-test_printn(CH_CFG_USE_CONDVARS_TIMEOUT);
-test_println("");
-test_print("--- CH_CFG_USE_EVENTS: ");
-test_printn(CH_CFG_USE_EVENTS);
-test_println("");
-test_print("--- CH_CFG_USE_EVENTS_TIMEOUT: ");
-test_printn(CH_CFG_USE_EVENTS_TIMEOUT);
-test_println("");
-test_print("--- CH_CFG_USE_MESSAGES: ");
-test_printn(CH_CFG_USE_MESSAGES);
-test_println("");
-test_print("--- CH_CFG_USE_MESSAGES_PRI: ");
-test_printn(CH_CFG_USE_MESSAGES_PRIORITY);
-test_println("");
-test_print("--- CH_CFG_USE_MAILBOXES: ");
-test_printn(CH_CFG_USE_MAILBOXES);
-test_println("");
-test_print("--- CH_CFG_USE_MEMCORE: ");
-test_printn(CH_CFG_USE_MEMCORE);
-test_println("");
-test_print("--- CH_CFG_USE_HEAP: ");
-test_printn(CH_CFG_USE_HEAP);
-test_println("");
-test_print("--- CH_CFG_USE_MEMPOOLS: ");
-test_printn(CH_CFG_USE_MEMPOOLS);
-test_println("");
-test_print("--- CH_CFG_USE_DYNAMIC: ");
-test_printn(CH_CFG_USE_DYNAMIC);
-test_println("");
-test_print("--- CH_DBG_STATISTICS: ");
-test_printn(CH_DBG_STATISTICS);
-test_println("");
-test_print("--- CH_DBG_SYSTEM_STATE_CHECK: ");
-test_printn(CH_DBG_SYSTEM_STATE_CHECK);
-test_println("");
-test_print("--- CH_DBG_ENABLE_CHECKS: ");
-test_printn(CH_DBG_ENABLE_CHECKS);
-test_println("");
-test_print("--- CH_DBG_ENABLE_ASSERTS: ");
-test_printn(CH_DBG_ENABLE_ASSERTS);
-test_println("");
-test_print("--- CH_DBG_TRACE_MASK: ");
-test_printn(CH_DBG_TRACE_MASK);
-test_println("");
-test_print("--- CH_DBG_TRACE_BUFFER_SIZE: ");
-test_printn(CH_DBG_TRACE_BUFFER_SIZE);
-test_println("");
-test_print("--- CH_DBG_ENABLE_STACK_CHECK: ");
-test_printn(CH_DBG_ENABLE_STACK_CHECK);
-test_println("");
-test_print("--- CH_DBG_FILL_THREADS: ");
-test_printn(CH_DBG_FILL_THREADS);
-test_println("");
-test_print("--- CH_DBG_THREADS_PROFILING: ");
-test_printn(CH_DBG_THREADS_PROFILING);
+ <value><![CDATA[test_print("--- CH_CFG_ST_RESOLUTION: "); +test_printn(CH_CFG_ST_RESOLUTION); +test_println(""); +test_print("--- CH_CFG_ST_FREQUENCY: "); +test_printn(CH_CFG_ST_FREQUENCY); +test_println(""); +test_print("--- CH_CFG_ST_TIMEDELTA: "); +test_printn(CH_CFG_ST_TIMEDELTA); +test_println(""); +test_print("--- CH_CFG_TIME_QUANTUM: "); +test_printn(CH_CFG_TIME_QUANTUM); +test_println(""); +test_print("--- CH_CFG_MEMCORE_SIZE: "); +test_printn(CH_CFG_MEMCORE_SIZE); +test_println(""); +test_print("--- CH_CFG_NO_IDLE_THREAD: "); +test_printn(CH_CFG_NO_IDLE_THREAD); +test_println(""); +test_print("--- CH_CFG_OPTIMIZE_SPEED: "); +test_printn(CH_CFG_OPTIMIZE_SPEED); +test_println(""); +test_print("--- CH_CFG_USE_TM: "); +test_printn(CH_CFG_USE_TM); +test_println(""); +test_print("--- CH_CFG_USE_REGISTRY: "); +test_printn(CH_CFG_USE_REGISTRY); +test_println(""); +test_print("--- CH_CFG_USE_WAITEXIT: "); +test_printn(CH_CFG_USE_WAITEXIT); +test_println(""); +test_print("--- CH_CFG_USE_SEMAPHORES: "); +test_printn(CH_CFG_USE_SEMAPHORES); +test_println(""); +test_print("--- CH_CFG_USE_SEMAPHORES_PRI: "); +test_printn(CH_CFG_USE_SEMAPHORES_PRIORITY); +test_println(""); +test_print("--- CH_CFG_USE_MUTEXES: "); +test_printn(CH_CFG_USE_MUTEXES); +test_println(""); +test_print("--- CH_CFG_USE_MUTEXES_RECURS: "); +test_printn(CH_CFG_USE_MUTEXES_RECURSIVE); +test_println(""); +test_print("--- CH_CFG_USE_CONDVARS: "); +test_printn(CH_CFG_USE_CONDVARS); +test_println(""); +test_print("--- CH_CFG_USE_CONDVARS_TIMEO: "); +test_printn(CH_CFG_USE_CONDVARS_TIMEOUT); +test_println(""); +test_print("--- CH_CFG_USE_EVENTS: "); +test_printn(CH_CFG_USE_EVENTS); +test_println(""); +test_print("--- CH_CFG_USE_EVENTS_TIMEOUT: "); +test_printn(CH_CFG_USE_EVENTS_TIMEOUT); +test_println(""); +test_print("--- CH_CFG_USE_MESSAGES: "); +test_printn(CH_CFG_USE_MESSAGES); +test_println(""); +test_print("--- CH_CFG_USE_MESSAGES_PRI: "); +test_printn(CH_CFG_USE_MESSAGES_PRIORITY); +test_println(""); +test_print("--- CH_CFG_USE_MAILBOXES: "); +test_printn(CH_CFG_USE_MAILBOXES); +test_println(""); +test_print("--- CH_CFG_USE_MEMCORE: "); +test_printn(CH_CFG_USE_MEMCORE); +test_println(""); +test_print("--- CH_CFG_USE_HEAP: "); +test_printn(CH_CFG_USE_HEAP); +test_println(""); +test_print("--- CH_CFG_USE_MEMPOOLS: "); +test_printn(CH_CFG_USE_MEMPOOLS); +test_println(""); +test_print("--- CH_CFG_USE_DYNAMIC: "); +test_printn(CH_CFG_USE_DYNAMIC); +test_println(""); +test_print("--- CH_DBG_STATISTICS: "); +test_printn(CH_DBG_STATISTICS); +test_println(""); +test_print("--- CH_DBG_SYSTEM_STATE_CHECK: "); +test_printn(CH_DBG_SYSTEM_STATE_CHECK); +test_println(""); +test_print("--- CH_DBG_ENABLE_CHECKS: "); +test_printn(CH_DBG_ENABLE_CHECKS); +test_println(""); +test_print("--- CH_DBG_ENABLE_ASSERTS: "); +test_printn(CH_DBG_ENABLE_ASSERTS); +test_println(""); +test_print("--- CH_DBG_TRACE_MASK: "); +test_printn(CH_DBG_TRACE_MASK); +test_println(""); +test_print("--- CH_DBG_TRACE_BUFFER_SIZE: "); +test_printn(CH_DBG_TRACE_BUFFER_SIZE); +test_println(""); +test_print("--- CH_DBG_ENABLE_STACK_CHECK: "); +test_printn(CH_DBG_ENABLE_STACK_CHECK); +test_println(""); +test_print("--- CH_DBG_FILL_THREADS: "); +test_printn(CH_DBG_FILL_THREADS); +test_println(""); +test_print("--- CH_DBG_THREADS_PROFILING: "); +test_printn(CH_DBG_THREADS_PROFILING); test_println("");]]></value>
</code>
</step>
@@ -365,21 +368,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 +416,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 +430,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 +444,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 +458,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 +484,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 +497,7 @@ virtual_timer_t vt;]]></value> <value />
</tags>
<code>
- <value><![CDATA[sts = chSysGetStatusAndLockX();
+ <value><![CDATA[sts = chSysGetStatusAndLockX(); chSysRestoreStatusX(sts);]]></value>
</code>
</step>
@@ -506,9 +509,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 +523,8 @@ chSysUnlock();]]></value> <value />
</tags>
<code>
- <value><![CDATA[chSysUnconditionalLock();
-chSysUnconditionalLock();
+ <value><![CDATA[chSysUnconditionalLock(); +chSysUnconditionalLock(); chSysUnlock();]]></value>
</code>
</step>
@@ -533,8 +536,8 @@ chSysUnlock();]]></value> <value />
</tags>
<code>
- <value><![CDATA[chSysLock();
-chSysUnconditionalUnlock();
+ <value><![CDATA[chSysLock(); +chSysUnconditionalUnlock(); chSysUnconditionalUnlock();]]></value>
</code>
</step>
@@ -546,10 +549,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 +588,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 +626,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 +652,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 +688,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 +703,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 + TIME_US2I(100000), + time + TIME_US2I(100000) + CH_CFG_ST_TIMEDELTA + 1, "out of time window");]]></value>
</code>
</step>
@@ -715,10 +718,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 + TIME_MS2I(100), + time + TIME_MS2I(100) + CH_CFG_ST_TIMEDELTA + 1, "out of time window");]]></value>
</code>
</step>
@@ -730,10 +733,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 + TIME_S2I(1), + time + TIME_S2I(1) + CH_CFG_ST_TIMEDELTA + 1, "out of time window");]]></value>
</code>
</step>
@@ -745,10 +748,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 +787,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 +804,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 +821,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 +862,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 +876,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 +913,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 +926,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 +940,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 +954,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 +978,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 +1008,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 +1021,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 +1038,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, TIME_MS2I(1000)); +chSysUnlock(); +test_assert_time_window(time + TIME_MS2I(1000), + time + TIME_MS2I(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 +1067,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 +1130,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 +1145,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 +1157,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 +1193,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 +1208,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 +1241,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 +1255,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 +1269,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, TIME_MS2I(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 +1286,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() + TIME_MS2I(5 * 50); +for (i = 0; i < 5; i++) { + test_emit_token('A' + i); + msg = chSemWaitTimeout(&sem1, TIME_MS2I(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 +1342,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 +1394,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 +1407,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 +1432,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 +1445,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 +1457,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 +1469,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 +1481,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 +1494,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 +1507,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 +1530,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 + TIME_MS2I(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 +1757,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 +1772,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 +1821,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 +1836,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 + TIME_MS2I(100), time + TIME_MS2I(100) + ALLOWED_DELAY, "out of time window");]]></value>
</code>
</step>
@@ -1851,7 +1854,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 +1884,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 +1901,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 + TIME_MS2I(110), time + TIME_MS2I(110) + ALLOWED_DELAY, "out of time window");]]></value>
</code>
</step>
@@ -1917,7 +1920,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 +1939,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 +1952,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 +1964,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 +1976,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 +1988,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 +2000,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 +2012,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 +2024,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 +2048,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 +2072,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 +2084,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 +2096,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 +2120,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 +2161,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 +2185,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 +2197,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 +2209,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 +2221,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 +2245,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 +2268,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 +2307,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 +2326,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 +2342,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 +2369,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 +2388,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 +2404,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 +2423,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 +2509,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 +2531,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 +2559,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 +2572,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 +2584,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 +2614,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 +2679,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 +2692,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 +2704,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 +2740,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 +2764,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 +2788,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 +2806,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() + TIME_MS2I(50); +threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX() - 1, evt_thread3, chThdGetSelfX());]]></value>
</code>
</step>
@@ -2816,12 +2819,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 +2848,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 +2872,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 +2886,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() + TIME_MS2I(50); +threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX() - 1, evt_thread3, chThdGetSelfX());]]></value>
</code>
</step>
@@ -2896,12 +2899,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 +2928,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 +2952,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 +2977,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() + TIME_MS2I(50); +threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX() - 1, evt_thread3, chThdGetSelfX());]]></value>
</code>
</step>
@@ -2987,12 +2990,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 +3031,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 +3047,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, TIME_MS2I(50)); +test_assert(m == 0, "spurious event"); +m = chEvtWaitAnyTimeout(ALL_EVENTS, TIME_MS2I(50)); +test_assert(m == 0, "spurious event"); +m = chEvtWaitAllTimeout(ALL_EVENTS, TIME_MS2I(50)); test_assert(m == 0, "spurious event");]]></value>
</code>
</step>
@@ -3066,16 +3069,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 +3091,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 +3103,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() + TIME_MS2I(50); +threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX() - 1, evt_thread7, "A");]]></value>
</code>
</step>
@@ -3113,11 +3116,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 +3132,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 +3156,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 +3180,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 +3204,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>
@@ -3216,12 +3219,12 @@ test_assert_lock(mb1.buffer == mb1.rdptr, "read pointer not aligned to base");]] <value />
</tags>
<code>
- <value><![CDATA[msg1 = chMBPostTimeout(&mb1, (msg_t)0, TIME_INFINITE);
-test_assert(msg1 == MSG_RESET, "not in reset state");
-msg1 = chMBPostAheadTimeout(&mb1, (msg_t)0, TIME_INFINITE);
-test_assert(msg1 == MSG_RESET, "not in reset state");
-msg1 = chMBFetchTimeout(&mb1, &msg2, TIME_INFINITE);
-test_assert(msg1 == MSG_RESET, "not in reset state");
+ <value><![CDATA[msg1 = chMBPostTimeout(&mb1, (msg_t)0, TIME_INFINITE); +test_assert(msg1 == MSG_RESET, "not in reset state"); +msg1 = chMBPostAheadTimeout(&mb1, (msg_t)0, TIME_INFINITE); +test_assert(msg1 == MSG_RESET, "not in reset state"); +msg1 = chMBFetchTimeout(&mb1, &msg2, TIME_INFINITE); +test_assert(msg1 == MSG_RESET, "not in reset state"); chMBResumeX(&mb1);]]></value>
</code>
</step>
@@ -3233,11 +3236,11 @@ chMBResumeX(&mb1);]]></value> <value />
</tags>
<code>
- <value><![CDATA[for (i = 0; i < MB_SIZE - 1; i++) {
- msg1 = chMBPostTimeout(&mb1, 'B' + i, TIME_INFINITE);
- test_assert(msg1 == MSG_OK, "wrong wake-up message");
-}
-msg1 = chMBPostAheadTimeout(&mb1, 'A', TIME_INFINITE);
+ <value><![CDATA[for (i = 0; i < MB_SIZE - 1; i++) { + msg1 = chMBPostTimeout(&mb1, 'B' + i, TIME_INFINITE); + test_assert(msg1 == MSG_OK, "wrong wake-up message"); +} +msg1 = chMBPostAheadTimeout(&mb1, 'A', TIME_INFINITE); test_assert(msg1 == MSG_OK, "wrong wake-up message");]]></value>
</code>
</step>
@@ -3249,8 +3252,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 +3265,11 @@ test_assert_lock(mb1.rdptr == mb1.wrptr, "pointers not aligned");]]></value> <value />
</tags>
<code>
- <value><![CDATA[for (i = 0; i < MB_SIZE; i++) {
- msg1 = chMBFetchTimeout(&mb1, &msg2, TIME_INFINITE);
- test_assert(msg1 == MSG_OK, "wrong wake-up message");
- test_emit_token(msg2);
-}
+ <value><![CDATA[for (i = 0; i < MB_SIZE; i++) { + msg1 = chMBFetchTimeout(&mb1, &msg2, TIME_INFINITE); + test_assert(msg1 == MSG_OK, "wrong wake-up message"); + test_emit_token(msg2); +} test_assert_sequence("ABCD", "wrong get sequence");]]></value>
</code>
</step>
@@ -3278,9 +3281,9 @@ test_assert_sequence("ABCD", "wrong get sequence");]]></value> <value />
</tags>
<code>
- <value><![CDATA[msg1 = chMBPostTimeout(&mb1, 'B' + i, TIME_INFINITE);
-test_assert(msg1 == MSG_OK, "wrong wake-up message");
-msg1 = chMBFetchTimeout(&mb1, &msg2, TIME_INFINITE);
+ <value><![CDATA[msg1 = chMBPostTimeout(&mb1, 'B' + i, TIME_INFINITE); +test_assert(msg1 == MSG_OK, "wrong wake-up message"); +msg1 = chMBFetchTimeout(&mb1, &msg2, TIME_INFINITE); test_assert(msg1 == MSG_OK, "wrong wake-up message");]]></value>
</code>
</step>
@@ -3292,9 +3295,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 +3321,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,13 +3345,13 @@ unsigned i;]]></value> <value />
</tags>
<code>
- <value><![CDATA[chSysLock();
-chMBResetI(&mb1);
-chSysUnlock();
-test_assert_lock(chMBGetFreeCountI(&mb1) == MB_SIZE, "not empty");
-test_assert_lock(chMBGetUsedCountI(&mb1) == 0, "still full");
-test_assert_lock(mb1.buffer == mb1.wrptr, "write pointer not aligned to base");
-test_assert_lock(mb1.buffer == mb1.rdptr, "read pointer not aligned to base");
+ <value><![CDATA[chSysLock(); +chMBResetI(&mb1); +chSysUnlock(); +test_assert_lock(chMBGetFreeCountI(&mb1) == MB_SIZE, "not empty"); +test_assert_lock(chMBGetUsedCountI(&mb1) == 0, "still full"); +test_assert_lock(mb1.buffer == mb1.wrptr, "write pointer not aligned to base"); +test_assert_lock(mb1.buffer == mb1.rdptr, "read pointer not aligned to base"); chMBResumeX(&mb1);]]></value>
</code>
</step>
@@ -3360,15 +3363,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 +3383,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 +3396,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 +3414,9 @@ test_assert_sequence("ABCD", "wrong get sequence");]]></value> <value />
</tags>
<code>
- <value><![CDATA[msg1 = chMBPostTimeout(&mb1, 'B' + i, TIME_INFINITE);
-test_assert(msg1 == MSG_OK, "wrong wake-up message");
-msg1 = chMBFetchTimeout(&mb1, &msg2, TIME_INFINITE);
+ <value><![CDATA[msg1 = chMBPostTimeout(&mb1, 'B' + i, TIME_INFINITE); +test_assert(msg1 == MSG_OK, "wrong wake-up message"); +msg1 = chMBFetchTimeout(&mb1, &msg2, TIME_INFINITE); test_assert(msg1 == MSG_OK, "wrong wake-up message");]]></value>
</code>
</step>
@@ -3425,9 +3428,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 +3454,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 +3467,9 @@ unsigned i;]]></value> <value />
</tags>
<code>
- <value><![CDATA[for (i = 0; i < MB_SIZE; i++) {
- msg1 = chMBPostTimeout(&mb1, 'B' + i, TIME_INFINITE);
- test_assert(msg1 == MSG_OK, "wrong wake-up message");
+ <value><![CDATA[for (i = 0; i < MB_SIZE; i++) { + msg1 = chMBPostTimeout(&mb1, 'B' + i, TIME_INFINITE); + test_assert(msg1 == MSG_OK, "wrong wake-up message"); }]]></value>
</code>
</step>
@@ -3478,17 +3481,17 @@ unsigned i;]]></value> <value />
</tags>
<code>
- <value><![CDATA[msg1 = chMBPostTimeout(&mb1, 'X', 1);
-test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");
-chSysLock();
-msg1 = chMBPostI(&mb1, 'X');
-chSysUnlock();
-test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");
-msg1 = chMBPostAheadTimeout(&mb1, 'X', 1);
-test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");
-chSysLock();
-msg1 = chMBPostAheadI(&mb1, 'X');
-chSysUnlock();
+ <value><![CDATA[msg1 = chMBPostTimeout(&mb1, 'X', 1); +test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message"); +chSysLock(); +msg1 = chMBPostI(&mb1, 'X'); +chSysUnlock(); +test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message"); +msg1 = chMBPostAheadTimeout(&mb1, 'X', 1); +test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message"); +chSysLock(); +msg1 = chMBPostAheadI(&mb1, 'X'); +chSysUnlock(); test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");]]></value>
</code>
</step>
@@ -3500,7 +3503,7 @@ test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");]]></value> <value />
</tags>
<code>
- <value><![CDATA[chMBReset(&mb1);
+ <value><![CDATA[chMBReset(&mb1); chMBResumeX(&mb1);]]></value>
</code>
</step>
@@ -3512,11 +3515,11 @@ chMBResumeX(&mb1);]]></value> <value />
</tags>
<code>
- <value><![CDATA[msg1 = chMBFetchTimeout(&mb1, &msg2, 1);
-test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");
-chSysLock();
-msg1 = chMBFetchI(&mb1, &msg2);
-chSysUnlock();
+ <value><![CDATA[msg1 = chMBFetchTimeout(&mb1, &msg2, 1); +test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message"); +chSysLock(); +msg1 = chMBFetchI(&mb1, &msg2); +chSysUnlock(); test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");]]></value>
</code>
</step>
@@ -3538,21 +3541,21 @@ test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");]]></value> <value>CH_CFG_USE_MEMPOOLS</value>
</condition>
<shared_code>
- <value><![CDATA[#define MEMORY_POOL_SIZE 4
-
-static uint32_t objects[MEMORY_POOL_SIZE];
-static MEMORYPOOL_DECL(mp1, sizeof (uint32_t), PORT_NATURAL_ALIGN, NULL);
-
-#if CH_CFG_USE_SEMAPHORES
-static GUARDEDMEMORYPOOL_DECL(gmp1, sizeof (uint32_t), PORT_NATURAL_ALIGN);
-#endif
-
-static void *null_provider(size_t size, unsigned align) {
-
- (void)size;
- (void)align;
-
- return NULL;
+ <value><![CDATA[#define MEMORY_POOL_SIZE 4 + +static uint32_t objects[MEMORY_POOL_SIZE]; +static MEMORYPOOL_DECL(mp1, sizeof (uint32_t), PORT_NATURAL_ALIGN, NULL); + +#if CH_CFG_USE_SEMAPHORES +static GUARDEDMEMORYPOOL_DECL(gmp1, sizeof (uint32_t), PORT_NATURAL_ALIGN); +#endif + +static void *null_provider(size_t size, unsigned align) { + + (void)size; + (void)align; + + return NULL; }]]></value>
</shared_code>
<cases>
@@ -3597,7 +3600,7 @@ static void *null_provider(size_t size, unsigned align) { <value />
</tags>
<code>
- <value><![CDATA[for (i = 0; i < MEMORY_POOL_SIZE; i++)
+ <value><![CDATA[for (i = 0; i < MEMORY_POOL_SIZE; i++) test_assert(chPoolAlloc(&mp1) != NULL, "list empty");]]></value>
</code>
</step>
@@ -3620,7 +3623,7 @@ static void *null_provider(size_t size, unsigned align) { <value />
</tags>
<code>
- <value><![CDATA[for (i = 0; i < MEMORY_POOL_SIZE; i++)
+ <value><![CDATA[for (i = 0; i < MEMORY_POOL_SIZE; i++) chPoolFree(&mp1, &objects[i]);]]></value>
</code>
</step>
@@ -3632,7 +3635,7 @@ static void *null_provider(size_t size, unsigned align) { <value />
</tags>
<code>
- <value><![CDATA[for (i = 0; i < MEMORY_POOL_SIZE; i++)
+ <value><![CDATA[for (i = 0; i < MEMORY_POOL_SIZE; i++) test_assert(chPoolAlloc(&mp1) != NULL, "list empty");]]></value>
</code>
</step>
@@ -3655,7 +3658,7 @@ static void *null_provider(size_t size, unsigned align) { <value />
</tags>
<code>
- <value><![CDATA[chPoolObjectInit(&mp1, sizeof (uint32_t), null_provider);
+ <value><![CDATA[chPoolObjectInit(&mp1, sizeof (uint32_t), null_provider); test_assert(chPoolAlloc(&mp1) == NULL, "provider returned memory");]]></value>
</code>
</step>
@@ -3702,7 +3705,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>
@@ -3725,7 +3728,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>
@@ -3737,7 +3740,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>
@@ -3784,7 +3787,7 @@ test_assert(chPoolAlloc(&mp1) == NULL, "provider returned memory");]]></value> <value />
</tags>
<code>
- <value><![CDATA[test_assert(chGuardedPoolAllocTimeout(&gmp1, MS2ST(100)) == NULL, "list not empty");]]></value>
+ <value><![CDATA[test_assert(chGuardedPoolAllocTimeout(&gmp1, TIME_MS2I(100)) == NULL, "list not empty");]]></value>
</code>
</step>
</steps>
@@ -3805,9 +3808,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>
@@ -3829,7 +3832,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>
@@ -3853,7 +3856,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>
@@ -3865,8 +3868,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>
@@ -3878,11 +3881,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>
@@ -3894,12 +3897,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>
@@ -3911,12 +3914,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>
@@ -3928,17 +3931,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>
@@ -3950,13 +3953,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>
@@ -3968,10 +3971,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>
@@ -3983,7 +3986,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>
@@ -4007,7 +4010,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>
@@ -4020,9 +4023,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>
@@ -4034,7 +4037,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>
@@ -4056,16 +4059,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>
@@ -4088,8 +4091,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>
@@ -4113,7 +4116,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>
@@ -4125,10 +4128,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>
@@ -4140,10 +4143,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>
@@ -4155,10 +4158,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>
@@ -4170,7 +4173,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>
@@ -4182,9 +4185,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>
@@ -4209,7 +4212,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>
@@ -4222,7 +4225,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>
@@ -4245,10 +4248,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>
@@ -4260,12 +4263,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>
@@ -4277,7 +4280,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>
@@ -4289,8 +4292,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>
@@ -4313,85 +4316,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 + TIME_MS2I(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>
@@ -4436,7 +4439,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>
@@ -4448,10 +4451,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>
@@ -4498,7 +4501,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>
@@ -4510,10 +4513,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>
@@ -4560,9 +4563,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>
@@ -4574,7 +4577,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>
@@ -4586,10 +4589,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>
@@ -4614,7 +4617,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>
@@ -4627,7 +4630,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>
@@ -4639,22 +4642,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 + TIME_MS2I(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>
@@ -4666,9 +4669,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>
@@ -4680,8 +4683,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>
@@ -4706,8 +4709,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>
@@ -4720,15 +4723,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 + TIME_MS2I(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>
@@ -4740,8 +4743,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>
@@ -4765,8 +4768,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>
@@ -4779,19 +4782,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 + TIME_MS2I(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>
@@ -4803,8 +4806,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>
@@ -4841,10 +4844,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>
@@ -4856,17 +4859,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 + TIME_MS2I(1000); +do { + chSemReset(&sem1, 0); + n++; +#if defined(SIMULATOR) + _sim_check_for_interrupts(); +#endif } while (chVTIsSystemTimeWithinX(start, end));]]></value>
</code>
</step>
@@ -4878,8 +4881,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>
@@ -4891,10 +4894,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>
@@ -4931,12 +4934,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>
@@ -4948,8 +4951,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>
@@ -4961,8 +4964,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>
@@ -4987,7 +4990,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>
@@ -5000,22 +5003,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 + TIME_MS2I(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>
@@ -5027,8 +5030,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>
@@ -5065,24 +5068,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 + TIME_MS2I(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>
@@ -5094,8 +5097,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>
@@ -5132,24 +5135,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 + TIME_MS2I(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>
@@ -5161,8 +5164,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>
@@ -5198,8 +5201,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>
@@ -5211,8 +5214,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>
@@ -5224,8 +5227,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>
@@ -5237,10 +5240,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>
@@ -5252,10 +5255,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>
@@ -5267,10 +5270,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>
@@ -5282,10 +5285,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>
@@ -5297,10 +5300,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>
@@ -5312,10 +5315,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>
|