diff --git a/fsw/cfe-core/unit-test/es_UT.c b/fsw/cfe-core/unit-test/es_UT.c index 1604ae50e..dddfb8ddb 100644 --- a/fsw/cfe-core/unit-test/es_UT.c +++ b/fsw/cfe-core/unit-test/es_UT.c @@ -727,7 +727,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, @@ -741,7 +741,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); @@ -875,9 +875,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]) && @@ -890,9 +890,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]) && @@ -908,7 +908,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]) && @@ -920,7 +920,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__, @@ -933,7 +933,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]) && @@ -967,7 +967,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]) && @@ -1037,8 +1037,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__, @@ -1104,8 +1104,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]) && @@ -1235,7 +1235,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__, @@ -1282,7 +1282,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", @@ -1569,7 +1569,8 @@ void TestApps(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_RESTART; - UT_SetForceFail(UT_KEY(OS_TaskCreate), OS_ERROR); + OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); + UT_SetDefaultReturnValue(UT_KEY(OS_TaskCreate), OS_ERROR); Id = CFE_ES_AppRecordGetID(UtAppRecPtr); CFE_ES_ProcessControlRequest(Id); UT_Report(__FILE__, __LINE__, @@ -1599,7 +1600,8 @@ void TestApps(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_RELOAD; - UT_SetForceFail(UT_KEY(OS_TaskCreate), OS_ERROR); + OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); + UT_SetDefaultReturnValue(UT_KEY(OS_TaskCreate), OS_ERROR); Id = CFE_ES_AppRecordGetID(UtAppRecPtr); CFE_ES_ProcessControlRequest(Id); UT_Report(__FILE__, __LINE__, @@ -1797,8 +1799,9 @@ void TestApps(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); ES_UT_SetupForOSCleanup(); - UT_SetForceFail(UT_KEY(OS_TaskDelete), OS_ERROR); - UT_SetForceFail(UT_KEY(OS_close), OS_ERROR); + OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); + 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, @@ -1924,7 +1927,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", @@ -1937,7 +1940,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", @@ -2061,7 +2064,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, @@ -2280,8 +2283,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", @@ -2674,7 +2677,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]), @@ -2727,7 +2730,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", @@ -2876,7 +2879,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__, @@ -3190,7 +3193,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__, @@ -3202,7 +3205,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__, @@ -3238,7 +3241,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__, @@ -3249,7 +3252,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__, @@ -3316,7 +3319,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), @@ -3329,7 +3332,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"); @@ -3421,7 +3424,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), @@ -3431,7 +3434,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), @@ -3450,7 +3453,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, @@ -3460,7 +3463,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__, @@ -3476,7 +3479,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); @@ -3497,7 +3500,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); @@ -3510,7 +3513,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, @@ -3635,7 +3638,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__, @@ -3646,7 +3649,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); @@ -4385,7 +4388,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)", @@ -4397,7 +4400,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, @@ -4739,7 +4742,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", @@ -4800,7 +4803,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, @@ -4874,7 +4877,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, @@ -4912,7 +4915,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", @@ -4944,7 +4947,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", @@ -4963,7 +4966,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, @@ -4992,7 +4995,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", @@ -5652,7 +5655,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", @@ -6743,7 +6746,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 3290158e4..7a84c2a6e 100644 --- a/fsw/cfe-core/unit-test/evs_UT.c +++ b/fsw/cfe-core/unit-test/evs_UT.c @@ -465,7 +465,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]), @@ -516,7 +516,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__, @@ -526,7 +526,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", @@ -534,7 +534,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", @@ -542,7 +542,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", @@ -550,7 +550,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, @@ -561,7 +561,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, @@ -572,7 +572,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", @@ -580,7 +580,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", @@ -588,7 +588,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, @@ -716,7 +716,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", @@ -1376,7 +1376,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", @@ -1394,7 +1394,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, @@ -1472,7 +1472,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); @@ -1483,8 +1483,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); @@ -1509,7 +1509,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); @@ -1561,7 +1561,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); @@ -1572,7 +1572,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); @@ -1583,7 +1583,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); @@ -1594,7 +1594,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); @@ -1607,7 +1607,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); @@ -1618,7 +1618,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); @@ -1630,7 +1630,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); @@ -1642,7 +1642,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); @@ -1654,7 +1654,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); @@ -1665,7 +1665,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 f979edb23..f0b44c86d 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_MSG_Message_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 7f6baa51c..5c486aa95 100644 --- a/fsw/cfe-core/unit-test/tbl_UT.c +++ b/fsw/cfe-core/unit-test/tbl_UT.c @@ -751,7 +751,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, @@ -1154,7 +1154,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, @@ -1424,7 +1424,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, @@ -1705,7 +1705,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", @@ -1715,7 +1715,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", @@ -4119,7 +4119,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); @@ -4633,7 +4633,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; @@ -4797,7 +4797,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 211999e51..6fdc94b3f 100644 --- a/fsw/cfe-core/unit-test/time_UT.c +++ b/fsw/cfe-core/unit-test/time_UT.c @@ -476,7 +476,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, @@ -488,7 +488,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 && @@ -497,7 +497,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 f1e7c4ceb..9a2fd8e80 100644 --- a/fsw/cfe-core/unit-test/ut_support.c +++ b/fsw/cfe-core/unit-test/ut_support.c @@ -282,7 +282,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 { @@ -311,7 +311,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();