From 8a88814260006d68ea27b7a851c81565b483cd8b Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Tue, 29 Mar 2016 12:36:24 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9178 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/rt/.cproject | 2 +- test/rt/configuration.xml | 382 +++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 365 insertions(+), 19 deletions(-) (limited to 'test/rt') diff --git a/test/rt/.cproject b/test/rt/.cproject index e849ada7d..e92ac3785 100644 --- a/test/rt/.cproject +++ b/test/rt/.cproject @@ -36,8 +36,8 @@ - + diff --git a/test/rt/configuration.xml b/test/rt/configuration.xml index d524fcd08..bd6bd6525 100644 --- a/test/rt/configuration.xml +++ b/test/rt/configuration.xml @@ -34,6 +34,11 @@ +void test_wait_threads(void); +systime_t test_wait_tick(void);]]> @@ -410,7 +422,7 @@ while (time == chVTGetSystemTimeX()) { Threads Functionality. - This sequence tests the ChibiOS/NIL functionalities related to threading. + This sequence tests the ChibiOS/RT functionalities related to threading. @@ -677,7 +689,7 @@ test_assert(chThdGetPriorityX() == prio, "unexpected priority level");]]> - prio += 2; test_assert(chThdGetPriorityX() == prio + 2, "unexpected priority level");]]> @@ -742,12 +754,12 @@ chSysUnlock();]]> - @@ -782,12 +794,12 @@ msg_t msg;]]> - @@ -819,10 +831,10 @@ test_assert(MSG_TIMEOUT == msg, "wrong returned message");]]> Internal Tests - Semaphores. + Counter and Binary Semaphores. - This sequence tests the ChibiOS/NIL functionalities related to counter semaphores. + This sequence tests the ChibiOS/RT functionalities related to counter semaphores. CH_CFG_USE_SEMAPHORES @@ -836,6 +848,28 @@ 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); }]]> @@ -962,8 +996,321 @@ test_wait_threads(); + + + Semaphore timeout test. + + + The three possible semaphore waiting modes (do not wait, wait with timeout, wait without timeout) are explored. The test expects that the semaphore wait function returns the correct value in each of the above scenario and that the semaphore structure status is correct after each operation. + + + + + + + + + + + + + + + + + + + Testing special case TIME_IMMEDIATE. + + + + + + + + + + + Testing non-timeout condition. + + + + + + + + + + + Testing timeout condition. + + + + + + + + + + + + + Testing chSemAddCounterI() functionality. + + + The functon is tested by waking up a thread then the semaphore counter value is tested. + + + + + + + + + + + + + + + + + + + A thread is created, it goes to wait on the semaphore. + + + + + + + + + + + The semaphore counter is increased by two, it is then tested to be one, the thread must have completed. + + + + + + + + + + + + + Testing chSemWaitSignal() functionality. + + + This test case explicitly addresses the @p chSemWaitSignal() function. A thread is created that performs a wait and a signal operations. The tester thread is awakened from an atomic wait/signal operation. The test expects that the semaphore wait function returns the correct value in each of the above scenario and that the semaphore structure status is correct after each operation. + + + + + + + + + + + + + + + + + + + An higher priority thread is created that performs non-atomical wait and signal operations on a semaphore. + + + + + + + + + + + The function chSemSignalWait() is invoked by specifying the same semaphore for the wait and signal phases. The counter value must be one on exit. + + + + + + + + + + + The function chSemSignalWait() is invoked again by specifying the same semaphore for the wait and signal phases. The counter value must be one on exit. + + + + + + + + + + + + + Testing Binary Semaphores special case. + + + This test case tests the binary semaphores functionality. The test both checks the binary semaphore status and the expected status of the underlying counting semaphore. + + + + + + + + + + + + + + + + + + + Creating a binary semaphore in "taken" state, the state is checked. + + + + + + + + + + + Resetting the binary semaphore in "taken" state, the state must not change. + + + + + + + + + + + Starting a signaler thread at a lower priority. + + + + + + + + + + + Waiting for the binary semaphore to be signaled, the semaphore is expected to be taken. + + + + + + + + + + + Signaling the binary semaphore, checking the binary semaphore state to be "not taken" and the underlying counter semaphore counter to be one. + + + + + + + + + + + Signaling the binary semaphore again, the internal state must not change from "not taken". + + + + + + + + + + + + + Internal Tests + + + Mutexes, Condition Variables and Priority Inheritance. + + + This sequence tests the ChibiOS/RT functionalities related to mutexes, condition variables and priority inheritance algorithm. + + + CH_CFG_USE_MUTEXES + + + + + + Internal Tests @@ -972,14 +1319,13 @@ test_wait_threads(); Mailboxes. - This sequence tests the ChibiOS/NIL functionalities related to mailboxes. + This sequence tests the ChibiOS/RT functionalities related to mailboxes. CH_CFG_USE_MAILBOXES - @@ -1339,7 +1685,7 @@ test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");]]> Memory Pools. - This sequence tests the ChibiOS/NIL functionalities related to memory pools. + This sequence tests the ChibiOS/RT functionalities related to memory pools. CH_CFG_USE_MEMPOOLS @@ -1603,7 +1949,7 @@ test_assert(chPoolAlloc(&mp1) == NULL, "provider returned memory");]]> Memory Heaps. - This sequence tests the ChibiOS/NIL functionalities related to memory heaps. + This sequence tests the ChibiOS/RT functionalities related to memory heaps. CH_CFG_USE_HEAP -- cgit v1.2.3