Test specification for the NASA OSAL ChibiOS extension. Test suite for NASA OSAL implementation over ChibiOS/RT. The purpose of this suite is to perform unit tests on the OSAL module and to converge to 100% code coverage through successive improvements. Internal Tests Tasks Functionality This sequence tests the NASA OSAL over ChibiOS/RT functionalities related to threading. OS_TaskCreate() errors Parameters checking in OS_TaskCreate() is tested. OS_TaskCreate() is invoked with task_id set to NULL, an error is expected. OS_TaskCreate() is invoked with task_name set to NULL, an error is expected. OS_TaskCreate() is invoked with stack_pointer set to NULL, an error is expected. OS_TaskCreate() is invoked with a very long task name, an error is expected. OS_TaskCreate() is invoked with priority below and above allowed range, an error is expected. OS_TaskCreate() is invoked with a stack size below minimum, an error is expected. OS_TaskCreate() is invoked twice with duplicated name and then duplicated stack, an error is expected in both cases. OS_TaskCreate() priority ordering Four tasks are created at different priorities and in different order. The execution order must happen in order of priority regardless the creation order. Four tasks are created in priority order from low to high. Tasks are made runnable atomically and their execution order tested. Four tasks are created in priority order from high to low. Tasks are made runnable atomically and their execution order tested. Four tasks are created in an not ordered way. Tasks are made runnable atomically and their execution order tested. OS_TaskDelete() errors Parameters checking in OS_TaskDelete() is tested. OS_TaskDelete() is invoked with task_id set to -1, an error is expected. OS_TaskDelete() and OS_TaskInstallDeleteHandler() functionality OS_TaskDelete() and OS_TaskInstallDeleteHandler() are tested for functionality. Creating a task executing an infinite loop. Letting the task run for a while then deleting it. A check is performed on the correct execution of the delete handler. Internal Tests Queues Functionality This sequence tests the NASA OSAL over ChibiOS/RT functionalities related to queues #include "osapi.h" uint32 qid, tid; #define WRITER_NUM_MESSAGES 16 #define MESSAGE_SIZE 20 static void test_task_writer(void) { unsigned i; int32 err; for (i = 0; i < WRITER_NUM_MESSAGES; i++) { err = OS_QueuePut(qid, "Hello World", 12, 0); if (err != OS_SUCCESS) { test_emit_token('*'); } } }]]> OS_QueueCreate() and OS_QueueDelete() errors Parameters checking in OS_QueueCreate() and OS_QueueDelete() is tested. OS_QueueCreate() is invoked with queue_id set to NULL, an error is expected. OS_QueueCreate() is invoked with task_name set to NULL, an error is expected. OS_QueueCreate() is invoked with a very long task name, an error is expected. OS_QueueDelete() is invoked with queue_id set to -1, an error is expected. OS_QueueCreate() is invoked twice with duplicated name, an error is expected, then the queue is deleted using OS_DeleteQueue(). OS_QueuePut() and OS_QueueGet() functionality A task writes on a queue, the messages are retrieved on the other side in blocking mode. Creataing a queue with depth 4 and message size 20 Creating the writer task. Reading messages from the writer task. Waiting for task termination then checking for errors. OS_QueueGetIdByName() errors Parameters checking in OS_QueueGetIdByName() is tested. OS_QueueGetIdByName() is invoked with queue_id set to NULL, an error is expected. OS_QueueGetIdByName() is invoked with queue_name set to NULL, an error is expected. OS_QueueGetIdByName() is invoked with a very long task name, an error is expected. OS_QueueGet() with timeout OS_QueueGetIdByName is tested. Retrieving the queue name. Get operation with a one second timeout, an error is expected. Get operation in non-blocking mode, an error is expected.