From 79f1c38ab5e407fa174257b072034bd763c67d1c Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Fri, 26 Jun 2020 11:00:28 -0400 Subject: [PATCH] Fix #762, scrub of all CFE UT stub functions Scrubs all CFE unit test functions to ensure that: 1. All functions in the CFE public API have a stub function implemented 2. All parameters to the stub function are registered in the context object, so the values will be available to hook functions. 3. The names of all parameters match the prototype/documentation, so hook functions that use name-based argument value retrieval will work. --- fsw/cfe-core/ut-stubs/ut_es_stubs.c | 272 ++++++++++++++++++++++--- fsw/cfe-core/ut-stubs/ut_evs_stubs.c | 68 +++++-- fsw/cfe-core/ut-stubs/ut_fs_stubs.c | 24 ++- fsw/cfe-core/ut-stubs/ut_sb_stubs.c | 282 +++++++++++++++++++++++--- fsw/cfe-core/ut-stubs/ut_tbl_stubs.c | 163 ++++++++++++++- fsw/cfe-core/ut-stubs/ut_time_stubs.c | 204 ++++++++++++++++++- 6 files changed, 928 insertions(+), 85 deletions(-) diff --git a/fsw/cfe-core/ut-stubs/ut_es_stubs.c b/fsw/cfe-core/ut-stubs/ut_es_stubs.c index ae8b40721..9e2aeb976 100644 --- a/fsw/cfe-core/ut-stubs/ut_es_stubs.c +++ b/fsw/cfe-core/ut-stubs/ut_es_stubs.c @@ -90,10 +90,15 @@ int32 CFE_ES_CreateChildTask(uint32 *TaskIdPtr, uint32 Priority, uint32 Flags) { - int32 status; - UT_Stub_RegisterContext(UT_KEY(CFE_ES_CreateChildTask), TaskIdPtr); UT_Stub_RegisterContext(UT_KEY(CFE_ES_CreateChildTask), TaskName); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_CreateChildTask), FunctionPtr); + UT_Stub_RegisterContext(UT_KEY(CFE_ES_CreateChildTask), StackPtr); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_CreateChildTask), StackSize); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_CreateChildTask), Priority); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_CreateChildTask), Flags); + + int32 status; status = UT_DEFAULT_IMPL(CFE_ES_CreateChildTask); @@ -120,8 +125,10 @@ int32 CFE_ES_CreateChildTask(uint32 *TaskIdPtr, ** Returns either a user-defined status flag or CFE_SUCCESS. ** ******************************************************************************/ -int32 CFE_ES_GetAppID(uint32 *pAppID) +int32 CFE_ES_GetAppID(uint32 *AppIdPtr) { + UT_Stub_RegisterContext(UT_KEY(CFE_ES_GetAppID), AppIdPtr); + int32 status; uint32 *IdBuff; uint32 BuffSize; @@ -132,13 +139,13 @@ int32 CFE_ES_GetAppID(uint32 *pAppID) if (status >= 0) { UT_GetDataBuffer(UT_KEY(CFE_ES_GetAppID), (void **)&IdBuff, &BuffSize, &Position); - if (IdBuff != NULL && BuffSize == sizeof(*pAppID)) + if (IdBuff != NULL && BuffSize == sizeof(*AppIdPtr)) { - *pAppID = *IdBuff; + *AppIdPtr = *IdBuff; } else { - *pAppID = 0; + *AppIdPtr = 0; } } @@ -166,37 +173,38 @@ int32 CFE_ES_GetAppID(uint32 *pAppID) ** Returns either CFE_ES_ERR_APPNAME or CFE_SUCCESS. ** ******************************************************************************/ -int32 CFE_ES_GetAppIDByName(uint32 *pAppID, const char *pAppName) +int32 CFE_ES_GetAppIDByName(uint32 *AppIdPtr, const char *AppName) { + UT_Stub_RegisterContext(UT_KEY(CFE_ES_GetAppIDByName), AppIdPtr); + UT_Stub_RegisterContext(UT_KEY(CFE_ES_GetAppIDByName), AppName); + uint32 UserBuffSize; uint32 BuffPosition; const char *NameBuff; uint32 *IdBuff; int32 status; - UT_Stub_RegisterContext(UT_KEY(CFE_ES_GetAppIDByName), pAppID); - UT_Stub_RegisterContext(UT_KEY(CFE_ES_GetAppIDByName), pAppName); status = UT_DEFAULT_IMPL(CFE_ES_GetAppIDByName); if (status >= 0) { - if (UT_Stub_CopyToLocal(UT_KEY(CFE_ES_GetAppIDByName), (uint8*)pAppID, sizeof(*pAppID)) < sizeof(*pAppID)) + if (UT_Stub_CopyToLocal(UT_KEY(CFE_ES_GetAppIDByName), (uint8*)AppIdPtr, sizeof(*AppIdPtr)) < sizeof(*AppIdPtr)) { IdBuff = NULL; UT_GetDataBuffer(UT_KEY(CFE_ES_GetAppName), (void**)&NameBuff, &UserBuffSize, &BuffPosition); if (NameBuff != NULL && UserBuffSize > 0 && - strncmp(NameBuff, pAppName, UserBuffSize) == 0) + strncmp(NameBuff, AppName, UserBuffSize) == 0) { UT_GetDataBuffer(UT_KEY(CFE_ES_GetAppID), (void**)&IdBuff, &UserBuffSize, &BuffPosition); } - if (IdBuff != NULL && UserBuffSize == sizeof(*pAppID)) + if (IdBuff != NULL && UserBuffSize == sizeof(*AppIdPtr)) { - *pAppID = *IdBuff; + *AppIdPtr = *IdBuff; } else { - *pAppID = 0; + *AppIdPtr = 0; } } } @@ -221,8 +229,12 @@ int32 CFE_ES_GetAppIDByName(uint32 *pAppID, const char *pAppName) ** Returns CFE_SUCCESS. ** ******************************************************************************/ -int32 CFE_ES_GetAppName(char *pAppName, uint32 AppID, uint32 BufferLength) +int32 CFE_ES_GetAppName(char *AppName, uint32 AppId, uint32 BufferLength) { + UT_Stub_RegisterContext(UT_KEY(CFE_ES_GetAppName), AppName); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_GetAppName), AppId); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_GetAppName), BufferLength); + uint32 UserBuffSize; uint32 BuffPosition; const char *NameBuff; @@ -248,8 +260,8 @@ int32 CFE_ES_GetAppName(char *pAppName, uint32 AppID, uint32 BufferLength) BuffPosition = BufferLength - 1; } - strncpy(pAppName, NameBuff, BuffPosition); - pAppName[BuffPosition] = 0; + strncpy(AppName, NameBuff, BuffPosition); + AppName[BuffPosition] = 0; } return status; @@ -330,20 +342,20 @@ int32 CFE_ES_RegisterChildTask(void) ** Returns CFE_SUCCESS. ** ******************************************************************************/ -int32 CFE_ES_WriteToSysLog(const char *pSpecString, ...) +int32 CFE_ES_WriteToSysLog(const char *SpecStringPtr, ...) { + UT_Stub_RegisterContext(UT_KEY(CFE_ES_WriteToSysLog), SpecStringPtr); + int32 status; va_list va; - UT_Stub_RegisterContext(UT_KEY(CFE_ES_WriteToSysLog), pSpecString); // allow this input to be used by hook functions - - va_start(va,pSpecString); + va_start(va,SpecStringPtr); status = UT_DEFAULT_IMPL_VARARGS(CFE_ES_WriteToSysLog, va); va_end(va); if (status >= 0) { - UT_Stub_CopyFromLocal(UT_KEY(CFE_ES_WriteToSysLog), (const uint8*)pSpecString, strlen(pSpecString)); + UT_Stub_CopyFromLocal(UT_KEY(CFE_ES_WriteToSysLog), (const uint8*)SpecStringPtr, strlen(SpecStringPtr)); } return status; @@ -375,6 +387,10 @@ int32 CFE_ES_GetPoolBuf(uint32 **BufPtr, CFE_ES_MemHandle_t HandlePtr, uint32 Size) { + UT_Stub_RegisterContext(UT_KEY(CFE_ES_GetPoolBuf), BufPtr); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_GetPoolBuf), HandlePtr); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_GetPoolBuf), Size); + static union { uint32 Start; @@ -479,6 +495,10 @@ int32 CFE_ES_GetPoolBuf(uint32 **BufPtr, ******************************************************************************/ int32 CFE_ES_PoolCreate(cpuaddr *HandlePtr, uint8 *MemPtr, uint32 Size) { + UT_Stub_RegisterContext(UT_KEY(CFE_ES_PoolCreate), HandlePtr); + UT_Stub_RegisterContext(UT_KEY(CFE_ES_PoolCreate), MemPtr); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_PoolCreate), Size); + int32 status; status = UT_DEFAULT_IMPL(CFE_ES_PoolCreate); @@ -510,6 +530,10 @@ int32 CFE_ES_PoolCreateNoSem(CFE_ES_MemHandle_t *HandlePtr, uint8 *MemPtr, uint32 Size) { + UT_Stub_RegisterContext(UT_KEY(CFE_ES_PoolCreateNoSem), HandlePtr); + UT_Stub_RegisterContext(UT_KEY(CFE_ES_PoolCreateNoSem), MemPtr); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_PoolCreateNoSem), Size); + int32 status; status = UT_DEFAULT_IMPL(CFE_ES_PoolCreateNoSem); @@ -549,6 +573,13 @@ int32 CFE_ES_PoolCreateEx(cpuaddr *HandlePtr, uint32 *BlockSizes, uint16 UseMutex) { + UT_Stub_RegisterContext(UT_KEY(CFE_ES_PoolCreateEx), HandlePtr); + UT_Stub_RegisterContext(UT_KEY(CFE_ES_PoolCreateEx), MemPtr); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_PoolCreateEx), Size); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_PoolCreateEx), NumBlockSizes); + UT_Stub_RegisterContext(UT_KEY(CFE_ES_PoolCreateEx), BlockSizes); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_PoolCreateEx), UseMutex); + int32 status = CFE_SUCCESS; status = UT_DEFAULT_IMPL(CFE_ES_PoolCreateEx); @@ -581,6 +612,9 @@ int32 CFE_ES_PoolCreateEx(cpuaddr *HandlePtr, ******************************************************************************/ int32 CFE_ES_PutPoolBuf(CFE_ES_MemHandle_t HandlePtr, uint32 *BufPtr) { + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_PutPoolBuf), HandlePtr); + UT_Stub_RegisterContext(UT_KEY(CFE_ES_PutPoolBuf), BufPtr); + int32 status; status = UT_DEFAULT_IMPL_RC(CFE_ES_PutPoolBuf, 16); @@ -610,6 +644,9 @@ int32 CFE_ES_PutPoolBuf(CFE_ES_MemHandle_t HandlePtr, uint32 *BufPtr) ******************************************************************************/ int32 CFE_ES_GetPoolBufInfo(CFE_ES_MemHandle_t HandlePtr, uint32 *BufPtr) { + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_GetPoolBufInfo), HandlePtr); + UT_Stub_RegisterContext(UT_KEY(CFE_ES_GetPoolBufInfo), BufPtr); + int32 status; status = UT_DEFAULT_IMPL_RC(CFE_ES_GetPoolBufInfo, 16); @@ -634,8 +671,8 @@ int32 CFE_ES_GetPoolBufInfo(CFE_ES_MemHandle_t HandlePtr, uint32 *BufPtr) ******************************************************************************/ void CFE_ES_PerfLogAdd(uint32 Marker, uint32 EntryExit) { - UT_Stub_RegisterContext(UT_KEY(CFE_ES_PerfLogAdd), &Marker); - UT_Stub_RegisterContext(UT_KEY(CFE_ES_PerfLogAdd), &EntryExit); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_PerfLogAdd), Marker); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_PerfLogAdd), EntryExit); UT_DEFAULT_IMPL(CFE_ES_PerfLogAdd); } @@ -661,6 +698,11 @@ uint32 CFE_ES_CalculateCRC(const void *DataPtr, uint32 InputCRC, uint32 TypeCRC) { + UT_Stub_RegisterContext(UT_KEY(CFE_ES_CalculateCRC), DataPtr); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_CalculateCRC), DataLength); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_CalculateCRC), InputCRC); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_CalculateCRC), TypeCRC); + uint32 result; UT_DEFAULT_IMPL(CFE_ES_CalculateCRC); @@ -697,6 +739,9 @@ uint32 CFE_ES_CalculateCRC(const void *DataPtr, ******************************************************************************/ int32 CFE_ES_GetTaskInfo(CFE_ES_TaskInfo_t *TaskInfo, uint32 TaskId) { + UT_Stub_RegisterContext(UT_KEY(CFE_ES_GetTaskInfo), TaskInfo); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_GetTaskInfo), TaskId); + int32 status = CFE_SUCCESS; status = UT_DEFAULT_IMPL(CFE_ES_GetTaskInfo); @@ -736,7 +781,8 @@ int32 CFE_ES_GetTaskInfo(CFE_ES_TaskInfo_t *TaskInfo, uint32 TaskId) ******************************************************************************/ void CFE_ES_ExitApp(uint32 ExitStatus) { - UT_Stub_RegisterContext(UT_KEY(CFE_ES_ExitApp), &ExitStatus); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_ExitApp), ExitStatus); + UT_DEFAULT_IMPL(CFE_ES_ExitApp); UT_Stub_CopyFromLocal(UT_KEY(CFE_ES_ExitApp), (uint8*)&ExitStatus, sizeof(ExitStatus)); } @@ -912,6 +958,8 @@ int32 CFE_ES_DeleteCDS(const char *CDSName, bool CalledByTblServices) ******************************************************************************/ int32 CFE_ES_GetResetType(uint32 *ResetSubtypePtr) { + UT_Stub_RegisterContext(UT_KEY(CFE_ES_GetResetType), ResetSubtypePtr); + int32 status = CFE_SUCCESS; status = UT_DEFAULT_IMPL(CFE_ES_GetResetType); @@ -944,8 +992,11 @@ void CFE_ES_IncrementTaskCounter(void) UT_DEFAULT_IMPL(CFE_ES_IncrementTaskCounter); } -int32 CFE_ES_WaitForSystemState(uint32 State, uint32 Timeout) +int32 CFE_ES_WaitForSystemState(uint32 MinSystemState, uint32 TimeOutMilliseconds) { + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_WaitForSystemState), MinSystemState); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_WaitForSystemState), TimeOutMilliseconds); + int32 status = CFE_SUCCESS; status = UT_DEFAULT_IMPL(CFE_ES_WaitForSystemState); @@ -968,20 +1019,185 @@ int32 CFE_ES_WaitForSystemState(uint32 State, uint32 Timeout) ** This function does not return a value. ** ******************************************************************************/ -void CFE_ES_WaitForStartupSync(uint32 Timeout) +void CFE_ES_WaitForStartupSync(uint32 TimeOutMilliseconds) { + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_WaitForStartupSync), TimeOutMilliseconds); + UT_DEFAULT_IMPL(CFE_ES_WaitForStartupSync); } bool CFE_ES_RunLoop(uint32 *ExitStatus) { + UT_Stub_RegisterContext(UT_KEY(CFE_ES_RunLoop), ExitStatus); + return UT_DEFAULT_IMPL(CFE_ES_RunLoop) != 0; } -UT_DEFAULT_STUB(CFE_ES_RegisterCDS, (CFE_ES_CDSHandle_t *HandlePtr, int32 BlockSize, const char *Name)) +int32 CFE_ES_RegisterCDS(CFE_ES_CDSHandle_t *HandlePtr, int32 BlockSize, const char *Name) +{ + UT_Stub_RegisterContext(UT_KEY(CFE_ES_RegisterCDS), HandlePtr); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_RegisterCDS), BlockSize); + UT_Stub_RegisterContext(UT_KEY(CFE_ES_RegisterCDS), Name); + + int32 status; + + status = UT_DEFAULT_IMPL(CFE_ES_RegisterCDS); + + return status; +} void CFE_ES_ExitChildTask(void) { UT_DEFAULT_IMPL(CFE_ES_ExitChildTask); } +int32 CFE_ES_DeleteApp(uint32 AppID) +{ + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_DeleteApp), AppID); + + int32 status; + + status = UT_DEFAULT_IMPL(CFE_ES_DeleteApp); + + return status; +} + +int32 CFE_ES_DeleteChildTask(uint32 TaskId) +{ + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_DeleteChildTask), TaskId); + + int32 status; + + status = UT_DEFAULT_IMPL(CFE_ES_DeleteChildTask); + + return status; +} + +int32 CFE_ES_DeleteGenCounter(uint32 CounterId) +{ + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_DeleteGenCounter), CounterId); + + int32 status; + + status = UT_DEFAULT_IMPL(CFE_ES_DeleteGenCounter); + + return status; +} + +int32 CFE_ES_GetAppInfo(CFE_ES_AppInfo_t *AppInfo, uint32 AppId) +{ + UT_Stub_RegisterContext(UT_KEY(CFE_ES_GetAppInfo), AppInfo); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_GetAppInfo), AppId); + + int32 status; + + status = UT_DEFAULT_IMPL(CFE_ES_GetAppInfo); + + return status; +} + +int32 CFE_ES_GetGenCount(uint32 CounterId, uint32 *Count) +{ + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_GetGenCount), CounterId); + UT_Stub_RegisterContext(UT_KEY(CFE_ES_GetGenCount), Count); + + int32 status; + + status = UT_DEFAULT_IMPL(CFE_ES_GetGenCount); + + return status; +} + +int32 CFE_ES_GetGenCounterIDByName(uint32 *CounterIdPtr, const char *CounterName) +{ + UT_Stub_RegisterContext(UT_KEY(CFE_ES_GetGenCounterIDByName), CounterIdPtr); + UT_Stub_RegisterContext(UT_KEY(CFE_ES_GetGenCounterIDByName), CounterName); + + int32 status; + + status = UT_DEFAULT_IMPL(CFE_ES_GetGenCounterIDByName); + + return status; +} + +int32 CFE_ES_GetMemPoolStats(CFE_ES_MemPoolStats_t *BufPtr, CFE_ES_MemHandle_t Handle) +{ + UT_Stub_RegisterContext(UT_KEY(CFE_ES_GetMemPoolStats), BufPtr); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_GetMemPoolStats), Handle); + + int32 status; + + status = UT_DEFAULT_IMPL(CFE_ES_GetMemPoolStats); + + return status; +} + +int32 CFE_ES_IncrementGenCounter(uint32 CounterId) +{ + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_IncrementGenCounter), CounterId); + + int32 status; + + status = UT_DEFAULT_IMPL(CFE_ES_IncrementGenCounter); + + return status; +} + +int32 CFE_ES_RegisterGenCounter(uint32 *CounterIdPtr, const char *CounterName) +{ + UT_Stub_RegisterContext(UT_KEY(CFE_ES_RegisterGenCounter), CounterIdPtr); + UT_Stub_RegisterContext(UT_KEY(CFE_ES_RegisterGenCounter), CounterName); + + int32 status; + + status = UT_DEFAULT_IMPL(CFE_ES_RegisterGenCounter); + + return status; +} + +int32 CFE_ES_ReloadApp(uint32 AppID, const char *AppFileName) +{ + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_ReloadApp), AppID); + UT_Stub_RegisterContext(UT_KEY(CFE_ES_ReloadApp), AppFileName); + + int32 status; + + status = UT_DEFAULT_IMPL(CFE_ES_ReloadApp); + + return status; +} + +int32 CFE_ES_ResetCFE(uint32 ResetType) +{ + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_ResetCFE), ResetType); + + int32 status; + + status = UT_DEFAULT_IMPL(CFE_ES_ResetCFE); + + return status; +} + +int32 CFE_ES_RestartApp(uint32 AppID) +{ + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_RestartApp), AppID); + + int32 status; + + status = UT_DEFAULT_IMPL(CFE_ES_RestartApp); + + return status; +} + +int32 CFE_ES_SetGenCount(uint32 CounterId, uint32 Count) +{ + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_SetGenCount), CounterId); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_SetGenCount), Count); + + int32 status; + + status = UT_DEFAULT_IMPL(CFE_ES_SetGenCount); + + return status; +} + diff --git a/fsw/cfe-core/ut-stubs/ut_evs_stubs.c b/fsw/cfe-core/ut-stubs/ut_evs_stubs.c index c5019fefd..c3711b2a7 100644 --- a/fsw/cfe-core/ut-stubs/ut_evs_stubs.c +++ b/fsw/cfe-core/ut-stubs/ut_evs_stubs.c @@ -108,12 +108,13 @@ int32 CFE_EVS_SendEvent(uint16 EventID, const char *Spec, ...) { + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_EVS_SendEvent), EventID); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_EVS_SendEvent), EventType); + UT_Stub_RegisterContext(UT_KEY(CFE_EVS_SendEvent), Spec); + int32 status; va_list va; - UT_Stub_RegisterContext(UT_KEY(CFE_EVS_SendEvent), &EventID); - UT_Stub_RegisterContext(UT_KEY(CFE_EVS_SendEvent), &EventType); - UT_Stub_RegisterContext(UT_KEY(CFE_EVS_SendEvent), Spec); va_start(va, Spec); status = UT_DEFAULT_IMPL_VARARGS(CFE_EVS_SendEvent, va); va_end(va); @@ -147,13 +148,21 @@ int32 CFE_EVS_SendTimedEvent(CFE_TIME_SysTime_t Time, const char *Spec, ...) { + /* + * NOTE: These args are out of order so that Arg[0] and Arg[1] will + * be the same as they are for other EVS calls. This keeps it + * compatible with old/existing UT hook routines. + * Newly-implemented hooks should use the name-based argument + * retrieval so it is independent of the order. + */ + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_EVS_SendTimedEvent), EventID); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_EVS_SendTimedEvent), EventType); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_EVS_SendTimedEvent), Time); + UT_Stub_RegisterContext(UT_KEY(CFE_EVS_SendTimedEvent), Spec); + int32 status; va_list va; - UT_Stub_RegisterContext(UT_KEY(CFE_EVS_SendEvent), &EventID); - UT_Stub_RegisterContext(UT_KEY(CFE_EVS_SendEvent), &EventType); - UT_Stub_RegisterContext(UT_KEY(CFE_EVS_SendEvent), &Time); - UT_Stub_RegisterContext(UT_KEY(CFE_EVS_SendEvent), Spec); va_start(va, Spec); status = UT_DefaultStubImplWithArgs(__func__, UT_KEY(CFE_EVS_SendTimedEvent), CFE_SUCCESS, va); va_end(va); @@ -187,9 +196,13 @@ int32 CFE_EVS_SendTimedEvent(CFE_TIME_SysTime_t Time, ** ******************************************************************************/ int32 CFE_EVS_Register(void *Filters, - uint16 NumEventFilters, + uint16 NumFilteredEvents, uint16 FilterScheme) { + UT_Stub_RegisterContext(UT_KEY(CFE_EVS_Register), Filters); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_EVS_Register), NumFilteredEvents); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_EVS_Register), FilterScheme); + int32 status; status = UT_DEFAULT_IMPL(CFE_EVS_Register); @@ -226,13 +239,14 @@ int32 CFE_EVS_SendEventWithAppID(uint16 EventID, const char *Spec, ...) { + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_EVS_SendEventWithAppID), EventID); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_EVS_SendEventWithAppID), EventType); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_EVS_SendEventWithAppID), AppID); + UT_Stub_RegisterContext(UT_KEY(CFE_EVS_SendEventWithAppID), Spec); + int32 status; va_list va; - UT_Stub_RegisterContext(UT_KEY(CFE_EVS_SendEvent), &EventID); - UT_Stub_RegisterContext(UT_KEY(CFE_EVS_SendEvent), &EventType); - UT_Stub_RegisterContext(UT_KEY(CFE_EVS_SendEvent), &AppID); - UT_Stub_RegisterContext(UT_KEY(CFE_EVS_SendEvent), Spec); va_start(va, Spec); status = UT_DefaultStubImplWithArgs(__func__, UT_KEY(CFE_EVS_SendEventWithAppID), CFE_SUCCESS, va); va_end(va); @@ -275,4 +289,32 @@ int32 CFE_EVS_CleanUpApp(uint32 AppId) return status; } -UT_DEFAULT_STUB(CFE_EVS_ResetAllFilters, ( void )) +int32 CFE_EVS_ResetAllFilters(void) +{ + int32 status; + + status = UT_DEFAULT_IMPL(CFE_EVS_ResetAllFilters); + + return status; +} + +int32 CFE_EVS_ResetFilter(int16 EventID) +{ + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_EVS_ResetFilter), EventID); + + int32 status; + + status = UT_DEFAULT_IMPL(CFE_EVS_ResetFilter); + + return status; +} + +int32 CFE_EVS_Unregister(void) +{ + int32 status; + + status = UT_DEFAULT_IMPL(CFE_EVS_Unregister); + + return status; +} + diff --git a/fsw/cfe-core/ut-stubs/ut_fs_stubs.c b/fsw/cfe-core/ut-stubs/ut_fs_stubs.c index 4324f5bd4..f1e87de4a 100644 --- a/fsw/cfe-core/ut-stubs/ut_fs_stubs.c +++ b/fsw/cfe-core/ut-stubs/ut_fs_stubs.c @@ -55,11 +55,13 @@ ** None ** ******************************************************************************/ -void CFE_FS_InitHeader(CFE_FS_Header_t *hdr, const char *Description, uint32 SubType) +void CFE_FS_InitHeader(CFE_FS_Header_t *Hdr, const char *Description, uint32 SubType) { - memset(hdr,0,sizeof(CFE_FS_Header_t)); - UT_Stub_RegisterContext(UT_KEY(CFE_FS_InitHeader), hdr); + UT_Stub_RegisterContext(UT_KEY(CFE_FS_InitHeader), Hdr); UT_Stub_RegisterContext(UT_KEY(CFE_FS_InitHeader), Description); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_FS_InitHeader), SubType); + + memset(Hdr,0,sizeof(CFE_FS_Header_t)); UT_DEFAULT_IMPL(CFE_FS_InitHeader); } @@ -85,15 +87,18 @@ void CFE_FS_InitHeader(CFE_FS_Header_t *hdr, const char *Description, uint32 Sub ** CFE_FS_Header_t structure in bytes. ** ******************************************************************************/ -int32 CFE_FS_WriteHeader(int32 filedes, CFE_FS_Header_t *hdr) +int32 CFE_FS_WriteHeader(int32 FileDes, CFE_FS_Header_t *Hdr) { + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_FS_WriteHeader), FileDes); + UT_Stub_RegisterContext(UT_KEY(CFE_FS_WriteHeader), Hdr); + int32 status; status = UT_DEFAULT_IMPL_RC(CFE_FS_WriteHeader, sizeof(CFE_FS_Header_t)); if (status > 0) { - UT_Stub_CopyFromLocal(UT_KEY(CFE_FS_WriteHeader), (const uint8*)hdr, status); + UT_Stub_CopyFromLocal(UT_KEY(CFE_FS_WriteHeader), (const uint8*)Hdr, status); } return status; @@ -123,6 +128,9 @@ int32 CFE_FS_WriteHeader(int32 filedes, CFE_FS_Header_t *hdr) ******************************************************************************/ int32 CFE_FS_ReadHeader(CFE_FS_Header_t *Hdr, int32 FileDes) { + UT_Stub_RegisterContext(UT_KEY(CFE_FS_ReadHeader), Hdr); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_FS_ReadHeader), FileDes); + int32 status; status = UT_DEFAULT_IMPL_RC(CFE_FS_ReadHeader, sizeof(CFE_FS_Header_t)); @@ -157,6 +165,9 @@ int32 CFE_FS_ReadHeader(CFE_FS_Header_t *Hdr, int32 FileDes) ******************************************************************************/ int32 CFE_FS_SetTimestamp(int32 FileDes, CFE_TIME_SysTime_t NewTimestamp) { + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_FS_SetTimestamp), FileDes); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_FS_SetTimestamp), NewTimestamp); + int32 status; status = UT_DEFAULT_IMPL(CFE_FS_SetTimestamp); @@ -213,6 +224,9 @@ int32 CFE_FS_EarlyInit(void) ******************************************************************************/ int32 CFE_FS_ExtractFilenameFromPath(const char *OriginalPath, char *FileNameOnly) { + UT_Stub_RegisterContext(UT_KEY(CFE_FS_ExtractFilenameFromPath), OriginalPath); + UT_Stub_RegisterContext(UT_KEY(CFE_FS_ExtractFilenameFromPath), FileNameOnly); + int i,j; int StringLength; int DirMarkIdx; diff --git a/fsw/cfe-core/ut-stubs/ut_sb_stubs.c b/fsw/cfe-core/ut-stubs/ut_sb_stubs.c index 1de4d0889..f0e22335b 100644 --- a/fsw/cfe-core/ut-stubs/ut_sb_stubs.c +++ b/fsw/cfe-core/ut-stubs/ut_sb_stubs.c @@ -39,7 +39,8 @@ typedef struct { CFE_SB_MsgId_t MsgId; - uint16 Length; + uint32 UserLength; + uint32 TotalLength; uint16 CommandCode; CFE_TIME_SysTime_t TimeStamp; @@ -146,6 +147,10 @@ void CFE_SB_TaskMain(void) int32 CFE_SB_CreatePipe(CFE_SB_PipeId_t *PipeIdPtr, uint16 Depth, const char *PipeName) { + UT_Stub_RegisterContext(UT_KEY(CFE_SB_CreatePipe), PipeIdPtr); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_CreatePipe), Depth); + UT_Stub_RegisterContext(UT_KEY(CFE_SB_CreatePipe), PipeName); + int32 status; status = UT_DEFAULT_IMPL(CFE_SB_CreatePipe); @@ -175,6 +180,8 @@ int32 CFE_SB_CreatePipe(CFE_SB_PipeId_t *PipeIdPtr, uint16 Depth, ******************************************************************************/ int32 CFE_SB_DeletePipe(CFE_SB_PipeId_t PipeId) { + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_DeletePipe), PipeId); + int32 status; status = UT_DEFAULT_IMPL(CFE_SB_DeletePipe); @@ -206,6 +213,10 @@ int32 CFE_SB_DeletePipe(CFE_SB_PipeId_t PipeId) ******************************************************************************/ int32 CFE_SB_GetPipeName(char *PipeNameBuf, size_t PipeNameSize, CFE_SB_PipeId_t PipeId) { + UT_Stub_RegisterContext(UT_KEY(CFE_SB_GetPipeName), PipeNameBuf); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_GetPipeName), PipeNameSize); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_GetPipeName), PipeId); + uint32 UserBuffSize; uint32 BuffPosition; const char *NameBuff; @@ -261,10 +272,11 @@ int32 CFE_SB_GetPipeName(char *PipeNameBuf, size_t PipeNameSize, CFE_SB_PipeId_t ******************************************************************************/ int32 CFE_SB_GetPipeIdByName(CFE_SB_PipeId_t *PipeIdPtr, const char *PipeName) { - int32 status; - UT_Stub_RegisterContext(UT_KEY(CFE_SB_GetPipeIdByName), PipeIdPtr); UT_Stub_RegisterContext(UT_KEY(CFE_SB_GetPipeIdByName), PipeName); + + int32 status; + status = UT_DEFAULT_IMPL(CFE_SB_GetPipeIdByName); if (status >= 0) @@ -300,6 +312,8 @@ int32 CFE_SB_GetPipeIdByName(CFE_SB_PipeId_t *PipeIdPtr, const char *PipeName) ******************************************************************************/ uint16 CFE_SB_GetCmdCode(CFE_SB_MsgPtr_t MsgPtr) { + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_GetCmdCode), MsgPtr); + int32 status; uint16 cmdcode = 0; @@ -334,6 +348,8 @@ uint16 CFE_SB_GetCmdCode(CFE_SB_MsgPtr_t MsgPtr) ******************************************************************************/ CFE_SB_MsgId_t CFE_SB_GetMsgId(const CFE_SB_Msg_t *MsgPtr) { + UT_Stub_RegisterContext(UT_KEY(CFE_SB_GetMsgId), MsgPtr); + CFE_SB_MsgId_t Result; UT_DEFAULT_IMPL(CFE_SB_GetMsgId); @@ -366,6 +382,11 @@ void CFE_SB_InitMsg(void *MsgPtr, uint16 Length, bool Clear) { + UT_Stub_RegisterContext(UT_KEY(CFE_SB_InitMsg), MsgPtr); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_InitMsg), MsgId); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_InitMsg), Length); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_InitMsg), Clear); + int32 status; status = UT_DEFAULT_IMPL(CFE_SB_InitMsg); @@ -373,7 +394,7 @@ void CFE_SB_InitMsg(void *MsgPtr, if (status >= 0) { CFE_SB_StubMsg_GetMetaData(MsgPtr)->MsgId = MsgId; - CFE_SB_StubMsg_GetMetaData(MsgPtr)->Length = Length; + CFE_SB_StubMsg_GetMetaData(MsgPtr)->TotalLength = Length; UT_Stub_CopyToLocal(UT_KEY(CFE_SB_InitMsg), (uint8*)MsgPtr, Length); } @@ -399,6 +420,10 @@ int32 CFE_SB_RcvMsg(CFE_SB_MsgPtr_t *BufPtr, CFE_SB_PipeId_t PipeId, int32 TimeOut) { + UT_Stub_RegisterContext(UT_KEY(CFE_SB_RcvMsg), BufPtr); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_RcvMsg), PipeId); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_RcvMsg), TimeOut); + int32 status; static union { @@ -448,20 +473,21 @@ int32 CFE_SB_RcvMsg(CFE_SB_MsgPtr_t *BufPtr, */ int32 CFE_SB_SendMsg(CFE_SB_Msg_t *MsgPtr) { + UT_Stub_RegisterContext(UT_KEY(CFE_SB_SendMsg), MsgPtr); + int32 status = CFE_SUCCESS; /* * Create a context entry so a hook function * could do something useful with the message */ - UT_Stub_RegisterContext(UT_KEY(CFE_SB_SendMsg), MsgPtr); status = UT_DEFAULT_IMPL(CFE_SB_SendMsg); if (status >= 0) { UT_Stub_CopyFromLocal(UT_KEY(CFE_SB_SendMsg), MsgPtr->Byte, - CFE_SB_StubMsg_GetMetaData(MsgPtr)->Length); + CFE_SB_StubMsg_GetMetaData(MsgPtr)->TotalLength); } return status; @@ -484,6 +510,9 @@ int32 CFE_SB_SendMsg(CFE_SB_Msg_t *MsgPtr) ******************************************************************************/ int32 CFE_SB_SetCmdCode(CFE_SB_MsgPtr_t MsgPtr, uint16 CmdCode) { + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_SetCmdCode), MsgPtr); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_SetCmdCode), CmdCode); + int32 status; status = UT_DEFAULT_IMPL(CFE_SB_SetCmdCode); @@ -513,6 +542,9 @@ int32 CFE_SB_SetCmdCode(CFE_SB_MsgPtr_t MsgPtr, uint16 CmdCode) ******************************************************************************/ void CFE_SB_SetMsgId(CFE_SB_MsgPtr_t MsgPtr, CFE_SB_MsgId_t MsgId) { + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_SetMsgId), MsgPtr); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_SetMsgId), MsgId); + int32 status; status = UT_DEFAULT_IMPL(CFE_SB_SetMsgId); @@ -540,15 +572,18 @@ void CFE_SB_SetMsgId(CFE_SB_MsgPtr_t MsgPtr, CFE_SB_MsgId_t MsgId) ** Returns CFE_SUCCESS. ** ******************************************************************************/ -int32 CFE_SB_SetMsgTime(CFE_SB_MsgPtr_t MsgPtr, CFE_TIME_SysTime_t time) +int32 CFE_SB_SetMsgTime(CFE_SB_MsgPtr_t MsgPtr, CFE_TIME_SysTime_t Time) { + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_SetMsgTime), MsgPtr); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_SetMsgTime), Time); + int32 status; status = UT_DEFAULT_IMPL(CFE_SB_SetMsgTime); if (status == 0) { - CFE_SB_StubMsg_GetMetaData(MsgPtr)->TimeStamp = time; + CFE_SB_StubMsg_GetMetaData(MsgPtr)->TimeStamp = Time; } return status; @@ -577,10 +612,13 @@ int32 CFE_SB_SetMsgTime(CFE_SB_MsgPtr_t MsgPtr, CFE_TIME_SysTime_t time) int32 CFE_SB_SubscribeEx(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeId, CFE_SB_Qos_t Quality, uint16 MsgLim) { + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_SubscribeEx), MsgId); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_SubscribeEx), PipeId); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_SubscribeEx), Quality); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_SubscribeEx), MsgLim); + int32 status; - UT_Stub_RegisterContext(UT_KEY(CFE_SB_SubscribeEx), &MsgId); - UT_Stub_RegisterContext(UT_KEY(CFE_SB_SubscribeEx), &PipeId); status = UT_DEFAULT_IMPL(CFE_SB_SubscribeEx); return status; @@ -608,10 +646,11 @@ int32 CFE_SB_SubscribeEx(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeId, ******************************************************************************/ int32 CFE_SB_Subscribe(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeId) { + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_Subscribe), MsgId); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_Subscribe), PipeId); + int32 status; - UT_Stub_RegisterContext(UT_KEY(CFE_SB_Subscribe), &MsgId); - UT_Stub_RegisterContext(UT_KEY(CFE_SB_Subscribe), &PipeId); status = UT_DEFAULT_IMPL(CFE_SB_Subscribe); return status; @@ -641,10 +680,12 @@ int32 CFE_SB_SubscribeLocal(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeId, uint16 MsgLim) { + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_SubscribeLocal), MsgId); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_SubscribeLocal), PipeId); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_SubscribeLocal), MsgLim); + int32 status; - UT_Stub_RegisterContext(UT_KEY(CFE_SB_SubscribeLocal), &MsgId); - UT_Stub_RegisterContext(UT_KEY(CFE_SB_SubscribeLocal), &PipeId); status = UT_DEFAULT_IMPL(CFE_SB_SubscribeLocal); return status; @@ -667,6 +708,8 @@ int32 CFE_SB_SubscribeLocal(CFE_SB_MsgId_t MsgId, ******************************************************************************/ void CFE_SB_TimeStampMsg(CFE_SB_MsgPtr_t MsgPtr) { + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_TimeStampMsg), MsgPtr); + UT_DEFAULT_IMPL(CFE_SB_TimeStampMsg); } @@ -688,6 +731,8 @@ void CFE_SB_TimeStampMsg(CFE_SB_MsgPtr_t MsgPtr) ******************************************************************************/ uint16 CFE_SB_GetTotalMsgLength(const CFE_SB_Msg_t *MsgPtr) { + UT_Stub_RegisterContext(UT_KEY(CFE_SB_GetTotalMsgLength), MsgPtr); + int32 status; uint16 result; @@ -699,7 +744,7 @@ uint16 CFE_SB_GetTotalMsgLength(const CFE_SB_Msg_t *MsgPtr) } else { - result = CFE_SB_StubMsg_GetMetaData(MsgPtr)->Length; + result = CFE_SB_StubMsg_GetMetaData(MsgPtr)->TotalLength; } return result; } @@ -736,10 +781,13 @@ int32 CFE_SB_CleanUpApp(uint32 AppId) */ int32 CFE_SB_MessageStringGet(char *DestStringPtr, const char *SourceStringPtr, const char *DefaultString, uint32 DestMaxSize, uint32 SourceMaxSize) { - int32 status; - UT_Stub_RegisterContext(UT_KEY(CFE_SB_MessageStringGet), DestStringPtr); UT_Stub_RegisterContext(UT_KEY(CFE_SB_MessageStringGet), SourceStringPtr); + UT_Stub_RegisterContext(UT_KEY(CFE_SB_MessageStringGet), DefaultString); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_MessageStringGet), DestMaxSize); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_MessageStringGet), SourceMaxSize); + + int32 status; status = UT_DEFAULT_IMPL(CFE_SB_MessageStringGet); @@ -772,7 +820,6 @@ int32 CFE_SB_MessageStringGet(char *DestStringPtr, const char *SourceStringPtr, return status; } - /****************************************************************************** ** Function: CFE_SB_MessageStringSet() ** @@ -781,10 +828,12 @@ int32 CFE_SB_MessageStringGet(char *DestStringPtr, const char *SourceStringPtr, */ int32 CFE_SB_MessageStringSet(char *DestStringPtr, const char *SourceStringPtr, uint32 DestMaxSize, uint32 SourceMaxSize) { - int32 status; + UT_Stub_RegisterContext(UT_KEY(CFE_SB_MessageStringSet), DestStringPtr); + UT_Stub_RegisterContext(UT_KEY(CFE_SB_MessageStringSet), SourceStringPtr); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_MessageStringSet), DestMaxSize); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_MessageStringSet), SourceMaxSize); - UT_Stub_RegisterContext(UT_KEY(CFE_SB_MessageStringGet), DestStringPtr); - UT_Stub_RegisterContext(UT_KEY(CFE_SB_MessageStringGet), SourceStringPtr); + int32 status; status = UT_DEFAULT_IMPL(CFE_SB_MessageStringSet); @@ -812,7 +861,17 @@ int32 CFE_SB_MessageStringSet(char *DestStringPtr, const char *SourceStringPtr, return status; } -UT_DEFAULT_STUB(CFE_SB_Unsubscribe, (CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeId)) +int32 CFE_SB_Unsubscribe(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeId) +{ + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_Unsubscribe), MsgId); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_Unsubscribe), PipeId); + + int32 status; + + status = UT_DEFAULT_IMPL(CFE_SB_Unsubscribe); + + return status; +} /****************************************************************************** ** Function: CFE_SB_GetMsgTime() @@ -829,6 +888,8 @@ UT_DEFAULT_STUB(CFE_SB_Unsubscribe, (CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeI */ CFE_TIME_SysTime_t CFE_SB_GetMsgTime(CFE_SB_MsgPtr_t MsgPtr) { + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_GetMsgTime), MsgPtr); + CFE_TIME_SysTime_t TimeFromMsg; UT_DEFAULT_IMPL(CFE_SB_GetMsgTime); @@ -844,6 +905,8 @@ CFE_TIME_SysTime_t CFE_SB_GetMsgTime(CFE_SB_MsgPtr_t MsgPtr) bool CFE_SB_ValidateChecksum(CFE_SB_MsgPtr_t MsgPtr) { + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_ValidateChecksum), MsgPtr); + int32 status; status = UT_DEFAULT_IMPL(CFE_SB_ValidateChecksum); @@ -853,6 +916,8 @@ bool CFE_SB_ValidateChecksum(CFE_SB_MsgPtr_t MsgPtr) void *CFE_SB_GetUserData(CFE_SB_MsgPtr_t MsgPtr) { + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_GetUserData), MsgPtr); + uint8 *BytePtr; void *Result; uint16 HdrSize; @@ -879,6 +944,9 @@ void *CFE_SB_GetUserData(CFE_SB_MsgPtr_t MsgPtr) void CFE_SB_SetTotalMsgLength (CFE_SB_MsgPtr_t MsgPtr,uint16 TotalLength) { + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_SetTotalMsgLength), MsgPtr); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_SetTotalMsgLength), TotalLength); + int32 status; status = UT_DEFAULT_IMPL(CFE_SB_SetTotalMsgLength); @@ -886,12 +954,14 @@ void CFE_SB_SetTotalMsgLength (CFE_SB_MsgPtr_t MsgPtr,uint16 TotalLength) if (status == 0) { UT_Stub_CopyFromLocal(UT_KEY(CFE_SB_SetTotalMsgLength), &TotalLength, sizeof(TotalLength)); - CFE_SB_StubMsg_GetMetaData(MsgPtr)->Length = TotalLength; + CFE_SB_StubMsg_GetMetaData(MsgPtr)->TotalLength = TotalLength; } } uint32 CFE_SB_GetPktType(CFE_SB_MsgId_t MsgId) { + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_GetPktType), MsgId); + int32 status; status = UT_DEFAULT_IMPL(CFE_SB_GetPktType); @@ -899,3 +969,169 @@ uint32 CFE_SB_GetPktType(CFE_SB_MsgId_t MsgId) return status; } +void CFE_SB_GenerateChecksum(CFE_SB_MsgPtr_t MsgPtr) +{ + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_GenerateChecksum), MsgPtr); + + UT_DEFAULT_IMPL(CFE_SB_GenerateChecksum); +} + +uint16 CFE_SB_GetChecksum(CFE_SB_MsgPtr_t MsgPtr) +{ + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_GetChecksum), MsgPtr); + + int32 status; + + status = UT_DEFAULT_IMPL(CFE_SB_GetChecksum); + + return status; +} + +uint32 CFE_SB_GetLastSenderId(CFE_SB_SenderId_t **Ptr, CFE_SB_PipeId_t PipeId) +{ + UT_Stub_RegisterContext(UT_KEY(CFE_SB_GetLastSenderId), Ptr); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_GetLastSenderId), PipeId); + + int32 status; + + status = UT_DEFAULT_IMPL(CFE_SB_GetLastSenderId); + + return status; +} + +int32 CFE_SB_GetPipeOpts(CFE_SB_PipeId_t PipeId, uint8 *OptPtr) +{ + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_GetPipeOpts), PipeId); + UT_Stub_RegisterContext(UT_KEY(CFE_SB_GetPipeOpts), OptPtr); + + int32 status; + + status = UT_DEFAULT_IMPL(CFE_SB_GetPipeOpts); + + return status; +} + +uint16 CFE_SB_GetUserDataLength(const CFE_SB_Msg_t *MsgPtr) +{ + UT_Stub_RegisterContext(UT_KEY(CFE_SB_GetUserDataLength), MsgPtr); + + int32 status; + + status = UT_DEFAULT_IMPL_RC(CFE_SB_GetUserDataLength, -1); + if (status < 0) + { + status = CFE_SB_StubMsg_GetMetaData(MsgPtr)->UserLength; + } + + return status; +} + +bool CFE_SB_IsValidMsgId(CFE_SB_MsgId_t MsgId) +{ + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_IsValidMsgId), MsgId); + + int32 status; + + status = UT_DEFAULT_IMPL(CFE_SB_IsValidMsgId); + + return status; +} + +int32 CFE_SB_PassMsg(CFE_SB_Msg_t *MsgPtr) +{ + UT_Stub_RegisterContext(UT_KEY(CFE_SB_PassMsg), MsgPtr); + + int32 status; + + status = UT_DEFAULT_IMPL(CFE_SB_PassMsg); + + return status; +} + +int32 CFE_SB_SetPipeOpts(CFE_SB_PipeId_t PipeId, uint8 Opts) +{ + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_SetPipeOpts), PipeId); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_SetPipeOpts), Opts); + + int32 status; + + status = UT_DEFAULT_IMPL(CFE_SB_SetPipeOpts); + + return status; +} + +void CFE_SB_SetUserDataLength(CFE_SB_MsgPtr_t MsgPtr, uint16 DataLength) +{ + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_SetUserDataLength), MsgPtr); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_SetUserDataLength), DataLength); + + UT_DEFAULT_IMPL(CFE_SB_SetUserDataLength); + CFE_SB_StubMsg_GetMetaData(MsgPtr)->UserLength = DataLength; +} + +int32 CFE_SB_UnsubscribeLocal(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeId) +{ + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_UnsubscribeLocal), MsgId); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_UnsubscribeLocal), PipeId); + + int32 status; + + status = UT_DEFAULT_IMPL(CFE_SB_UnsubscribeLocal); + + return status; +} + +CFE_SB_Msg_t* CFE_SB_ZeroCopyGetPtr(uint16 MsgSize, CFE_SB_ZeroCopyHandle_t *BufferHandle) +{ + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_ZeroCopyGetPtr), MsgSize); + UT_Stub_RegisterContext(UT_KEY(CFE_SB_ZeroCopyGetPtr), BufferHandle); + + int32 status; + CFE_SB_Msg_t* MsgPtr; + + MsgPtr = NULL; + status = UT_DEFAULT_IMPL(CFE_SB_ZeroCopyGetPtr); + if (status == CFE_SUCCESS) + { + UT_Stub_CopyToLocal(UT_KEY(CFE_SB_ZeroCopyGetPtr), &MsgPtr, sizeof(MsgPtr)); + } + + return MsgPtr; +} + +int32 CFE_SB_ZeroCopyPass(CFE_SB_Msg_t *MsgPtr, CFE_SB_ZeroCopyHandle_t BufferHandle) +{ + UT_Stub_RegisterContext(UT_KEY(CFE_SB_ZeroCopyPass), MsgPtr); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_ZeroCopyPass), BufferHandle); + + int32 status; + + status = UT_DEFAULT_IMPL(CFE_SB_ZeroCopyPass); + + return status; +} + +int32 CFE_SB_ZeroCopyReleasePtr(CFE_SB_Msg_t *Ptr2Release, CFE_SB_ZeroCopyHandle_t BufferHandle) +{ + UT_Stub_RegisterContext(UT_KEY(CFE_SB_ZeroCopyReleasePtr), Ptr2Release); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_ZeroCopyReleasePtr), BufferHandle); + + int32 status; + + status = UT_DEFAULT_IMPL(CFE_SB_ZeroCopyReleasePtr); + + return status; +} + +int32 CFE_SB_ZeroCopySend(CFE_SB_Msg_t *MsgPtr, CFE_SB_ZeroCopyHandle_t BufferHandle) +{ + UT_Stub_RegisterContext(UT_KEY(CFE_SB_ZeroCopySend), MsgPtr); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_ZeroCopySend), BufferHandle); + + int32 status; + + status = UT_DEFAULT_IMPL(CFE_SB_ZeroCopySend); + + return status; +} + diff --git a/fsw/cfe-core/ut-stubs/ut_tbl_stubs.c b/fsw/cfe-core/ut-stubs/ut_tbl_stubs.c index a939df970..32a3b2144 100644 --- a/fsw/cfe-core/ut-stubs/ut_tbl_stubs.c +++ b/fsw/cfe-core/ut-stubs/ut_tbl_stubs.c @@ -105,6 +105,12 @@ int32 CFE_TBL_Register( CFE_TBL_Handle_t *TblHandlePtr, /* Ret uint16 TblOptionFlags, /* Tbl Options Settings */ CFE_TBL_CallbackFuncPtr_t TblValidationFuncPtr ) /* Ptr to func that validates tbl */ { + UT_Stub_RegisterContext(UT_KEY(CFE_TBL_Register), TblHandlePtr); + UT_Stub_RegisterContext(UT_KEY(CFE_TBL_Register), Name); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TBL_Register), Size); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TBL_Register), TblOptionFlags); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TBL_Register), TblValidationFuncPtr); + int32 status; status = UT_DEFAULT_IMPL(CFE_TBL_Register); @@ -118,6 +124,9 @@ int32 CFE_TBL_Register( CFE_TBL_Handle_t *TblHandlePtr, /* Ret int32 CFE_TBL_GetAddress (void **TblPtr, CFE_TBL_Handle_t TblHandle) { + UT_Stub_RegisterContext(UT_KEY(CFE_TBL_GetAddress), TblPtr); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TBL_GetAddress), TblHandle); + int32 status; int32 ForceValue; @@ -130,28 +139,138 @@ int32 CFE_TBL_GetAddress (void **TblPtr, CFE_TBL_Handle_t TblHandle) return status; } -UT_DEFAULT_STUB(CFE_TBL_Load, (CFE_TBL_Handle_t TblHandle, CFE_TBL_SrcEnum_t SrcType, const void *SrcDataPtr)) +int32 CFE_TBL_Load( CFE_TBL_Handle_t TblHandle, CFE_TBL_SrcEnum_t SrcType, const void *SrcDataPtr ) +{ + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TBL_Load), TblHandle); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TBL_Load), SrcType); + UT_Stub_RegisterContext(UT_KEY(CFE_TBL_Load), SrcDataPtr); + + int32 status; + + status = UT_DEFAULT_IMPL(CFE_TBL_Load); + + return status; +} -UT_DEFAULT_STUB(CFE_TBL_Unregister, (CFE_TBL_Handle_t TblHandle)) +int32 CFE_TBL_Unregister( CFE_TBL_Handle_t TblHandle ) +{ + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TBL_Unregister), TblHandle); + + int32 status; + + status = UT_DEFAULT_IMPL(CFE_TBL_Unregister); + + return status; +} + +int32 CFE_TBL_Manage( CFE_TBL_Handle_t TblHandle ) +{ + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TBL_Manage), TblHandle); + + int32 status; + + status = UT_DEFAULT_IMPL(CFE_TBL_Manage); + + return status; +} + +int32 CFE_TBL_ReleaseAddress( CFE_TBL_Handle_t TblHandle ) +{ + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TBL_ReleaseAddress), TblHandle); + + int32 status; + + status = UT_DEFAULT_IMPL(CFE_TBL_ReleaseAddress); + + return status; +} + +int32 CFE_TBL_ReleaseAddresses( uint16 NumTables, const CFE_TBL_Handle_t TblHandles[] ) +{ + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TBL_ReleaseAddresses), NumTables); + UT_Stub_RegisterContext(UT_KEY(CFE_TBL_ReleaseAddresses), TblHandles); + + int32 status; + + status = UT_DEFAULT_IMPL(CFE_TBL_ReleaseAddresses); + + return status; +} + +int32 CFE_TBL_NotifyByMessage(CFE_TBL_Handle_t TblHandle, CFE_SB_MsgId_t MsgId, uint16 CommandCode, uint32 Parameter) +{ + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TBL_NotifyByMessage), TblHandle); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TBL_NotifyByMessage), MsgId); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TBL_NotifyByMessage), CommandCode); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TBL_NotifyByMessage), Parameter); + + int32 status; + + status = UT_DEFAULT_IMPL(CFE_TBL_NotifyByMessage); + + return status; +} -UT_DEFAULT_STUB(CFE_TBL_Manage, (CFE_TBL_Handle_t TblHandle)) +int32 CFE_TBL_Modified( CFE_TBL_Handle_t TblHandle ) +{ + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TBL_Modified), TblHandle); + + int32 status; + + status = UT_DEFAULT_IMPL(CFE_TBL_Modified); + + return status; +} + +int32 CFE_TBL_GetStatus( CFE_TBL_Handle_t TblHandle ) +{ + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TBL_GetStatus), TblHandle); + + int32 status; + + status = UT_DEFAULT_IMPL(CFE_TBL_GetStatus); + + return status; +} + +int32 CFE_TBL_DumpToBuffer( CFE_TBL_Handle_t TblHandle ) +{ + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TBL_DumpToBuffer), TblHandle); + + int32 status; + + status = UT_DEFAULT_IMPL(CFE_TBL_DumpToBuffer); + + return status; +} + +int32 CFE_TBL_Validate( CFE_TBL_Handle_t TblHandle ) +{ + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TBL_Validate), TblHandle); -UT_DEFAULT_STUB(CFE_TBL_ReleaseAddress, (CFE_TBL_Handle_t TblHandle)) + int32 status; -UT_DEFAULT_STUB(CFE_TBL_NotifyByMessage, (CFE_TBL_Handle_t TblHandle, CFE_SB_MsgId_t MsgId, uint16 CommandCode, uint32 Parameter)) + status = UT_DEFAULT_IMPL(CFE_TBL_Validate); -UT_DEFAULT_STUB(CFE_TBL_Modified, (CFE_TBL_Handle_t TblHandle )) + return status; +} -UT_DEFAULT_STUB(CFE_TBL_GetStatus, ( CFE_TBL_Handle_t TblHandle )) +int32 CFE_TBL_Update( CFE_TBL_Handle_t TblHandle ) +{ + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TBL_Update), TblHandle); -UT_DEFAULT_STUB(CFE_TBL_DumpToBuffer, ( CFE_TBL_Handle_t TblHandle )) + int32 status; -UT_DEFAULT_STUB(CFE_TBL_Validate, ( CFE_TBL_Handle_t TblHandle )) + status = UT_DEFAULT_IMPL(CFE_TBL_Update); -UT_DEFAULT_STUB(CFE_TBL_Update, ( CFE_TBL_Handle_t TblHandle )) + return status; +} int32 CFE_TBL_GetInfo( CFE_TBL_Info_t *TblInfoPtr, const char *TblName ) { + UT_Stub_RegisterContext(UT_KEY(CFE_TBL_GetInfo), TblInfoPtr); + UT_Stub_RegisterContext(UT_KEY(CFE_TBL_GetInfo), TblName); + int32 status; status = UT_DEFAULT_IMPL(CFE_TBL_GetInfo); @@ -165,4 +284,28 @@ int32 CFE_TBL_GetInfo( CFE_TBL_Info_t *TblInfoPtr, const char *TblName ) return status; } +int32 CFE_TBL_GetAddresses( void **TblPtrs[], uint16 NumTables, const CFE_TBL_Handle_t TblHandles[] ) +{ + UT_Stub_RegisterContext(UT_KEY(CFE_TBL_GetAddresses), TblPtrs); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TBL_GetAddresses), NumTables); + UT_Stub_RegisterContext(UT_KEY(CFE_TBL_GetAddresses), TblHandles); + + int32 status; + + status = UT_DEFAULT_IMPL(CFE_TBL_GetAddresses); + + return status; +} + +int32 CFE_TBL_Share( CFE_TBL_Handle_t *TblHandlePtr, const char *TblName ) +{ + UT_Stub_RegisterContext(UT_KEY(CFE_TBL_Share), TblHandlePtr); + UT_Stub_RegisterContext(UT_KEY(CFE_TBL_Share), TblName); + + int32 status; + + status = UT_DEFAULT_IMPL(CFE_TBL_Share); + + return status; +} diff --git a/fsw/cfe-core/ut-stubs/ut_time_stubs.c b/fsw/cfe-core/ut-stubs/ut_time_stubs.c index 495193646..48508d43f 100644 --- a/fsw/cfe-core/ut-stubs/ut_time_stubs.c +++ b/fsw/cfe-core/ut-stubs/ut_time_stubs.c @@ -101,14 +101,15 @@ void CFE_TIME_TaskMain(void) ******************************************************************************/ void CFE_TIME_Print(char *PrintBuffer, CFE_TIME_SysTime_t TimeToPrint) { + UT_Stub_RegisterContext(UT_KEY(CFE_TIME_Print), PrintBuffer); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TIME_Print), TimeToPrint); + snprintf(PrintBuffer, CFE_TIME_PRINTED_STRING_SIZE, "UT %u.%u -", (unsigned int)TimeToPrint.Seconds, (unsigned int)TimeToPrint.Subseconds); - UT_Stub_RegisterContext(UT_KEY(CFE_TIME_Print), PrintBuffer); - UT_Stub_RegisterContext(UT_KEY(CFE_TIME_Print), &TimeToPrint); UT_DEFAULT_IMPL(CFE_TIME_Print); } @@ -181,6 +182,9 @@ int32 CFE_TIME_CleanUpApp(uint32 AppId) CFE_TIME_Compare_t CFE_TIME_Compare(CFE_TIME_SysTime_t TimeA, CFE_TIME_SysTime_t TimeB) { + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TIME_Compare), TimeA); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TIME_Compare), TimeB); + int32 status; status = UT_DEFAULT_IMPL(CFE_TIME_Compare); @@ -190,6 +194,9 @@ CFE_TIME_Compare_t CFE_TIME_Compare(CFE_TIME_SysTime_t TimeA, CFE_TIME_SysTime_ CFE_TIME_SysTime_t CFE_TIME_Add(CFE_TIME_SysTime_t Time1, CFE_TIME_SysTime_t Time2) { + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TIME_Add), Time1); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TIME_Add), Time2); + static CFE_TIME_SysTime_t SimTime = { 0 }; CFE_TIME_SysTime_t Result = { 0 }; int32 status; @@ -211,6 +218,8 @@ CFE_TIME_SysTime_t CFE_TIME_Add(CFE_TIME_SysTime_t Time1, CFE_TIME_SysTime_t Ti uint32 CFE_TIME_Sub2MicroSecs(uint32 SubSeconds) { + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TIME_Sub2MicroSecs), SubSeconds); + int32 status; status = UT_DEFAULT_IMPL(CFE_TIME_Sub2MicroSecs); @@ -218,14 +227,197 @@ uint32 CFE_TIME_Sub2MicroSecs(uint32 SubSeconds) return (uint32) status; } -uint32 CFE_TIME_FS2CFESeconds(uint32 SecondsFS) +int32 CFE_TIME_UnregisterSynchCallback(CFE_TIME_SynchCallbackPtr_t CallbackFuncPtr) { + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TIME_UnregisterSynchCallback), CallbackFuncPtr); + int32 status; - status = UT_DEFAULT_IMPL(CFE_TIME_FS2CFESeconds); + status = UT_DEFAULT_IMPL(CFE_TIME_UnregisterSynchCallback); - return (uint32) status; + return status; +} + +void CFE_TIME_ExternalGPS(CFE_TIME_SysTime_t NewTime, int16 NewLeaps) +{ + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TIME_ExternalGPS), NewTime); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TIME_ExternalGPS), NewLeaps); + + UT_DEFAULT_IMPL(CFE_TIME_ExternalGPS); +} + +void CFE_TIME_ExternalMET(CFE_TIME_SysTime_t NewMET) +{ + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TIME_ExternalMET), NewMET); + + UT_DEFAULT_IMPL(CFE_TIME_ExternalMET); +} + +void CFE_TIME_ExternalTime(CFE_TIME_SysTime_t NewTime) +{ + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TIME_ExternalTime), NewTime); + + UT_DEFAULT_IMPL(CFE_TIME_ExternalTime); +} + +void CFE_TIME_ExternalTone(void) +{ + UT_DEFAULT_IMPL(CFE_TIME_ExternalTone); +} + +uint16 CFE_TIME_GetClockInfo(void) +{ + int32 status; + + status = UT_DEFAULT_IMPL(CFE_TIME_GetClockInfo); + + return status; +} + +CFE_TIME_ClockState_Enum_t CFE_TIME_GetClockState(void) +{ + int32 status; + + status = UT_DEFAULT_IMPL(CFE_TIME_GetClockState); + + return status; +} + +int16 CFE_TIME_GetLeapSeconds(void) +{ + int32 status; + + status = UT_DEFAULT_IMPL(CFE_TIME_GetLeapSeconds); + + return status; +} + +CFE_TIME_SysTime_t CFE_TIME_GetMET(void) +{ + int32 status; + CFE_TIME_SysTime_t Result = { 0 }; + + status = UT_DEFAULT_IMPL(CFE_TIME_GetMET); + if (status == 0) + { + UT_Stub_CopyToLocal(UT_KEY(CFE_TIME_GetMET), &Result, sizeof(Result)); + } + + return Result; +} + +uint32 CFE_TIME_GetMETseconds(void) +{ + int32 status; + + status = UT_DEFAULT_IMPL(CFE_TIME_GetMETseconds); + + return status; +} + +uint32 CFE_TIME_GetMETsubsecs(void) +{ + int32 status; + + status = UT_DEFAULT_IMPL(CFE_TIME_GetMETsubsecs); + + return status; +} + +CFE_TIME_SysTime_t CFE_TIME_GetSTCF(void) +{ + int32 status; + CFE_TIME_SysTime_t Result = { 0 }; + + status = UT_DEFAULT_IMPL(CFE_TIME_GetSTCF); + if (status == 0) + { + UT_Stub_CopyToLocal(UT_KEY(CFE_TIME_GetSTCF), &Result, sizeof(Result)); + } + + return Result; +} + +CFE_TIME_SysTime_t CFE_TIME_GetTAI(void) +{ + int32 status; + CFE_TIME_SysTime_t Result = { 0 }; + + status = UT_DEFAULT_IMPL(CFE_TIME_GetTAI); + if (status == 0) + { + UT_Stub_CopyToLocal(UT_KEY(CFE_TIME_GetTAI), &Result, sizeof(Result)); + } + + return Result; +} + +CFE_TIME_SysTime_t CFE_TIME_GetUTC(void) +{ + int32 status; + CFE_TIME_SysTime_t Result = { 0 }; + + status = UT_DEFAULT_IMPL(CFE_TIME_GetUTC); + if (status == 0) + { + UT_Stub_CopyToLocal(UT_KEY(CFE_TIME_GetUTC), &Result, sizeof(Result)); + } + + return Result; +} + +CFE_TIME_SysTime_t CFE_TIME_MET2SCTime(CFE_TIME_SysTime_t METTime) +{ + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TIME_MET2SCTime), METTime); + + int32 status; + CFE_TIME_SysTime_t Result = { 0 }; + + status = UT_DEFAULT_IMPL(CFE_TIME_MET2SCTime); + if (status == 0) + { + UT_Stub_CopyToLocal(UT_KEY(CFE_TIME_MET2SCTime), &Result, sizeof(Result)); + } + + return Result; +} + +uint32 CFE_TIME_Micro2SubSecs(uint32 MicroSeconds) +{ + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TIME_Micro2SubSecs), MicroSeconds); + + int32 status; + + status = UT_DEFAULT_IMPL(CFE_TIME_Micro2SubSecs); + + return status; +} + +int32 CFE_TIME_RegisterSynchCallback(CFE_TIME_SynchCallbackPtr_t CallbackFuncPtr) +{ + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TIME_RegisterSynchCallback), CallbackFuncPtr); + + int32 status; + + status = UT_DEFAULT_IMPL(CFE_TIME_RegisterSynchCallback); + + return status; } -UT_DEFAULT_STUB(CFE_TIME_UnregisterSynchCallback, (CFE_TIME_SynchCallbackPtr_t CallbackFuncPtr)) +CFE_TIME_SysTime_t CFE_TIME_Subtract(CFE_TIME_SysTime_t Time1, CFE_TIME_SysTime_t Time2) +{ + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TIME_Subtract), Time1); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TIME_Subtract), Time2); + + int32 status; + CFE_TIME_SysTime_t Result = { 0 }; + + status = UT_DEFAULT_IMPL(CFE_TIME_Subtract); + if (status == 0) + { + UT_Stub_CopyToLocal(UT_KEY(CFE_TIME_Subtract), &Result, sizeof(Result)); + } + + return Result; +}