diff --git a/fsw/cfe-core/unit-test/es_UT.c b/fsw/cfe-core/unit-test/es_UT.c index b0416ad2a..d78d7a20b 100644 --- a/fsw/cfe-core/unit-test/es_UT.c +++ b/fsw/cfe-core/unit-test/es_UT.c @@ -712,7 +712,7 @@ void TestStartupErrorPaths(void) /* Perform ES main startup with a mutex creation failure */ ES_ResetUnitTest(); - UT_SetForceFail(UT_KEY(OS_MutSemCreate), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_MutSemCreate), OS_ERROR); UT_SetReadBuffer(StartupScript, strlen(StartupScript)); UT_SetDataBuffer(UT_KEY(CFE_PSP_Panic), &PanicStatus, sizeof(PanicStatus), false); CFE_ES_Main(CFE_PSP_RST_TYPE_POWERON, 1, 1, @@ -726,7 +726,7 @@ void TestStartupErrorPaths(void) /* Perform ES main startup with a file open failure */ ES_ResetUnitTest(); UT_SetDummyFuncRtn(OS_SUCCESS); - UT_SetForceFail(UT_KEY(OS_OpenCreate), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); UT_SetHookFunction(UT_KEY(OS_TaskCreate), ES_UT_SetAppStateHook, NULL); CFE_ES_Main(CFE_PSP_RST_TYPE_POWERON, 1, 1, (char *) CFE_PLATFORM_ES_NONVOL_STARTUP_FILE); @@ -860,9 +860,9 @@ void TestStartupErrorPaths(void) * following a failure to create the RAM volume */ ES_ResetUnitTest(); - UT_SetForceFail(UT_KEY(OS_initfs), OS_ERROR); - UT_SetForceFail(UT_KEY(OS_mount), OS_ERROR); - UT_SetForceFail(UT_KEY(OS_mkfs), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_initfs), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_mount), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_mkfs), OS_ERROR); CFE_ES_InitializeFileSystems(CFE_PSP_RST_TYPE_POWERON); UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_CREATE_VOLATILE]) && @@ -875,9 +875,9 @@ void TestStartupErrorPaths(void) * following a failure to reformat the RAM volume */ ES_ResetUnitTest(); - UT_SetForceFail(UT_KEY(OS_initfs), OS_ERROR); - UT_SetForceFail(UT_KEY(OS_mount), OS_ERROR); - UT_SetForceFail(UT_KEY(OS_mkfs), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_initfs), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_mount), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_mkfs), OS_ERROR); CFE_ES_InitializeFileSystems(CFE_PSP_RST_TYPE_PROCESSOR); UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_INSUFF_FREE_SPACE]) && @@ -893,7 +893,7 @@ void TestStartupErrorPaths(void) * following failure to get the volatile disk memory */ ES_ResetUnitTest(); - UT_SetForceFail(UT_KEY(CFE_PSP_GetVolatileDiskMem), CFE_PSP_ERROR); + UT_SetDefaultReturnValue(UT_KEY(CFE_PSP_GetVolatileDiskMem), CFE_PSP_ERROR); CFE_ES_InitializeFileSystems(CFE_PSP_RST_TYPE_PROCESSOR); UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_INSUFF_FREE_SPACE]) && @@ -905,7 +905,7 @@ void TestStartupErrorPaths(void) * reported is greater than the number of RAM disk sectors */ ES_ResetUnitTest(); - UT_SetForceFail(UT_KEY(OS_mount), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_mount), OS_ERROR); UT_SetDeferredRetcode(UT_KEY(OS_fsBlocksFree), 1, CFE_PLATFORM_ES_RAM_DISK_NUM_SECTORS + 1); CFE_ES_InitializeFileSystems(CFE_PSP_RST_TYPE_PROCESSOR); UT_Report(__FILE__, __LINE__, @@ -918,7 +918,7 @@ void TestStartupErrorPaths(void) * following a failure to remove the RAM volume */ ES_ResetUnitTest(); - UT_SetForceFail(UT_KEY(OS_rmfs), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_rmfs), OS_ERROR); CFE_ES_InitializeFileSystems(CFE_PSP_RST_TYPE_PROCESSOR); UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_INSUFF_FREE_SPACE]) && @@ -952,7 +952,7 @@ void TestStartupErrorPaths(void) * following a failure to remount the RAM volume */ ES_ResetUnitTest(); - UT_SetForceFail(UT_KEY(OS_mount), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_mount), OS_ERROR); CFE_ES_InitializeFileSystems(CFE_PSP_RST_TYPE_PROCESSOR); UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_INSUFF_FREE_SPACE]) && @@ -1022,8 +1022,8 @@ void TestStartupErrorPaths(void) * creating a core app */ ES_ResetUnitTest(); - UT_SetForceFail(UT_KEY(OS_TaskCreate), OS_ERROR); - UT_SetForceFail(UT_KEY(OS_BinSemCreate), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_TaskCreate), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_BinSemCreate), OS_ERROR); UT_SetHookFunction(UT_KEY(OS_TaskCreate), ES_UT_SetAppStateHook, NULL); CFE_ES_CreateObjects(); UT_Report(__FILE__, __LINE__, @@ -1089,8 +1089,8 @@ void TestStartupErrorPaths(void) * following a failure to initialize and mount the RAM volume */ ES_ResetUnitTest(); - UT_SetForceFail(UT_KEY(OS_initfs), OS_ERROR); - UT_SetForceFail(UT_KEY(OS_mount), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_initfs), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_mount), OS_ERROR); CFE_ES_InitializeFileSystems(CFE_PSP_RST_TYPE_PROCESSOR); UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_INSUFF_FREE_SPACE]) && @@ -1220,7 +1220,7 @@ void TestApps(void) /* Test starting an application with an open failure */ ES_ResetUnitTest(); - UT_SetForceFail(UT_KEY(OS_OpenCreate), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); CFE_ES_StartApplications(CFE_PSP_RST_TYPE_PROCESSOR, CFE_PLATFORM_ES_NONVOL_STARTUP_FILE); UT_Report(__FILE__, __LINE__, @@ -1267,7 +1267,7 @@ void TestApps(void) /* Test application loading and creation with a task creation failure */ ES_ResetUnitTest(); - UT_SetForceFail(UT_KEY(OS_TaskCreate), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_TaskCreate), OS_ERROR); Return = CFE_ES_AppCreate(&Id, "ut/filename", "EntryPoint", @@ -1559,7 +1559,7 @@ void TestApps(void) UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_RESTART; OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); - UT_SetForceFail(UT_KEY(OS_TaskCreate), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_TaskCreate), OS_ERROR); Id = CFE_ES_AppRecordGetID(UtAppRecPtr); CFE_ES_ProcessControlRequest(Id); UT_Report(__FILE__, __LINE__, @@ -1591,7 +1591,7 @@ void TestApps(void) UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_RELOAD; OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); - UT_SetForceFail(UT_KEY(OS_TaskCreate), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_TaskCreate), OS_ERROR); Id = CFE_ES_AppRecordGetID(UtAppRecPtr); CFE_ES_ProcessControlRequest(Id); UT_Report(__FILE__, __LINE__, @@ -1796,8 +1796,8 @@ void TestApps(void) ES_UT_SetupForOSCleanup(); OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); - UT_SetForceFail(UT_KEY(OS_TaskDelete), OS_ERROR); - UT_SetForceFail(UT_KEY(OS_close), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_TaskDelete), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_close), OS_ERROR); Id = CFE_ES_AppRecordGetID(UtAppRecPtr); UT_Report(__FILE__, __LINE__, CFE_ES_CleanUpApp(Id) == CFE_ES_APP_CLEANUP_ERR, @@ -1926,7 +1926,7 @@ void TestApps(void) Id = CFE_ES_TaskRecordGetID(UtTaskRecPtr); ES_UT_SetupForOSCleanup(); UT_SetDeferredRetcode(UT_KEY(OS_TimerGetInfo), 1, OS_ERROR); - UT_SetForceFail(UT_KEY(OS_close), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_close), OS_ERROR); UT_Report(__FILE__, __LINE__, CFE_ES_CleanupTaskResources(Id) != CFE_SUCCESS, "CFE_ES_CleanupTaskResources", @@ -1939,7 +1939,7 @@ void TestApps(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, NULL, &UtTaskRecPtr); Id = CFE_ES_TaskRecordGetID(UtTaskRecPtr); UT_SetDeferredRetcode(UT_KEY(OS_TimerGetInfo), 1, OS_ERROR); - UT_SetForceFail(UT_KEY(OS_TaskDelete), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_TaskDelete), OS_ERROR); UT_Report(__FILE__, __LINE__, CFE_ES_CleanupTaskResources(Id) == CFE_ES_TASK_DELETE_ERR, "CFE_ES_CleanupTaskResources", @@ -2068,7 +2068,7 @@ void TestApps(void) /* switch the main task association (makes it wrong) */ UtAppRecPtr->MainTaskId = CFE_ES_TaskRecordGetID(UtTaskRecPtr); - UT_SetForceFail(UT_KEY(OS_TaskDelete), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_TaskDelete), OS_ERROR); Id = CFE_ES_AppRecordGetID(UtAppRecPtr); UT_Report(__FILE__, __LINE__, CFE_ES_CleanUpApp(Id) == CFE_ES_APP_CLEANUP_ERR, @@ -2290,8 +2290,8 @@ void TestLibs(void) * initialization function fails and then must be cleaned up */ ES_ResetUnitTest(); - UT_SetForceFail(UT_KEY(OS_remove), OS_ERROR); /* for coverage of error path */ - UT_SetForceFail(UT_KEY(dummy_function), -555); + UT_SetDefaultReturnValue(UT_KEY(OS_remove), OS_ERROR); /* for coverage of error path */ + UT_SetDefaultReturnValue(UT_KEY(dummy_function), -555); Return = CFE_ES_LoadLibrary(&Id, "/cf/apps/tst_lib.bundle", "dummy_function", @@ -2680,7 +2680,7 @@ void TestTask(void) /* Test task main process loop with an initialization failure */ ES_ResetUnitTest(); - UT_SetForceFail(UT_KEY(OS_TaskRegister), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_TaskRegister), OS_ERROR); CFE_ES_TaskMain(); UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_APP_INIT]), @@ -2733,7 +2733,7 @@ void TestTask(void) /* Test task main process loop with a register app failure */ ES_ResetUnitTest(); - UT_SetForceFail(UT_KEY(OS_TaskRegister), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_TaskRegister), OS_ERROR); UT_Report(__FILE__, __LINE__, CFE_ES_TaskInit() == CFE_ES_ERR_APP_REGISTER, "CFE_ES_TaskInit", @@ -2882,7 +2882,7 @@ void TestTask(void) /* Test app create with an OS task create failure */ ES_ResetUnitTest(); - UT_SetForceFail(UT_KEY(OS_TaskCreate), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_TaskCreate), OS_ERROR); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_StartApp_t), UT_TPID_CFE_ES_CMD_START_APP_CC); UT_Report(__FILE__, __LINE__, @@ -3196,7 +3196,7 @@ void TestTask(void) ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "CFE_ES", NULL, NULL); - UT_SetForceFail(UT_KEY(OS_write), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_write), OS_ERROR); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_QueryAll_t), UT_TPID_CFE_ES_CMD_QUERY_ALL_CC); UT_Report(__FILE__, __LINE__, @@ -3208,7 +3208,7 @@ void TestTask(void) ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "CFE_ES", NULL, NULL); - UT_SetForceFail(UT_KEY(OS_OpenCreate), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_QueryAll_t), UT_TPID_CFE_ES_CMD_QUERY_ALL_CC); UT_Report(__FILE__, __LINE__, @@ -3244,7 +3244,7 @@ void TestTask(void) ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "UT", NULL, NULL); memset(&CmdBuf, 0, sizeof(CmdBuf)); - UT_SetForceFail(UT_KEY(OS_write), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_write), OS_ERROR); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_QueryAllTasks_t), UT_TPID_CFE_ES_CMD_QUERY_ALL_TASKS_CC); UT_Report(__FILE__, __LINE__, @@ -3255,7 +3255,7 @@ void TestTask(void) /* Test write of all task data to a file with an OS create failure */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); - UT_SetForceFail(UT_KEY(OS_OpenCreate), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_QueryAllTasks_t), UT_TPID_CFE_ES_CMD_QUERY_ALL_TASKS_CC); UT_Report(__FILE__, __LINE__, @@ -3322,7 +3322,7 @@ void TestTask(void) /* Test writing the system log with an OS create failure */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); - UT_SetForceFail(UT_KEY(OS_OpenCreate), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); strncpy((char *) CmdBuf.WriteSyslogCmd.Payload.FileName, "", sizeof(CmdBuf.WriteSyslogCmd.Payload.FileName)); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_WriteSyslog_t), @@ -3335,7 +3335,7 @@ void TestTask(void) /* Test writing the system log with an OS write failure */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); - UT_SetForceFail(UT_KEY(OS_write), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_write), OS_ERROR); CFE_ES_ResetDataPtr->SystemLogWriteIdx = snprintf(CFE_ES_ResetDataPtr->SystemLog, sizeof(CFE_ES_ResetDataPtr->SystemLog), "0000-000-00:00:00.00000 Test Message\n"); @@ -3427,7 +3427,7 @@ void TestTask(void) /* Test writing the E&R log with an OS create failure */ ES_ResetUnitTest(); CFE_ES_TaskData.BackgroundERLogDumpState.IsPending = true; - UT_SetForceFail(UT_KEY(OS_OpenCreate), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); CFE_ES_RunERLogDump(0, &CFE_ES_TaskData.BackgroundERLogDumpState); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_ERLOG2_ERR_EID), @@ -3437,7 +3437,7 @@ void TestTask(void) /* Test writing the E&R log with an OS write failure */ ES_ResetUnitTest(); CFE_ES_TaskData.BackgroundERLogDumpState.IsPending = true; - UT_SetForceFail(UT_KEY(OS_write), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_write), OS_ERROR); CFE_ES_RunERLogDump(0, &CFE_ES_TaskData.BackgroundERLogDumpState); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_FILEWRITE_ERR_EID), @@ -3456,7 +3456,7 @@ void TestTask(void) /* Test scan for exceptions in the PSP, should invoke a Processor Reset */ ES_ResetUnitTest(); - UT_SetForceFail(UT_KEY(CFE_PSP_Exception_GetCount), 1); + UT_SetDefaultReturnValue(UT_KEY(CFE_PSP_Exception_GetCount), 1); CFE_ES_RunExceptionScan(0, NULL); UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(CFE_PSP_Restart)) == 1, @@ -3466,7 +3466,7 @@ void TestTask(void) ES_ResetUnitTest(); CFE_ES_ResetDataPtr->ResetVars.ProcessorResetCount = 0; CFE_ES_ResetDataPtr->ResetVars.MaxProcessorResetCount = 1; - UT_SetForceFail(UT_KEY(CFE_PSP_Exception_GetCount), 1); + UT_SetDefaultReturnValue(UT_KEY(CFE_PSP_Exception_GetCount), 1); CFE_ES_RunExceptionScan(0, NULL); /* first time should do a processor restart (limit reached) */ UT_Report(__FILE__, __LINE__, @@ -3482,7 +3482,7 @@ void TestTask(void) /* nominal for app restart - associate exception with a task ID */ ES_ResetUnitTest(); - UT_SetForceFail(UT_KEY(CFE_PSP_Exception_GetCount), 1); + UT_SetDefaultReturnValue(UT_KEY(CFE_PSP_Exception_GetCount), 1); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, &UtTaskRecPtr); UT_ContextTask = CFE_ES_ResourceID_ToOSAL(CFE_ES_TaskRecordGetID(UtTaskRecPtr)); UT_SetDataBuffer(UT_KEY(CFE_PSP_Exception_GetSummary), &UT_ContextTask, sizeof(UT_ContextTask), false); @@ -3503,7 +3503,7 @@ void TestTask(void) /* repeat, but for a CORE app, which cannot be restarted */ ES_ResetUnitTest(); - UT_SetForceFail(UT_KEY(CFE_PSP_Exception_GetCount), 1); + UT_SetDefaultReturnValue(UT_KEY(CFE_PSP_Exception_GetCount), 1); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, &UtTaskRecPtr); UT_ContextTask = CFE_ES_ResourceID_ToOSAL(CFE_ES_TaskRecordGetID(UtTaskRecPtr)); UT_SetDataBuffer(UT_KEY(CFE_PSP_Exception_GetSummary), &UT_ContextTask, sizeof(UT_ContextTask), false); @@ -3516,7 +3516,7 @@ void TestTask(void) "Scan for exceptions; core app, psp restart"); /* check failure of getting summary data */ - UT_SetForceFail(UT_KEY(CFE_PSP_Exception_GetSummary), CFE_PSP_NO_EXCEPTION_DATA); + UT_SetDefaultReturnValue(UT_KEY(CFE_PSP_Exception_GetSummary), CFE_PSP_NO_EXCEPTION_DATA); CFE_ES_RunExceptionScan(0, NULL); UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(CFE_PSP_Restart)) == 2, @@ -3641,7 +3641,7 @@ void TestTask(void) /* Test dumping of the CDS to a file with an OS create failure */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); - UT_SetForceFail(UT_KEY(OS_OpenCreate), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_DumpCDSRegistry_t), UT_TPID_CFE_ES_CMD_DUMP_CDS_REGISTRY_CC); UT_Report(__FILE__, __LINE__, @@ -3652,7 +3652,7 @@ void TestTask(void) /* Test dumping of the CDS to a file with an OS write failure */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); - UT_SetForceFail(UT_KEY(OS_write), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_write), OS_ERROR); ES_UT_SetupSingleCDSRegistry("CFE_ES.CDS_NAME", ES_UT_CDS_BLOCK_SIZE, false, NULL); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_DumpCDSRegistry_t), UT_TPID_CFE_ES_CMD_DUMP_CDS_REGISTRY_CC); @@ -4391,7 +4391,7 @@ void TestPerf(void) memset(&CFE_ES_TaskData.BackgroundPerfDumpState, 0, sizeof(CFE_ES_TaskData.BackgroundPerfDumpState)); CFE_ES_TaskData.BackgroundPerfDumpState.PendingState = CFE_ES_PerfDumpState_INIT; - UT_SetForceFail(UT_KEY(OS_OpenCreate), -10); + UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), -10); CFE_ES_RunPerfLogDump(1000, &CFE_ES_TaskData.BackgroundPerfDumpState); UtAssert_True(CFE_ES_TaskData.BackgroundPerfDumpState.CurrentState == CFE_ES_PerfDumpState_IDLE, "CFE_ES_RunPerfLogDump - OS create fail, CFE_ES_TaskData.BackgroundPerfDumpState.CurrentState (%d) == IDLE (%d)", @@ -4403,7 +4403,7 @@ void TestPerf(void) ES_ResetUnitTest(); memset(&CFE_ES_TaskData.BackgroundPerfDumpState, 0, sizeof(CFE_ES_TaskData.BackgroundPerfDumpState)); - UT_SetForceFail(UT_KEY(OS_write), -10); + UT_SetDefaultReturnValue(UT_KEY(OS_write), -10); CFE_ES_TaskData.BackgroundPerfDumpState.PendingState = CFE_ES_PerfDumpState_INIT; CFE_ES_RunPerfLogDump(1000, &CFE_ES_TaskData.BackgroundPerfDumpState); UtAssert_True(CFE_ES_TaskData.BackgroundPerfDumpState.CurrentState == CFE_ES_PerfDumpState_DELAY, @@ -4745,7 +4745,7 @@ void TestAPI(void) "Get task info by ID; NULL buffer"); /* Test getting task information using the task ID - bad task ID */ - UT_SetForceFail(UT_KEY(OS_ObjectIdToArrayIndex), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdToArrayIndex), OS_ERROR); UT_Report(__FILE__, __LINE__, CFE_ES_GetTaskInfo(&TaskInfo, TaskId) == CFE_ES_ERR_RESOURCEID_NOT_VALID, "CFE_ES_GetTaskInfo", @@ -4806,7 +4806,7 @@ void TestAPI(void) /* Test creating a child task with an OS task create failure */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, NULL, NULL); - UT_SetForceFail(UT_KEY(OS_TaskCreate), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_TaskCreate), OS_ERROR); Return = CFE_ES_CreateChildTask(&TaskId, "TaskName", TestAPI, @@ -4880,7 +4880,7 @@ void TestAPI(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); ES_UT_SetupChildTaskId(UtAppRecPtr, NULL, &UtTaskRecPtr); TestObjId = CFE_ES_ResourceID_ToOSAL(CFE_ES_TaskRecordGetID(UtTaskRecPtr)); - UT_SetForceFail(UT_KEY(OS_TaskGetId), OS_ObjectIdToInteger(TestObjId)); /* Set context to that of child */ + UT_SetDefaultReturnValue(UT_KEY(OS_TaskGetId), OS_ObjectIdToInteger(TestObjId)); /* Set context to that of child */ Return = CFE_ES_CreateChildTask(&TaskId, "TaskName", TestAPI, @@ -4918,7 +4918,7 @@ void TestAPI(void) "Task ID belongs to a main task"); /* Test deleting a child task with an invalid task ID */ - UT_SetForceFail(UT_KEY(OS_ObjectIdToArrayIndex), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdToArrayIndex), OS_ERROR); UT_Report(__FILE__, __LINE__, CFE_ES_DeleteChildTask(TaskId) == CFE_ES_ERR_RESOURCEID_NOT_VALID, "CFE_ES_DeleteChildTask", @@ -4950,7 +4950,7 @@ void TestAPI(void) ES_UT_SetupChildTaskId(UtAppRecPtr, NULL, &UtTaskRecPtr); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); /* the app ID */ TaskId = CFE_ES_TaskRecordGetID(UtTaskRecPtr); /* the child task ID */ - UT_SetForceFail(UT_KEY(OS_TaskDelete), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_TaskDelete), OS_ERROR); UT_Report(__FILE__, __LINE__, CFE_ES_DeleteChildTask(TaskId) <= 0, "CFE_ES_DeleteChildTask", @@ -4969,7 +4969,7 @@ void TestAPI(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); ES_UT_SetupChildTaskId(UtAppRecPtr, NULL, &UtTaskRecPtr); TestObjId = CFE_ES_ResourceID_ToOSAL(CFE_ES_TaskRecordGetID(UtTaskRecPtr)); - UT_SetForceFail(UT_KEY(OS_TaskGetId), OS_ObjectIdToInteger(TestObjId)); /* Set context to that of child */ + UT_SetDefaultReturnValue(UT_KEY(OS_TaskGetId), OS_ObjectIdToInteger(TestObjId)); /* Set context to that of child */ CFE_ES_ExitChildTask(); UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(OS_TaskExit)) == 1, @@ -4998,7 +4998,7 @@ void TestAPI(void) /* Test registering a child task with an OS task register failure */ ES_ResetUnitTest(); - UT_SetForceFail(UT_KEY(OS_TaskRegister), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_TaskRegister), OS_ERROR); UT_Report(__FILE__, __LINE__, CFE_ES_RegisterChildTask() == CFE_ES_ERR_CHILD_TASK_REGISTER, "CFE_ES_RegisterChildTask", @@ -5658,7 +5658,7 @@ void TestCDS() /* Test CDS initialization with size not obtainable */ ES_ResetUnitTest(); - UT_SetForceFail(UT_KEY(CFE_PSP_GetCDSSize), -1); + UT_SetDefaultReturnValue(UT_KEY(CFE_PSP_GetCDSSize), -1); UT_Report(__FILE__, __LINE__, CFE_ES_CDS_EarlyInit() == OS_ERROR, "CFE_ES_CDS_EarlyInit", @@ -6760,7 +6760,7 @@ void TestBackground(void) ES_ResetUnitTest(); memset(&CFE_ES_TaskData.BackgroundPerfDumpState, 0, sizeof(CFE_ES_TaskData.BackgroundPerfDumpState)); - UT_SetForceFail(UT_KEY(OS_write), -10); + UT_SetDefaultReturnValue(UT_KEY(OS_write), -10); CFE_ES_TaskData.BackgroundPerfDumpState.CurrentState = CFE_ES_PerfDumpState_INIT; UT_SetDeferredRetcode(UT_KEY(OS_BinSemTimedWait), 3, -4); CFE_ES_BackgroundTask(); diff --git a/fsw/cfe-core/unit-test/evs_UT.c b/fsw/cfe-core/unit-test/evs_UT.c index 052fffc1f..cd5871836 100644 --- a/fsw/cfe-core/unit-test/evs_UT.c +++ b/fsw/cfe-core/unit-test/evs_UT.c @@ -443,7 +443,7 @@ void Test_Init(void) /* Test task initialization where getting the application ID fails */ UT_InitData(); - UT_SetForceFail(UT_KEY(CFE_ES_GetAppID), -1); + UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppID), -1); CFE_EVS_TaskInit(); UT_Report(__FILE__, __LINE__, UT_SyslogIsInHistory(EVS_SYSLOG_MSGS[10]), @@ -494,7 +494,7 @@ void Test_IllegalAppID(void) /* Set test up with illegal application ID */ UT_InitData(); - UT_SetForceFail(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); + UT_SetDefaultReturnValue(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test registering an event using an illegal application ID */ UT_Report(__FILE__, __LINE__, @@ -504,7 +504,7 @@ void Test_IllegalAppID(void) /* Test unregistering an event using an illegal application ID */ UT_InitData(); - UT_SetForceFail(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); + UT_SetDefaultReturnValue(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); UT_Report(__FILE__, __LINE__, CFE_EVS_Unregister() == CFE_EVS_APP_ILLEGAL_APP_ID, "CFE_EVS_Unregister", @@ -512,7 +512,7 @@ void Test_IllegalAppID(void) /* Test sending an event using an illegal application ID */ UT_InitData(); - UT_SetForceFail(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); + UT_SetDefaultReturnValue(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); UT_Report(__FILE__, __LINE__, CFE_EVS_SendEvent(0, 0, "NULL") == CFE_EVS_APP_ILLEGAL_APP_ID, "CFE_EVS_SendEvent", @@ -520,7 +520,7 @@ void Test_IllegalAppID(void) /* Test sending an event using an illegal application ID */ UT_InitData(); - UT_SetForceFail(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); + UT_SetDefaultReturnValue(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); UT_Report(__FILE__, __LINE__, EVS_SendEvent(0, 0, "NULL") == CFE_SUCCESS, "EVS_SendEvent", @@ -528,7 +528,7 @@ void Test_IllegalAppID(void) /* Test sending a timed event using an illegal application ID */ UT_InitData(); - UT_SetForceFail(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); + UT_SetDefaultReturnValue(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); UT_Report(__FILE__, __LINE__, CFE_EVS_SendTimedEvent(time, 0, @@ -539,7 +539,7 @@ void Test_IllegalAppID(void) /* Test sending an event with app ID using an illegal application ID */ UT_InitData(); - UT_SetForceFail(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); + UT_SetDefaultReturnValue(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); UT_Report(__FILE__, __LINE__, CFE_EVS_SendEventWithAppID(0, 0, @@ -550,7 +550,7 @@ void Test_IllegalAppID(void) /* Test resetting a filter using an illegal application ID */ UT_InitData(); - UT_SetForceFail(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); + UT_SetDefaultReturnValue(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); UT_Report(__FILE__, __LINE__, CFE_EVS_ResetFilter(0) == CFE_EVS_APP_ILLEGAL_APP_ID, "CFE_EVS_ResetFilter", @@ -558,7 +558,7 @@ void Test_IllegalAppID(void) /* Test resetting all filters using an illegal application ID */ UT_InitData(); - UT_SetForceFail(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); + UT_SetDefaultReturnValue(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); UT_Report(__FILE__, __LINE__, CFE_EVS_ResetAllFilters() == CFE_EVS_APP_ILLEGAL_APP_ID, "CFE_EVS_ResetAllFilters", @@ -566,7 +566,7 @@ void Test_IllegalAppID(void) /* Test application cleanup using an illegal application ID */ UT_InitData(); - UT_SetForceFail(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); + UT_SetDefaultReturnValue(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); UT_Report(__FILE__, __LINE__, CFE_EVS_CleanUpApp(CFE_ES_RESOURCEID_UNDEFINED) == CFE_EVS_APP_ILLEGAL_APP_ID, @@ -694,7 +694,7 @@ void Test_FilterRegistration(void) /* Test filter unregistration with failed ES_putPool */ UT_InitData(); - UT_SetForceFail(UT_KEY(CFE_ES_PutPoolBuf), -1); + UT_SetDefaultReturnValue(UT_KEY(CFE_ES_PutPoolBuf), -1); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetAppID), 1, -1); UT_Report(__FILE__, __LINE__, CFE_EVS_Unregister() < 0, "CFE_EVS_Unregister", @@ -1356,7 +1356,7 @@ void Test_Logging(void) /* Test writing a log entry with a create failure */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_SUCCESS); - UT_SetForceFail(UT_KEY(OS_OpenCreate), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); UT_Report(__FILE__, __LINE__, CFE_EVS_WriteLogDataFileCmd(&CmdBuf.logfilecmd) != CFE_SUCCESS, "CFE_EVS_WriteLogDataFileCmd", @@ -1374,7 +1374,7 @@ void Test_Logging(void) /* Test writing a log entry with a write failure */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_SUCCESS); - UT_SetForceFail(UT_KEY(OS_write), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_write), OS_ERROR); CFE_EVS_GlobalData.EVS_LogPtr->LogCount = CFE_PLATFORM_EVS_LOG_MAX; UT_Report(__FILE__, __LINE__, CFE_EVS_WriteLogDataFileCmd(&CmdBuf.logfilecmd) != CFE_SUCCESS, @@ -1452,7 +1452,7 @@ void Test_WriteApp(void) UT_InitData(); strncpy((char *) CmdBuf.AppDataCmd.Payload.AppDataFilename, "ut_cfe_evs", sizeof(CmdBuf.AppDataCmd.Payload.AppDataFilename)); - UT_SetForceFail(UT_KEY(OS_OpenCreate), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); UT_EVS_DoDispatchCheckEvents(&CmdBuf.AppDataCmd, sizeof(CmdBuf.AppDataCmd), UT_TPID_CFE_EVS_CMD_WRITE_APP_DATA_FILE_CC, &UT_EVS_EventBuf); @@ -1463,8 +1463,8 @@ void Test_WriteApp(void) /* Test writing application data with a write/close failure */ UT_InitData(); - UT_SetForceFail(UT_KEY(OS_write), OS_ERROR); - UT_SetForceFail(UT_KEY(OS_close), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_write), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_close), OS_ERROR); UT_EVS_DoDispatchCheckEvents(&CmdBuf.AppDataCmd, sizeof(CmdBuf.AppDataCmd), UT_TPID_CFE_EVS_CMD_WRITE_APP_DATA_FILE_CC, &UT_EVS_EventBuf); @@ -1489,7 +1489,7 @@ void Test_WriteApp(void) UT_InitData(); strncpy((char *) CmdBuf.AppDataCmd.Payload.AppDataFilename, "AppDataFileName", sizeof(CmdBuf.AppDataCmd.Payload.AppDataFilename)); - UT_SetForceFail(UT_KEY(OS_OpenCreate), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); UT_EVS_DoDispatchCheckEvents(&CmdBuf.AppDataCmd, sizeof(CmdBuf.AppDataCmd), UT_TPID_CFE_EVS_CMD_WRITE_APP_DATA_FILE_CC, &UT_EVS_EventBuf); @@ -1541,7 +1541,7 @@ void Test_BadAppCmd(void) sizeof(appcmdcmd.Payload.AppName)); /* Test disabling application event types with an unknown application ID */ - UT_SetForceFail(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); + UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); @@ -1552,7 +1552,7 @@ void Test_BadAppCmd(void) /* Test enabling application event types with an unknown application ID */ UT_InitData(); - UT_SetForceFail(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); + UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); @@ -1563,7 +1563,7 @@ void Test_BadAppCmd(void) /* Test disabling application events with an unknown application ID */ UT_InitData(); - UT_SetForceFail(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); + UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENTS_CC, &UT_EVS_EventBuf); @@ -1574,7 +1574,7 @@ void Test_BadAppCmd(void) /* Test enabling application events with an unknown application ID */ UT_InitData(); - UT_SetForceFail(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); + UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENTS_CC, &UT_EVS_EventBuf); @@ -1587,7 +1587,7 @@ void Test_BadAppCmd(void) * application ID */ UT_InitData(); - UT_SetForceFail(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); + UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_RESET_APP_COUNTER_CC, &UT_EVS_EventBuf); @@ -1598,7 +1598,7 @@ void Test_BadAppCmd(void) /* Test modifying event filters with an unknown application ID */ UT_InitData(); - UT_SetForceFail(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); + UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC, &UT_EVS_EventBuf); @@ -1610,7 +1610,7 @@ void Test_BadAppCmd(void) /* Test deleting event filters with an unknown application ID */ UT_InitData(); - UT_SetForceFail(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); + UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), UT_TPID_CFE_EVS_CMD_DELETE_EVENT_FILTER_CC, &UT_EVS_EventBuf); @@ -1622,7 +1622,7 @@ void Test_BadAppCmd(void) /* Test setting the event filter mask with an unknown application ID */ UT_InitData(); - UT_SetForceFail(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); + UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_SET_FILTER_CC, &UT_EVS_EventBuf); @@ -1634,7 +1634,7 @@ void Test_BadAppCmd(void) /* Test resetting the filter with an unknown application ID */ UT_InitData(); - UT_SetForceFail(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); + UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), UT_TPID_CFE_EVS_CMD_RESET_FILTER_CC, &UT_EVS_EventBuf); @@ -1645,7 +1645,7 @@ void Test_BadAppCmd(void) /* Test resetting all filters with an unknown application ID */ UT_InitData(); - UT_SetForceFail(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); + UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_RESET_ALL_FILTERS_CC, &UT_EVS_EventBuf); diff --git a/fsw/cfe-core/unit-test/fs_UT.c b/fsw/cfe-core/unit-test/fs_UT.c index dabd2c3e5..a1b6f5c48 100644 --- a/fsw/cfe-core/unit-test/fs_UT.c +++ b/fsw/cfe-core/unit-test/fs_UT.c @@ -95,7 +95,7 @@ void Test_CFE_FS_ReadHeader(void) /* Test reading the header with a lseek failure */ UT_InitData(); - UT_SetForceFail(UT_KEY(OS_lseek), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_lseek), OS_ERROR); UT_Report(__FILE__, __LINE__, CFE_FS_ReadHeader(&Hdr, FileDes) == OS_ERROR, "CFE_FS_ReadHeader", @@ -104,7 +104,7 @@ void Test_CFE_FS_ReadHeader(void) /* Test successfully reading the header */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(OS_lseek), 1, OS_SUCCESS); - UT_SetForceFail(UT_KEY(OS_read), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_read), OS_ERROR); UT_Report(__FILE__, __LINE__, CFE_FS_ReadHeader(&Hdr, FileDes) != sizeof(CFE_FS_Header_t), "CFE_FS_ReadHeader", @@ -123,7 +123,7 @@ void Test_CFE_FS_WriteHeader(void) /* Test writing the header with a lseek failure */ UT_InitData(); - UT_SetForceFail(UT_KEY(OS_lseek), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_lseek), OS_ERROR); UT_Report(__FILE__, __LINE__, CFE_FS_WriteHeader(FileDes, &Hdr) == OS_ERROR, "CFE_FS_WriteHeader", @@ -151,7 +151,7 @@ void Test_CFE_FS_SetTimestamp(void) /* Test setting the time stamp with a lseek failure */ UT_InitData(); - UT_SetForceFail(UT_KEY(OS_lseek), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_lseek), OS_ERROR); UT_Report(__FILE__, __LINE__, CFE_FS_SetTimestamp(FileDes, NewTimestamp) == OS_ERROR, "CFE_FS_SetTimestamp", @@ -159,7 +159,7 @@ void Test_CFE_FS_SetTimestamp(void) /* Test setting the time stamp with a seconds write failure */ UT_InitData(); - UT_SetForceFail(UT_KEY(OS_write), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_write), OS_ERROR); UT_Report(__FILE__, __LINE__, CFE_FS_SetTimestamp(FileDes, NewTimestamp) != OS_SUCCESS, "CFE_FS_SetTimestamp", @@ -313,7 +313,7 @@ void Test_CFE_FS_Private(void) /* Test FS initialization with a mutex creation failure */ UT_InitData(); - UT_SetForceFail(UT_KEY(OS_MutSemCreate), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_MutSemCreate), OS_ERROR); UT_Report(__FILE__, __LINE__, CFE_FS_EarlyInit() == -1, "CFE_FS_EarlyInit", diff --git a/fsw/cfe-core/unit-test/sb_UT.c b/fsw/cfe-core/unit-test/sb_UT.c index 369ef3233..507fd2d65 100644 --- a/fsw/cfe-core/unit-test/sb_UT.c +++ b/fsw/cfe-core/unit-test/sb_UT.c @@ -566,7 +566,7 @@ void Test_SB_Cmds_RoutingInfoCreateFail(void) CFE_SB.CmdPipePktPtr = (CFE_SB_MsgPtr_t) &WriteFileCmd; /* Make function CFE_SB_SendRtgInfo return CFE_SB_FILE_IO_ERR */ - UT_SetForceFail(UT_KEY(OS_OpenCreate), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); CFE_SB_ProcessCmdPipePkt(); @@ -686,7 +686,7 @@ void Test_SB_Cmds_PipeInfoSpec(void) */ void Test_SB_Cmds_PipeInfoCreateFail(void) { - UT_SetForceFail(UT_KEY(OS_OpenCreate), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); ASSERT_EQ(CFE_SB_SendPipeInfo("PipeTstFile"), CFE_SB_FILE_IO_ERR); EVTCNT(1); @@ -821,7 +821,7 @@ void Test_SB_Cmds_MapInfoSpec(void) */ void Test_SB_Cmds_MapInfoCreateFail(void) { - UT_SetForceFail(UT_KEY(OS_OpenCreate), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); ASSERT_EQ(CFE_SB_SendMapInfo("MapTstFile"), CFE_SB_FILE_IO_ERR); EVTCNT(1); diff --git a/fsw/cfe-core/unit-test/tbl_UT.c b/fsw/cfe-core/unit-test/tbl_UT.c index e395262f4..a3b35c43b 100644 --- a/fsw/cfe-core/unit-test/tbl_UT.c +++ b/fsw/cfe-core/unit-test/tbl_UT.c @@ -737,7 +737,7 @@ void Test_CFE_TBL_DumpToFile(void) /* Test with an error creating the dump file */ UT_InitData(); - UT_SetForceFail(UT_KEY(OS_OpenCreate), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); UT_Report(__FILE__, __LINE__, CFE_TBL_DumpToFile("filename" ,"tablename" ,"dumpaddress", TblSizeInBytes) == CFE_TBL_INC_ERR_CTR, @@ -1140,7 +1140,7 @@ void Test_CFE_TBL_DumpRegCmd(void) UT_InitData(); strncpy((char *)DumpRegCmd.Payload.DumpFilename, "", sizeof(DumpRegCmd.Payload.DumpFilename)); - UT_SetForceFail(UT_KEY(OS_OpenCreate), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); UT_Report(__FILE__, __LINE__, CFE_TBL_DumpRegistryCmd(&DumpRegCmd) == CFE_TBL_INC_ERR_CTR, @@ -1410,7 +1410,7 @@ void Test_CFE_TBL_LoadCmd(void) UT_InitData(); strncpy((char *)LoadCmd.Payload.LoadFilename, "LoadFileName", sizeof(LoadCmd.Payload.LoadFilename)); - UT_SetForceFail(UT_KEY(OS_OpenCreate), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); UT_Report(__FILE__, __LINE__, CFE_TBL_LoadCmd(&LoadCmd) == CFE_TBL_INC_ERR_CTR, @@ -1726,7 +1726,7 @@ void Test_CFE_TBL_HousekeepingCmd(void) UT_InitData(); CFE_TBL_TaskData.DumpControlBlocks[0].State = CFE_TBL_DUMP_PERFORMED; CFE_TBL_TaskData.HkTlmTblRegIndex = CFE_TBL_NOT_FOUND + 1; - UT_SetForceFail(UT_KEY(OS_OpenCreate), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); UT_Report(__FILE__, __LINE__, CFE_TBL_HousekeepingCmd(NULL) == CFE_TBL_DONT_INC_CTR, "CFE_TBL_HousekeepingCmd", @@ -1736,7 +1736,7 @@ void Test_CFE_TBL_HousekeepingCmd(void) UT_InitData(); CFE_TBL_TaskData.HkTlmTblRegIndex = CFE_TBL_NOT_FOUND; CFE_TBL_TaskData.DumpControlBlocks[0].State = CFE_TBL_DUMP_PERFORMED; - UT_SetForceFail(UT_KEY(OS_OpenCreate), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); UT_Report(__FILE__, __LINE__, CFE_TBL_HousekeepingCmd(NULL) == CFE_TBL_DONT_INC_CTR, "CFE_TBL_HousekeepingCmd", @@ -4212,7 +4212,7 @@ void Test_CFE_TBL_Internal(void) UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); - UT_SetForceFail(UT_KEY(OS_OpenCreate), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); RtnCode = CFE_TBL_LoadFromFile("UT", WorkingBufferPtr, RegRecPtr, Filename); EventsCorrect = (UT_EventIsInHistory(CFE_TBL_FILE_ACCESS_ERR_EID) == true && UT_GetNumEventsSent() == 1); @@ -4810,7 +4810,7 @@ void Test_CFE_TBL_Internal(void) /* Test successful application cleanup */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_1); - UT_SetForceFail(UT_KEY(CFE_ES_PutPoolBuf), -1); + UT_SetDefaultReturnValue(UT_KEY(CFE_ES_PutPoolBuf), -1); AccessDescPtr = &CFE_TBL_TaskData.Handles[App1TblHandle1]; RegRecPtr = &CFE_TBL_TaskData.Registry[AccessDescPtr->RegIndex]; CFE_TBL_TaskData.DumpControlBlocks[3].State = CFE_TBL_DUMP_PENDING; @@ -4981,7 +4981,7 @@ void Test_CFE_TBL_Internal(void) */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_1); - UT_SetForceFail(UT_KEY(CFE_ES_PutPoolBuf), -1); + UT_SetDefaultReturnValue(UT_KEY(CFE_ES_PutPoolBuf), -1); CFE_TBL_TaskData.Handles[0].AppId = UT_TBL_APPID_1; AccessDescPtr = &CFE_TBL_TaskData.Handles[App1TblHandle2]; RegRecPtr = &CFE_TBL_TaskData.Registry[AccessDescPtr->RegIndex]; diff --git a/fsw/cfe-core/unit-test/time_UT.c b/fsw/cfe-core/unit-test/time_UT.c index bcb421230..f3e09c649 100644 --- a/fsw/cfe-core/unit-test/time_UT.c +++ b/fsw/cfe-core/unit-test/time_UT.c @@ -470,7 +470,7 @@ void Test_Init(void) /* Test response to a failure to get the ID by name */ UT_InitData(); - UT_SetForceFail(UT_KEY(OS_TimeBaseGetIdByName), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_TimeBaseGetIdByName), OS_ERROR); CFE_TIME_TaskInit(); UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(CFE_ES_WriteToSysLog)) == 0, @@ -482,7 +482,7 @@ void Test_Init(void) * error. This allows the overall system to continue without the 1Hz */ UT_InitData(); - UT_SetForceFail(UT_KEY(OS_TimerAdd), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_TimerAdd), OS_ERROR); CFE_TIME_TaskInit(); UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(CFE_ES_WriteToSysLog)) == 1 && @@ -491,7 +491,7 @@ void Test_Init(void) "1Hz OS_TimerAdd failure"); UT_InitData(); - UT_SetForceFail(UT_KEY(OS_TimerSet), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_TimerSet), OS_ERROR); CFE_TIME_TaskInit(); UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(CFE_ES_WriteToSysLog)) == 1 && UT_SyslogIsInHistory((TIME_SYSLOG_MSGS[4])), diff --git a/fsw/cfe-core/unit-test/ut_support.c b/fsw/cfe-core/unit-test/ut_support.c index b3de436ee..e211ad50b 100644 --- a/fsw/cfe-core/unit-test/ut_support.c +++ b/fsw/cfe-core/unit-test/ut_support.c @@ -281,7 +281,7 @@ void UT_SetStatusBSPResetArea(int32 status, uint32 Signature, uint32 ClockSignal UT_CFE_ES_ResetData.ResetData.TimeResetVars.ClockSignal = ClockSignal; if (status != 0) { - UT_SetForceFail(UT_KEY(CFE_PSP_GetResetArea), status); + UT_SetDefaultReturnValue(UT_KEY(CFE_PSP_GetResetArea), status); } else { @@ -310,7 +310,7 @@ void UT_SetReadHeader(void *Hdr, int NumBytes) */ void UT_SetDummyFuncRtn(int Return) { - UT_SetForceFail(UT_KEY(dummy_function), Return); + UT_SetDefaultReturnValue(UT_KEY(dummy_function), Return); } /* diff --git a/modules/sbr/unit-test-coverage/test_cfe_sbr_map_direct.c b/modules/sbr/unit-test-coverage/test_cfe_sbr_map_direct.c index 770553027..c78c41e2a 100644 --- a/modules/sbr/unit-test-coverage/test_cfe_sbr_map_direct.c +++ b/modules/sbr/unit-test-coverage/test_cfe_sbr_map_direct.c @@ -48,7 +48,7 @@ void Test_SBR_Map_Direct(void) CFE_SBR_Init_Map(); /* Force valid msgid responses */ - UT_SetForceFail(UT_KEY(CFE_SB_IsValidMsgId), true); + UT_SetDefaultReturnValue(UT_KEY(CFE_SB_IsValidMsgId), true); UtPrintf("Check that all entries are set invalid"); count = 0; diff --git a/modules/sbr/unit-test-coverage/test_cfe_sbr_map_hash.c b/modules/sbr/unit-test-coverage/test_cfe_sbr_map_hash.c index df78f55c6..1ba6c0db2 100644 --- a/modules/sbr/unit-test-coverage/test_cfe_sbr_map_hash.c +++ b/modules/sbr/unit-test-coverage/test_cfe_sbr_map_hash.c @@ -67,7 +67,7 @@ void Test_SBR_Map_Hash(void) CFE_SBR_Init(); /* Force valid msgid responses */ - UT_SetForceFail(UT_KEY(CFE_SB_IsValidMsgId), true); + UT_SetDefaultReturnValue(UT_KEY(CFE_SB_IsValidMsgId), true); UtPrintf("Check that all entries are set invalid"); count = 0; diff --git a/modules/sbr/unit-test-coverage/test_cfe_sbr_route_unsorted.c b/modules/sbr/unit-test-coverage/test_cfe_sbr_route_unsorted.c index ac44c2ec7..2c202d6e0 100644 --- a/modules/sbr/unit-test-coverage/test_cfe_sbr_route_unsorted.c +++ b/modules/sbr/unit-test-coverage/test_cfe_sbr_route_unsorted.c @@ -60,7 +60,7 @@ void Test_SBR_Route_Unsort_General(void) * Note from here on msgids must be in the valid range since validation is forced true * and if the underlying map implentation is direct it needs to be a valid array index */ - UT_SetForceFail(UT_KEY(CFE_SB_IsValidMsgId), true); + UT_SetDefaultReturnValue(UT_KEY(CFE_SB_IsValidMsgId), true); UtPrintf("Callback test with no routes"); count = 0; @@ -137,7 +137,7 @@ void Test_SBR_Route_Unsort_GetSet(void) * Note from here on msgids must be in the valid range since validation is forced true * and if the underlying map implentation is direct it needs to be a valid array index */ - UT_SetForceFail(UT_KEY(CFE_SB_IsValidMsgId), true); + UT_SetDefaultReturnValue(UT_KEY(CFE_SB_IsValidMsgId), true); UtPrintf("Initialize map and route"); CFE_SBR_Init();