/****************************************************************************** ** Function: CFE_PSP_DeleteOSResources() ** ** Purpose: ** Clean up any OS resources when exiting from the cFE ** ** Arguments: ** (none) ** ** Return: ** (none) */ void CFE_PSP_DeleteOSResources (void) { uint32 i; int32 ReturnCode; for ( i = 0; i < OS_MAX_TASKS; i++) ReturnCode = OS_TaskDelete(i); printf("CFE_PSP: Deleted all Tasks in system\n"); for ( i = 0; i < OS_MAX_BIN_SEMAPHORES; i++ ) ReturnCode = OS_BinSemDelete(i); printf("CFE_PSP: Deleted all Binary Semaphores in system\n"); for ( i = 0; i < OS_MAX_COUNT_SEMAPHORES; i++ ) ReturnCode = OS_CountSemDelete(i); printf("CFE_PSP: Deleted all Counting Semaphores in system\n"); for ( i = 0; i < OS_MAX_MUTEXES; i++ ) ReturnCode = OS_MutSemDelete(i); printf("CFE_PSP: Deleted all Mutexes in system\n"); for ( i = 0; i < OS_MAX_QUEUES; i++ ) ReturnCode = OS_QueueDelete(i); printf("CFE_PSP: Deleted all Queues in system\n"); for ( i = 0; i < OS_MAX_TIMERS; i++ ) ReturnCode = OS_TimerDelete(i); printf("CFE_PSP: Deleted all Timers in system\n"); printf("CFE_PSP: NOTE: After quitting the cFE with a Control-C signal, it MUST be started next time\n"); printf(" with a Poweron Reset ( --reset PO ). \n"); }
static void nasa_osal_test_002_003_teardown(void) { if (qid != 0) { (void) OS_QueueDelete(qid); } if (tid != 0) { (void) OS_TaskWait(tid); } }
static void nasa_osal_test_002_001_execute(void) { /* [2.1.1] OS_QueueCreate() is invoked with queue_id set to NULL, an error is expected.*/ test_set_step(1); { int32 err; err = OS_QueueCreate(NULL, /* Error.*/ "failing queue", 4, 128, 0); test_assert(err == OS_INVALID_POINTER, "NULL not detected"); } /* [2.1.2] OS_QueueCreate() is invoked with task_name set to NULL, an error is expected.*/ test_set_step(2); { int32 err; uint32 qid; err = OS_QueueCreate(&qid, NULL, /* Error.*/ 4, 128, 0); test_assert(err == OS_INVALID_POINTER, "NULL not detected"); } /* [2.1.3] OS_QueueCreate() is invoked with a very long task name, an error is expected.*/ test_set_step(3); { int32 err; uint32 qid; err = OS_QueueCreate(&qid, "very very long queue name", /* Error.*/ 4, 128, 0); test_assert(err == OS_ERR_NAME_TOO_LONG, "name limit not detected"); } /* [2.1.4] OS_QueueDelete() is invoked with queue_id set to -1, an error is expected.*/ test_set_step(4); { int32 err; err = OS_QueueDelete((uint32)-1); test_assert(err == OS_ERR_INVALID_ID, "wrong queue id not detected"); } /* [2.1.5] OS_QueueCreate() is invoked twice with duplicated name, an error is expected, then the queue is deleted using OS_QueueDelete().*/ test_set_step(5); { int32 err; uint32 qid1, qid2; err = OS_QueueCreate(&qid1, "my queue", 4, 128, 0); test_assert(err == OS_SUCCESS, "queue creation failed"); err = OS_QueueCreate(&qid2, "my queue", 4, 128, 0); test_assert(err == OS_ERR_NAME_TAKEN, "name conflict not detected"); err = OS_QueueDelete(qid1); test_assert(err == OS_SUCCESS, "queue deletion failed"); } }
static void nasa_osal_test_002_004_teardown(void) { if (qid != 0) { OS_QueueDelete(qid); } }