From 342e9200a730a4231d9d5bf0050e7c2141b3ccdd Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Tue, 29 Mar 2016 10:34:51 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9177 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/rt/configuration.xml | 235 +++++++++++++++++++++++----------------------- 1 file changed, 119 insertions(+), 116 deletions(-) (limited to 'test/rt') diff --git a/test/rt/configuration.xml b/test/rt/configuration.xml index 338cc36ed..d524fcd08 100644 --- a/test/rt/configuration.xml +++ b/test/rt/configuration.xml @@ -71,6 +71,9 @@ union test_buffers { uint8_t buffer[WA_SIZE * 5]; }; +extern thread_t *threads[MAX_THREADS]; +extern void * ROMCONST wa[5]; + void test_terminate_threads(void); void test_wait_threads(void);]]> @@ -132,9 +135,7 @@ void test_wait_threads(void) { - - @@ -558,7 +557,7 @@ 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");]]> +test_assert_sequence("ABCDE", "invalid sequence");]]> @@ -575,7 +574,7 @@ 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");]]> +test_assert_sequence("ABCDE", "invalid sequence");]]> @@ -592,7 +591,7 @@ 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");]]> +test_assert_sequence("ABCDE", "invalid sequence");]]> @@ -627,9 +626,9 @@ test_assert_sequence("ABCDE");]]> - @@ -641,8 +640,8 @@ test_assert(chThdGetPriorityX() == prio + 1, "unexpected priority level");]]> - @@ -678,7 +677,8 @@ test_assert(chThdGetPriorityX() == prio, "unexpected priority level");]]> - prio += 2; + prio += 2; test_assert(chThdGetPriorityX() == prio + 2, "unexpected priority level");]]> @@ -690,9 +690,9 @@ test_assert(chThdGetPriorityX() == prio + 2, "unexpected priority level");]]> - prio == prio + 2, "unexpected priority level"); + prio == prio + 2, "unexpected priority level"); test_assert(chThdGetSelfX()->realprio == prio + 1, "unexpected returned real priority level");]]> @@ -704,9 +704,9 @@ test_assert(chThdGetSelfX()->realprio == prio + 1, "unexpected returned real pri - prio == prio + 3, "unexpected priority level"); + prio == prio + 3, "unexpected priority level"); test_assert(chThdGetSelfX()->realprio == prio + 3, "unexpected real priority level");]]> @@ -718,9 +718,9 @@ test_assert(chThdGetSelfX()->realprio == prio + 3, "unexpected real priority lev - prio = prio; -chThdGetSelfX()->realprio = prio; + prio = prio; +chThdGetSelfX()->realprio = prio; chSysUnlock();]]> @@ -733,79 +733,81 @@ chSysUnlock();]]> Internal Tests - Semaphores. + Suspend/Resume. - This sequence tests the ChibiOS/NIL functionalities related to counter semaphores. + This sequence tests the ChibiOS/RT functionalities related to threads suspend/resume. - CH_CFG_USE_SEMAPHORES + - + - Semaphore primitives, no state change. + Suspend and Resume functionality. - Wait, Signal and Reset primitives are tested. The testing thread does not trigger a state change. + The functionality of chThdSuspendTimeoutS() and chThdResumeI() is tested. - + - + - + - The function chSemWait() is invoked, after return the counter and the returned message are tested. - - - - - - - - - - - The function chSemSignal() is invoked, after return the counter is tested. + The function chThdSuspendTimeoutS() is invoked, the thread is remotely resumed with message @p MSG_OK. On return the message and the state of the reference are tested. - + - The function chSemReset() is invoked, after return the counter is tested. + The function chThdSuspendTimeoutS() is invoked, the thread is not resumed so a timeout must occur. On return the message and the state of the reference are tested. - + @@ -817,144 +819,145 @@ test_assert_lock(chSemGetCounterI(&sem1) == 2, "wrong counter value");]]>Internal Tests - Suspend/Resume and Event Flags. + Semaphores. - This sequence tests the ChibiOS/NIL functionalities related to threads suspend/resume and event flags. + This sequence tests the ChibiOS/NIL functionalities related to counter semaphores. - + CH_CFG_USE_SEMAPHORES - + - Suspend and Resume functionality. + Semaphore primitives, no state change. - The functionality of chThdSuspendTimeoutS() and chThdResumeI() is tested. + Wait, Signal and Reset primitives are tested. The testing thread does not trigger a state change. - + - + - + - The function chThdSuspendTimeoutS() is invoked, the thread is remotely resumed with message @p MSG_OK. On return the message and the state of the reference are tested. + The function chSemWait() is invoked, after return the counter and the returned message are tested. - + - The function chThdSuspendTimeoutS() is invoked, the thread is not resumed so a timeout must occur. On return the message and the state of the reference are tested. + The function chSemSignal() is invoked, after return the counter is tested. - + + + + + + The function chSemReset() is invoked, after return the counter is tested. + + + + + + - Events Flags functionality. + Semaphore enqueuing test. - Event flags functionality is tested. + Five threads with randomized priorities are enqueued to a semaphore then awakened one at time. The test expects that the threads reach their goal in FIFO order or priority order depending on the @p CH_CFG_USE_SEMAPHORES_PRIORITY configuration setting. - CH_CFG_USE_EVENTS + - + - + - A set of event flags are set on the current thread then the function chEvtWaitAnyTimeout() is invoked, the function is supposed to return immediately because the event flags are already pending, after return the events mask is tested. - - - - - - - - - - - The pending event flags mask is cleared then the function chEvtWaitAnyTimeout() is invoked, after return the events mask is tested. The thread is signaled by another thread. + Five threads are created with mixed priority levels (not increasing nor decreasing). Threads enqueue on a semaphore initialized to zero. - epmask = 0; -events = chEvtWaitAnyTimeout(ALL_EVENTS, MS2ST(1000)); -test_assert((eventmask_t)0 != events, "timed out"); -test_assert((eventmask_t)0x55 == events, "wrong events mask");]]> + - The function chEvtWaitAnyTimeout() is invoked, no event can wakeup the thread, the function must return because timeout. + The semaphore is signaled 5 times. The thread activation sequence is tested. - + -- cgit v1.2.3