diff --git a/fsw/inc/cs_tbldefs.h b/fsw/inc/cs_tbldefs.h index 51c2640..7191112 100644 --- a/fsw/inc/cs_tbldefs.h +++ b/fsw/inc/cs_tbldefs.h @@ -140,268 +140,4 @@ typedef struct char Name[OS_MAX_API_NAME]; /**< \brief name of the app */ } CS_Res_App_Table_Entry_t; -/************************************************************************** - ** - ** Function Prototypes - ** - **************************************************************************/ - -/** - * \brief Validate EEPROM definition table - * - * \par Description - * This function is a callback to cFE Table Services that gets called - * when a validation is requested. - * - * \par Assumptions, External Events, and Notes: - * None - * - * \param [in] TblPtr A pointer to the table to be validated - * - * \return Execution status see \ref CFEReturnCodes - * \retval #CFE_SUCCESS \copydoc CFE_SUCCESS - * \retval #CS_TABLE_ERROR \copydoc CS_TABLE_ERROR - */ -CFE_Status_t CS_ValidateEepromChecksumDefinitionTable(void *TblPtr); - -/** - * \brief Validate Memory definition table - * - * \par Description - * This function is a callback to cFE Table Services that gets called - * when a validation is requested. - * - * \par Assumptions, External Events, and Notes: - * None - * - * \param [in] TblPtr A pointer to the table to be validated - * - * \return Execution status see \ref CFEReturnCodes - * \retval #CFE_SUCCESS \copydoc CFE_SUCCESS - * \retval #CS_TABLE_ERROR \copydoc CS_TABLE_ERROR - */ -CFE_Status_t CS_ValidateMemoryChecksumDefinitionTable(void *TblPtr); - -/** - * \brief Validate Tables definition table - * - * \par Description - * This function is a callback to cFE Table Services that gets called - * when a validation is requested. - * - * \par Assumptions, External Events, and Notes: - * None - * - * \param [in] TblPtr A pointer to the table to be validated - * - * \return Execution status see \ref CFEReturnCodes - * \retval #CFE_SUCCESS \copydoc CFE_SUCCESS - * \retval #CS_TABLE_ERROR \copydoc CS_TABLE_ERROR - */ -CFE_Status_t CS_ValidateTablesChecksumDefinitionTable(void *TblPtr); - -/** - * \brief Validate App definition table - * - * \par Description - * This function is a callback to cFE Table Services that gets called - * when a validation is requested. - * - * \par Assumptions, External Events, and Notes: - * None - * - * \param [in] TblPtr A pointer to the table to be validated - * - * \return Execution status see \ref CFEReturnCodes - * \retval #CFE_SUCCESS \copydoc CFE_SUCCESS - * \retval #CS_TABLE_ERROR \copydoc CS_TABLE_ERROR - */ -CFE_Status_t CS_ValidateAppChecksumDefinitionTable(void *TblPtr); - -/** - * \brief Processes a new definition table for EEPROM or Memory tables - * - * \par Description - * Copies data from the definition table to the results table - * because the results table is where CS keeps all of its - * checksum data - * - * \par Assumptions, External Events, and Notes: - * None - * - * \param [in] DefinitionTblPtr A pointer to the definiton table - * (#CS_Def_EepromMemory_Table_Entry_t) - * that we are operating on - * - * \param [in] ResultsTblPtr A pointer to the result table - * (#CS_Res_EepromMemory_Table_Entry_t) - * to operate on - * \param [in] NumEntries The number of entries in the table - * \param [in] Table The specific table we are operating on - */ -void CS_ProcessNewEepromMemoryDefinitionTable(const CS_Def_EepromMemory_Table_Entry_t *DefinitionTblPtr, - const CS_Res_EepromMemory_Table_Entry_t *ResultsTblPtr, - const uint16 NumEntries, const uint16 Table); - -/** - * \brief Processes a new definition table for the Tables table - * - * \par Description - * Copies data from the definition table to the results table - * because the results table is where CS keeps all of its - * checksum data - * - * \par Assumptions, External Events, and Notes: - * None - * - * \param [in] DefinitionTblPtr A pointer to the definiton table - * (#CS_Def_Tables_Table_Entry_t) - * that we are operating on - * - * \param [in] ResultsTblPtr A pointer to the result table - * (#CS_Res_Tables_Table_Entry_t) - * to operate on - */ -void CS_ProcessNewTablesDefinitionTable(const CS_Def_Tables_Table_Entry_t *DefinitionTblPtr, - const CS_Res_Tables_Table_Entry_t *ResultsTblPtr); - -/** - * \brief Processes a new definition table for the App table - * - * \par Description - * Copies data from the definition table to the results table - * because the results table is where CS keeps all of its - * checksum data - * - * \par Assumptions, External Events, and Notes: - * None - * - * \param [in] DefinitionTblPtr A pointer to the definiton table - * (#CS_Def_App_Table_Entry_t) - * that we are operating on - * - * \param [in] ResultsTblPtr A pointer to the result table - * (#CS_Res_App_Table_Entry_t) - * to operate on - */ -void CS_ProcessNewAppDefinitionTable(const CS_Def_App_Table_Entry_t *DefinitionTblPtr, - const CS_Res_App_Table_Entry_t *ResultsTblPtr); - -/** - * \brief Initializes the results and definition table on startup - * - * \par Description - * Completes the Table Services registration and table load for - * the definition table and the registration for the results table - * - * \par Assumptions, External Events, and Notes: - * This function is used on all four type of tables individally. - * Also, if the default table file is not found for the definitionm - * table, this function loads a 'blank' table from memory - * - * \param [in] DefinitionTableHandle A #CFE_TBL_Handle_t pointer - * that will get filled in with the - * table handle to the definition - * table - * - * \param [in] ResultsTableHandle A #CFE_TBL_Handle_t pointer - * that will get filled in with the - * table handle to the results - * table - * - * \param [in] DefinitionTblPtr A pointer to the definiton table - * that we are operating on, it - * will get assigned during this - * call - * - * \param [in] ResultsTblPtr A pointer to the result table - * to operate on , it will get - * assigned during this call - * - * \param [in] Table The specific table we are - * operating on - * - * \param [in] DefinitionTableName The name of the definition table - * - * \param [in] ResultsTableName The name of the results table - * - * \param [in] NumEntries The number of entries in the - * table - * - * \param [in] DefinitionTableFileName The name of the file to load the - * definition table from - * - * \param [in] DefaultDefTableAddress The address of the default - * definition table that we may - * have to load from memory if - * the file is absent - * - * \param [in] SizeofDefinitionTableEntry The sizeof an entry in the - * definition table - * - * \param [in] SizeofResultsTableEntry The size of an enrty in the - * results table - * - * \param [in] CallBackFunction A pointer to a function used to - * validate the definition table - * - * \param [out] * DefinitionTableHandle A #CFE_TBL_Handle_t pointer that - * will get filled in with the tbl - * handle to the definition table - * - * \param [out] * ResultsTableHandle A #CFE_TBL_Handle_t pointer that - * will get filled in with the tbl - * handle to the results table - * - * \param [out] * DefinitionTblPtr A pointer to the definiton table - * that we are operating on - * - * \param [in] * ResultsTblPtr A pointer to the result table - * to operate on , it will get - * be used to access the table - * - * \return Execution status, see \ref CFEReturnCodes - * \retval #CFE_SUCCESS \copybrief CFE_SUCCESS - */ -CFE_Status_t CS_TableInit(CFE_TBL_Handle_t *DefinitionTableHandle, CFE_TBL_Handle_t *ResultsTableHandle, - void *DefinitionTblPtr, void *ResultsTblPtr, const uint16 Table, - const char *DefinitionTableName, const char *ResultsTableName, const uint16 NumEntries, - const char *DefinitionTableFileName, const void *DefaultDefTableAddress, - const uint16 SizeofDefinitionTableEntry, const uint16 SizeofResultsTableEntry, - const CFE_TBL_CallbackFuncPtr_t CallBackFunction); - -/** - * \brief Handles table updates for all CS tables - * - * \par Description - * Completes the handshake with Table Services that releases - * Addresses for the tables and checks for updates - * - * \par Assumptions, External Events, and Notes: - * None - * - * \param [in] DefinitionTblPtr A pointer to the definiton table - * that we are operating on - * - * \param [in] ResultsTblPtr A pointer to the result table - * to operate on - * \param [in] DefinitionTableHandle A table handle to the definition - * table - * - * \param [in] ResultsTableHandle A table handle to the results - * table - * - * \param [in] NumEntries The number of entries in the table - * - * \param [in] Table The specific table we are operating - * on - * - * \return Execution status, see \ref CFEReturnCodes - * \retval #CFE_SUCCESS \copybrief CFE_SUCCESS - */ -CFE_Status_t CS_HandleTableUpdate(void *DefinitionTblPtr, void *ResultsTblPtr, - const CFE_TBL_Handle_t DefinitionTableHandle, - const CFE_TBL_Handle_t ResultsTableHandle, const uint16 Table, - const uint16 NumEntries); - #endif diff --git a/fsw/src/cs_app.h b/fsw/src/cs_app.h index ed965aa..fb67768 100644 --- a/fsw/src/cs_app.h +++ b/fsw/src/cs_app.h @@ -41,6 +41,7 @@ #include "cs_perfids.h" #include "cs_verify.h" #include "cs_version.h" +#include "cs_table_processing.h" /************************************************************************** ** @@ -65,13 +66,6 @@ #define CS_CMD_PIPE_NAME_LEN 16 /**\}*/ -/** - * \name CS Name of Table Size - * \{ - */ -#define CS_TABLETYPE_NAME_SIZE 10 -/**\}*/ - /** * \name CS Child Task Names * \{ @@ -205,8 +199,6 @@ extern CS_AppData_t CS_AppData; */ void CS_AppMain(void); -#if (CS_PRESERVE_STATES_ON_PROCESSOR_RESET == true) - /** * \brief CFS Checksum (CS) Critical Data Store Update * @@ -218,8 +210,6 @@ void CS_AppMain(void); */ void CS_UpdateCDS(void); -#endif - /** * \brief Initialize the Checksum CFS application * @@ -284,7 +274,6 @@ void CS_HousekeepingCmd(const CS_NoArgsCmd_t *CmdPtr); */ void CS_ProcessCmd(const CFE_SB_Buffer_t *BufPtr); -#if (CS_PRESERVE_STATES_ON_PROCESSOR_RESET == true) /** * \brief Restore tables states from CDS if enabled * @@ -298,6 +287,5 @@ void CS_ProcessCmd(const CFE_SB_Buffer_t *BufPtr); * \retval #CFE_SUCCESS \copybrief CFE_SUCCESS */ CFE_Status_t CS_CreateRestoreStatesFromCDS(void); -#endif #endif diff --git a/fsw/src/cs_compute.c b/fsw/src/cs_compute.c index 05ea41f..dd435c8 100644 --- a/fsw/src/cs_compute.c +++ b/fsw/src/cs_compute.c @@ -434,8 +434,7 @@ CFE_Status_t CS_ComputeApp(CS_Res_App_Table_Entry_t *ResultsEntry, uint32 *Compu /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ void CS_RecomputeEepromMemoryChildTask(void) { - uint32 NewChecksumValue = 0; - char TableType[CS_TABLETYPE_NAME_SIZE]; + uint32 NewChecksumValue = 0; CS_Res_EepromMemory_Table_Entry_t *ResultsEntry = NULL; uint16 Table = 0; uint16 EntryID = 0; @@ -449,8 +448,6 @@ void CS_RecomputeEepromMemoryChildTask(void) CFE_TBL_Handle_t DefTblHandle = CFE_TBL_BAD_TABLE_HANDLE; CS_Res_Tables_Table_Entry_t * TablesTblResultEntry = NULL; - strncpy(TableType, "Undef Tbl", CS_TABLETYPE_NAME_SIZE); /* Initialize table type string */ - Table = CS_AppData.ChildTaskTable; EntryID = CS_AppData.ChildTaskEntryID; ResultsEntry = CS_AppData.RecomputeEepromMemoryEntryPtr; @@ -528,29 +525,19 @@ void CS_RecomputeEepromMemoryChildTask(void) CFE_TBL_Modified(DefTblHandle); } - /* send event message */ - - if (Table == CS_EEPROM_TABLE) - { - snprintf(TableType, CS_TABLETYPE_NAME_SIZE, "%s", "EEPROM"); - } - if (Table == CS_MEMORY_TABLE) - { - snprintf(TableType, CS_TABLETYPE_NAME_SIZE, "%s", "Memory"); - } + /* Update reported value in HK TLM, if applicable */ if (Table == CS_CFECORE) { - snprintf(TableType, CS_TABLETYPE_NAME_SIZE, "%s", "cFE Core"); CS_AppData.HkPacket.Payload.CfeCoreBaseline = NewChecksumValue; } if (Table == CS_OSCORE) { - snprintf(TableType, CS_TABLETYPE_NAME_SIZE, "%s", "OS"); CS_AppData.HkPacket.Payload.OSBaseline = NewChecksumValue; } + /* send event message */ CFE_EVS_SendEvent(CS_RECOMPUTE_FINISH_EEPROM_MEMORY_INF_EID, CFE_EVS_EventType_INFORMATION, - "%s entry %d recompute finished. New baseline is 0X%08X", TableType, EntryID, + "%s entry %d recompute finished. New baseline is 0X%08X", CS_GetTableTypeAsString(Table), EntryID, (unsigned int)NewChecksumValue); CS_AppData.HkPacket.Payload.RecomputeInProgress = false; @@ -814,7 +801,7 @@ void CS_OneShotChildTask(void) (unsigned int)(CS_AppData.HkPacket.Payload.LastOneShotChecksum)); CS_AppData.HkPacket.Payload.OneShotInProgress = false; - CS_AppData.ChildTaskID = CFE_ES_TASKID_UNDEFINED; + CS_AppData.ChildTaskID = CFE_ES_TASKID_UNDEFINED; CFE_ES_ExitChildTask(); } diff --git a/fsw/src/cs_init.c b/fsw/src/cs_init.c index de465ef..915da01 100644 --- a/fsw/src/cs_init.c +++ b/fsw/src/cs_init.c @@ -31,6 +31,7 @@ #include "cs_app_cmds.h" #include "cs_cmds.h" #include "cs_init.h" +#include "cs_table_processing.h" /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ @@ -103,11 +104,11 @@ CFE_Status_t CS_InitAllTables(void) CFE_Status_t ResultInit = CFE_SUCCESS; ResultInit = CS_TableInit(&CS_AppData.DefEepromTableHandle, &CS_AppData.ResEepromTableHandle, - (void *)&CS_AppData.DefEepromTblPtr, (void *)&CS_AppData.ResEepromTblPtr, CS_EEPROM_TABLE, - CS_DEF_EEPROM_TABLE_NAME, CS_RESULTS_EEPROM_TABLE_NAME, CS_MAX_NUM_EEPROM_TABLE_ENTRIES, - CS_DEF_EEPROM_TABLE_FILENAME, &CS_AppData.DefaultEepromDefTable, - sizeof(CS_Def_EepromMemory_Table_Entry_t), sizeof(CS_Res_EepromMemory_Table_Entry_t), - CS_ValidateEepromChecksumDefinitionTable); + (void **)&CS_AppData.DefEepromTblPtr, (void **)&CS_AppData.ResEepromTblPtr, + CS_EEPROM_TABLE, CS_DEF_EEPROM_TABLE_NAME, CS_RESULTS_EEPROM_TABLE_NAME, + CS_MAX_NUM_EEPROM_TABLE_ENTRIES, CS_DEF_EEPROM_TABLE_FILENAME, + &CS_AppData.DefaultEepromDefTable, sizeof(CS_Def_EepromMemory_Table_Entry_t), + sizeof(CS_Res_EepromMemory_Table_Entry_t), CS_ValidateEepromChecksumDefinitionTable); if (ResultInit != CFE_SUCCESS) { @@ -118,7 +119,7 @@ CFE_Status_t CS_InitAllTables(void) else { ResultInit = CS_TableInit(&CS_AppData.DefMemoryTableHandle, &CS_AppData.ResMemoryTableHandle, - (void *)&CS_AppData.DefMemoryTblPtr, (void *)&CS_AppData.ResMemoryTblPtr, + (void **)&CS_AppData.DefMemoryTblPtr, (void **)&CS_AppData.ResMemoryTblPtr, CS_MEMORY_TABLE, CS_DEF_MEMORY_TABLE_NAME, CS_RESULTS_MEMORY_TABLE_NAME, CS_MAX_NUM_MEMORY_TABLE_ENTRIES, CS_DEF_MEMORY_TABLE_FILENAME, &CS_AppData.DefaultMemoryDefTable, sizeof(CS_Def_EepromMemory_Table_Entry_t), @@ -135,8 +136,8 @@ CFE_Status_t CS_InitAllTables(void) if (ResultInit == CFE_SUCCESS) { ResultInit = CS_TableInit( - &CS_AppData.DefAppTableHandle, &CS_AppData.ResAppTableHandle, (void *)&CS_AppData.DefAppTblPtr, - (void *)&CS_AppData.ResAppTblPtr, CS_APP_TABLE, CS_DEF_APP_TABLE_NAME, CS_RESULTS_APP_TABLE_NAME, + &CS_AppData.DefAppTableHandle, &CS_AppData.ResAppTableHandle, (void **)&CS_AppData.DefAppTblPtr, + (void **)&CS_AppData.ResAppTblPtr, CS_APP_TABLE, CS_DEF_APP_TABLE_NAME, CS_RESULTS_APP_TABLE_NAME, CS_MAX_NUM_APP_TABLE_ENTRIES, CS_DEF_APP_TABLE_FILENAME, &CS_AppData.DefaultAppDefTable, sizeof(CS_Def_App_Table_Entry_t), sizeof(CS_Res_App_Table_Entry_t), CS_ValidateAppChecksumDefinitionTable); @@ -151,7 +152,7 @@ CFE_Status_t CS_InitAllTables(void) if (ResultInit == CFE_SUCCESS) { ResultInit = CS_TableInit(&CS_AppData.DefTablesTableHandle, &CS_AppData.ResTablesTableHandle, - (void *)&CS_AppData.DefTablesTblPtr, (void *)&CS_AppData.ResTablesTblPtr, + (void **)&CS_AppData.DefTablesTblPtr, (void **)&CS_AppData.ResTablesTblPtr, CS_TABLES_TABLE, CS_DEF_TABLES_TABLE_NAME, CS_RESULTS_TABLES_TABLE_NAME, CS_MAX_NUM_TABLES_TABLE_ENTRIES, CS_DEF_TABLES_TABLE_FILENAME, &CS_AppData.DefaultTablesDefTable, sizeof(CS_Def_Tables_Table_Entry_t), diff --git a/fsw/src/cs_table_processing.c b/fsw/src/cs_table_processing.c index 20b735a..aad5849 100644 --- a/fsw/src/cs_table_processing.c +++ b/fsw/src/cs_table_processing.c @@ -32,6 +32,8 @@ #include "cs_events.h" #include "cs_tbldefs.h" #include "cs_utils.h" +#include "cs_table_processing.h" + #include /************************************************************************* @@ -40,6 +42,31 @@ ** **************************************************************************/ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* */ +/* Call respective table update handler function (helper) */ +/* */ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +void CS_CallTableUpdateHandler(uint32 Table, const void *DefinitionPtr, void *ResultsPtr, size_t NumEntries) +{ + switch (Table) + { + case CS_APP_TABLE: + CS_ProcessNewAppDefinitionTable(DefinitionPtr, ResultsPtr); + break; + case CS_TABLES_TABLE: + CS_ProcessNewTablesDefinitionTable(DefinitionPtr, ResultsPtr); + break; + case CS_EEPROM_TABLE: + case CS_MEMORY_TABLE: + CS_ProcessNewEepromMemoryDefinitionTable(DefinitionPtr, ResultsPtr, NumEntries, Table); + break; + default: + /* no defined handler */ + break; + } +} + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CS Validation Callback function for EEPROM Table */ @@ -450,33 +477,25 @@ CFE_Status_t CS_ValidateAppChecksumDefinitionTable(void *TblPtr) /* CS processing new definition tables for EEPROM or Memory */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void CS_ProcessNewEepromMemoryDefinitionTable(const CS_Def_EepromMemory_Table_Entry_t *DefinitionTblPtr, - const CS_Res_EepromMemory_Table_Entry_t *ResultsTblPtr, uint16 NumEntries, +void CS_ProcessNewEepromMemoryDefinitionTable(const CS_Def_EepromMemory_Table_Entry_t *StartOfDefTable, + CS_Res_EepromMemory_Table_Entry_t *StartOfResultsTable, uint16 NumEntries, uint16 Table) { - CS_Def_EepromMemory_Table_Entry_t *StartOfDefTable = NULL; - CS_Def_EepromMemory_Table_Entry_t *DefEntry = NULL; - CS_Res_EepromMemory_Table_Entry_t *StartOfResultsTable = NULL; - CS_Res_EepromMemory_Table_Entry_t *ResultsEntry = NULL; - uint16 Loop = 0; - uint16 NumRegionsInTable = 0; - uint16 PreviousState = CS_STATE_EMPTY; - char TableType[CS_TABLETYPE_NAME_SIZE]; - - memcpy(&StartOfResultsTable, ResultsTblPtr, sizeof(StartOfResultsTable)); - memcpy(&StartOfDefTable, DefinitionTblPtr, sizeof(StartOfDefTable)); - - snprintf(&TableType[0], CS_TABLETYPE_NAME_SIZE, "%s", "Undef Tbl"); /* Init the table type string */ + const CS_Def_EepromMemory_Table_Entry_t *DefEntry = NULL; + CS_Res_EepromMemory_Table_Entry_t * ResultsEntry = NULL; + uint16 Loop = 0; + uint16 NumRegionsInTable = 0; + uint16 PreviousState = CS_STATE_EMPTY; /* We don't want to be doing chekcksums while changing the table out */ if (Table == CS_EEPROM_TABLE) { - PreviousState = CS_AppData.HkPacket.Payload.EepromCSState; + PreviousState = CS_AppData.HkPacket.Payload.EepromCSState; CS_AppData.HkPacket.Payload.EepromCSState = CS_STATE_DISABLED; } if (Table == CS_MEMORY_TABLE) { - PreviousState = CS_AppData.HkPacket.Payload.MemoryCSState; + PreviousState = CS_AppData.HkPacket.Payload.MemoryCSState; CS_AppData.HkPacket.Payload.MemoryCSState = CS_STATE_DISABLED; } @@ -526,17 +545,8 @@ void CS_ProcessNewEepromMemoryDefinitionTable(const CS_Def_EepromMemory_Table_En if (NumRegionsInTable == 0) { - if (Table == CS_EEPROM_TABLE) - { - snprintf(&TableType[0], CS_TABLETYPE_NAME_SIZE, "%s", "EEPROM"); - } - if (Table == CS_MEMORY_TABLE) - { - snprintf(&TableType[0], CS_TABLETYPE_NAME_SIZE, "%s", "Memory"); - } - CFE_EVS_SendEvent(CS_PROCESS_EEPROM_MEMORY_NO_ENTRIES_INF_EID, CFE_EVS_EventType_INFORMATION, - "CS %s Table: No valid entries in the table", TableType); + "CS %s Table: No valid entries in the table", CS_GetTableTypeAsString(Table)); } } @@ -545,34 +555,29 @@ void CS_ProcessNewEepromMemoryDefinitionTable(const CS_Def_EepromMemory_Table_En /* CS processing new definition tables for Tables */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void CS_ProcessNewTablesDefinitionTable(const CS_Def_Tables_Table_Entry_t *DefinitionTblPtr, - const CS_Res_Tables_Table_Entry_t *ResultsTblPtr) +void CS_ProcessNewTablesDefinitionTable(const CS_Def_Tables_Table_Entry_t *StartOfDefTable, + CS_Res_Tables_Table_Entry_t * StartOfResultsTable) { - CS_Def_Tables_Table_Entry_t *StartOfDefTable = NULL; - CS_Def_Tables_Table_Entry_t *DefEntry = NULL; - CS_Res_Tables_Table_Entry_t *StartOfResultsTable = NULL; - CS_Res_Tables_Table_Entry_t *ResultsEntry = NULL; - uint16 Loop = 0; - uint16 NumRegionsInTable = 0; - uint16 PreviousState = CS_STATE_EMPTY; - CFE_ES_AppId_t AppID = CFE_ES_APPID_UNDEFINED; - CFE_TBL_Handle_t TableHandle = CFE_TBL_BAD_TABLE_HANDLE; - bool Owned = false; - uint16 DefNameIndex = 0; - uint16 AppNameIndex = 0; - uint16 TableNameIndex = 0; - char AppName[OS_MAX_API_NAME]; - char TableAppName[OS_MAX_API_NAME]; - char TableTableName[CFE_MISSION_TBL_MAX_NAME_LENGTH]; - - memcpy(&StartOfResultsTable, ResultsTblPtr, sizeof(StartOfResultsTable)); - memcpy(&StartOfDefTable, DefinitionTblPtr, sizeof(StartOfDefTable)); + const CS_Def_Tables_Table_Entry_t *DefEntry = NULL; + CS_Res_Tables_Table_Entry_t * ResultsEntry = NULL; + uint16 Loop = 0; + uint16 NumRegionsInTable = 0; + uint16 PreviousState = CS_STATE_EMPTY; + CFE_ES_AppId_t AppID = CFE_ES_APPID_UNDEFINED; + CFE_TBL_Handle_t TableHandle = CFE_TBL_BAD_TABLE_HANDLE; + bool Owned = false; + uint16 DefNameIndex = 0; + uint16 AppNameIndex = 0; + uint16 TableNameIndex = 0; + char AppName[OS_MAX_API_NAME]; + char TableAppName[OS_MAX_API_NAME]; + char TableTableName[CFE_MISSION_TBL_MAX_NAME_LENGTH]; CFE_ES_GetAppID(&AppID); CFE_ES_GetAppName(AppName, AppID, OS_MAX_API_NAME); /* We don't want to be doing chekcksums while changing the table out */ - PreviousState = CS_AppData.HkPacket.Payload.TablesCSState; + PreviousState = CS_AppData.HkPacket.Payload.TablesCSState; CS_AppData.HkPacket.Payload.TablesCSState = CS_STATE_DISABLED; /* Assume none of the CS tables are listed in the new Tables table */ @@ -738,23 +743,18 @@ void CS_ProcessNewTablesDefinitionTable(const CS_Def_Tables_Table_Entry_t *Defin /* CS processing new definition tables for Apps */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void CS_ProcessNewAppDefinitionTable(const CS_Def_App_Table_Entry_t *DefinitionTblPtr, - const CS_Res_App_Table_Entry_t *ResultsTblPtr) +void CS_ProcessNewAppDefinitionTable(const CS_Def_App_Table_Entry_t *StartOfDefTable, + CS_Res_App_Table_Entry_t * StartOfResultsTable) { - CS_Def_App_Table_Entry_t *StartOfDefTable = NULL; - CS_Def_App_Table_Entry_t *DefEntry = NULL; - CS_Res_App_Table_Entry_t *StartOfResultsTable = NULL; - CS_Res_App_Table_Entry_t *ResultsEntry = NULL; - uint16 Loop = 0; - uint16 NumRegionsInTable = 0; - uint16 PreviousState = CS_STATE_EMPTY; - - memcpy(&StartOfResultsTable, ResultsTblPtr, sizeof(StartOfResultsTable)); - memcpy(&StartOfDefTable, DefinitionTblPtr, sizeof(StartOfDefTable)); + const CS_Def_App_Table_Entry_t *DefEntry = NULL; + CS_Res_App_Table_Entry_t * ResultsEntry = NULL; + uint16 Loop = 0; + uint16 NumRegionsInTable = 0; + uint16 PreviousState = CS_STATE_EMPTY; /* We don't want to be doing chekcksums while changing the table out */ - PreviousState = CS_AppData.HkPacket.Payload.AppCSState; + PreviousState = CS_AppData.HkPacket.Payload.AppCSState; CS_AppData.HkPacket.Payload.AppCSState = CS_STATE_DISABLED; for (Loop = 0; Loop < CS_MAX_NUM_APP_TABLE_ENTRIES; Loop++) @@ -811,21 +811,14 @@ void CS_ProcessNewAppDefinitionTable(const CS_Def_App_Table_Entry_t *DefinitionT /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ CFE_Status_t CS_TableInit(CFE_TBL_Handle_t *DefinitionTableHandle, CFE_TBL_Handle_t *ResultsTableHandle, - void *DefinitionTblPtr, void *ResultsTblPtr, uint16 Table, const char *DefinitionTableName, + void **DefinitionTblPtr, void **ResultsTblPtr, uint16 Table, const char *DefinitionTableName, const char *ResultsTableName, uint16 NumEntries, const char *DefinitionTableFileName, const void *DefaultDefTableAddress, uint16 SizeofDefinitionTableEntry, uint16 SizeofResultsTableEntry, CFE_TBL_CallbackFuncPtr_t CallBackFunction) { CFE_Status_t Result = CFE_SUCCESS; - int32 OS_Status = -1; - CFE_Status_t ResultFromLoad = OS_ERROR; - int32 SizeOfTable = 0; + size_t SizeOfTable = 0; bool LoadedFromMemory = false; - bool ValidFile = false; - osal_id_t Fd = OS_OBJECT_ID_UNDEFINED; - char TableType[CS_TABLETYPE_NAME_SIZE]; - - snprintf(TableType, CS_TABLETYPE_NAME_SIZE, "%s", "Undef Tbl"); /* Init table type */ SizeOfTable = NumEntries * SizeofResultsTableEntry; @@ -845,107 +838,62 @@ CFE_Status_t CS_TableInit(CFE_TBL_Handle_t *DefinitionTableHandle, CFE_TBL_Handl CFE_TBL_OPT_SNGL_BUFFER | CFE_TBL_OPT_LOAD_DUMP, CallBackFunction); } - OS_Status = OS_OpenCreate(&Fd, DefinitionTableFileName, OS_FILE_FLAG_NONE, OS_READ_ONLY); - - if (OS_Status == OS_SUCCESS) - { - ValidFile = true; - OS_close(Fd); - } - - if ((Result == CFE_SUCCESS) && (ValidFile == true)) + if (Result == CFE_SUCCESS) { - Result = CFE_TBL_Load(*DefinitionTableHandle, CFE_TBL_SRC_FILE, DefinitionTableFileName); - ResultFromLoad = Result; - } + Result = CFE_TBL_Load(*DefinitionTableHandle, CFE_TBL_SRC_FILE, DefinitionTableFileName); - /* if the load from the file fails, load from - the default tables in CS */ - if (ResultFromLoad != CFE_SUCCESS) - { - Result = CFE_TBL_Load(*DefinitionTableHandle, CFE_TBL_SRC_ADDRESS, DefaultDefTableAddress); - LoadedFromMemory = true; + /* if the load from the file fails, load from the default tables in CS */ + if (Result < CFE_SUCCESS) + { + Result = CFE_TBL_Load(*DefinitionTableHandle, CFE_TBL_SRC_ADDRESS, DefaultDefTableAddress); + LoadedFromMemory = (Result >= CFE_SUCCESS); + } } if (Result == CFE_SUCCESS) { Result = CFE_TBL_GetAddress(DefinitionTblPtr, *DefinitionTableHandle); - if ((Result == CFE_TBL_INFO_UPDATED)) + if (Result == CFE_TBL_INFO_UPDATED) { - if (Table == CS_APP_TABLE) - { - CS_ProcessNewAppDefinitionTable((CS_Def_App_Table_Entry_t *)DefinitionTblPtr, - (CS_Res_App_Table_Entry_t *)ResultsTblPtr); - } - else - { - if (Table == CS_TABLES_TABLE) - { - CS_ProcessNewTablesDefinitionTable((CS_Def_Tables_Table_Entry_t *)DefinitionTblPtr, - (CS_Res_Tables_Table_Entry_t *)ResultsTblPtr); - } - else - { - CS_ProcessNewEepromMemoryDefinitionTable((CS_Def_EepromMemory_Table_Entry_t *)DefinitionTblPtr, - (CS_Res_EepromMemory_Table_Entry_t *)ResultsTblPtr, - NumEntries, Table); - } - } - + CS_CallTableUpdateHandler(Table, *DefinitionTblPtr, *ResultsTblPtr, NumEntries); } /* end if (Result == CFE_TBL_INFO_UPDATED) || (Result == CFE_SUCCESS) */ } if (Result >= CFE_SUCCESS) { + /* If we loaded from file successfully then the states we wish to use have already been set + * If we loaded from memory then disable the table */ + if (LoadedFromMemory) + { + switch (Table) + { + case CS_EEPROM_TABLE: + CS_AppData.HkPacket.Payload.EepromCSState = CS_STATE_DISABLED; + break; + case CS_MEMORY_TABLE: + CS_AppData.HkPacket.Payload.MemoryCSState = CS_STATE_DISABLED; + break; + case CS_APP_TABLE: + CS_AppData.HkPacket.Payload.AppCSState = CS_STATE_DISABLED; + break; + case CS_TABLES_TABLE: + CS_AppData.HkPacket.Payload.TablesCSState = CS_STATE_DISABLED; + break; + default: + break; + } + } + Result = CFE_SUCCESS; } else { - if (Table == CS_EEPROM_TABLE) - { - snprintf(TableType, CS_TABLETYPE_NAME_SIZE, "%s", "EEPROM"); - } - if (Table == CS_MEMORY_TABLE) - { - snprintf(TableType, CS_TABLETYPE_NAME_SIZE, "%s", "Memory"); - } - if (Table == CS_TABLES_TABLE) - { - snprintf(TableType, CS_TABLETYPE_NAME_SIZE, "%s", "Tables"); - } - if (Table == CS_APP_TABLE) - { - snprintf(TableType, CS_TABLETYPE_NAME_SIZE, "%s", "Apps"); - } - CFE_EVS_SendEvent(CS_TBL_INIT_ERR_EID, CFE_EVS_EventType_ERROR, "CS received error 0x%08X initializing Definition table for %s", (unsigned int)Result, - TableType); + CS_GetTableTypeAsString(Table)); } - /* If we loaded from file successfully then the states we wish to use have already been set - * If we loaded from memory then disable the table */ - if (LoadedFromMemory == true && Result == CFE_SUCCESS) - { - switch (Table) - { - case CS_EEPROM_TABLE: - CS_AppData.HkPacket.Payload.EepromCSState = CS_STATE_DISABLED; - break; - case CS_MEMORY_TABLE: - CS_AppData.HkPacket.Payload.MemoryCSState = CS_STATE_DISABLED; - break; - case CS_APP_TABLE: - CS_AppData.HkPacket.Payload.AppCSState = CS_STATE_DISABLED; - break; - case CS_TABLES_TABLE: - CS_AppData.HkPacket.Payload.TablesCSState = CS_STATE_DISABLED; - break; - default: - break; - } - } return Result; } @@ -954,7 +902,7 @@ CFE_Status_t CS_TableInit(CFE_TBL_Handle_t *DefinitionTableHandle, CFE_TBL_Handl /* CS Handles table updates */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -CFE_Status_t CS_HandleTableUpdate(void *DefinitionTblPtr, void *ResultsTblPtr, CFE_TBL_Handle_t DefinitionTableHandle, +CFE_Status_t CS_HandleTableUpdate(void **DefinitionTblPtr, void **ResultsTblPtr, CFE_TBL_Handle_t DefinitionTableHandle, CFE_TBL_Handle_t ResultsTableHandle, uint16 Table, uint16 NumEntries) { CFE_Status_t ReleaseResult1 = CFE_SUCCESS; @@ -965,9 +913,6 @@ CFE_Status_t CS_HandleTableUpdate(void *DefinitionTblPtr, void *ResultsTblPtr, C CFE_Status_t GetResult2 = CFE_SUCCESS; CFE_Status_t Result = CFE_SUCCESS; int32 Loop = 0; - char TableType[CS_TABLETYPE_NAME_SIZE]; - - snprintf(TableType, CS_TABLETYPE_NAME_SIZE, "%s", "Undef Tbl"); /* Init table type */ /* Below, there are several values that are returned and assigned, but never evaluated. */ /* This is done so intentionally, as it helps us with Source-Level debugging this functions. */ @@ -1004,54 +949,22 @@ CFE_Status_t CS_HandleTableUpdate(void *DefinitionTblPtr, void *ResultsTblPtr, C } } } - - CS_ProcessNewTablesDefinitionTable((CS_Def_Tables_Table_Entry_t *)DefinitionTblPtr, - (CS_Res_Tables_Table_Entry_t *)ResultsTblPtr); - } - else - { - if (Table == CS_APP_TABLE) - { - CS_ProcessNewAppDefinitionTable((CS_Def_App_Table_Entry_t *)DefinitionTblPtr, - (CS_Res_App_Table_Entry_t *)ResultsTblPtr); - } - else - { - CS_ProcessNewEepromMemoryDefinitionTable((CS_Def_EepromMemory_Table_Entry_t *)DefinitionTblPtr, - (CS_Res_EepromMemory_Table_Entry_t *)ResultsTblPtr, NumEntries, - Table); - } } + CS_CallTableUpdateHandler(Table, *DefinitionTblPtr, *ResultsTblPtr, NumEntries); + Result = CFE_SUCCESS; } else { if (Result < CFE_SUCCESS) { - if (Table == CS_EEPROM_TABLE) - { - snprintf(TableType, CS_TABLETYPE_NAME_SIZE, "%s", "EEPROM"); - } - if (Table == CS_MEMORY_TABLE) - { - snprintf(TableType, CS_TABLETYPE_NAME_SIZE, "%s", "Memory"); - } - if (Table == CS_TABLES_TABLE) - { - snprintf(TableType, CS_TABLETYPE_NAME_SIZE, "%s", "Table"); - } - if (Table == CS_APP_TABLE) - { - snprintf(TableType, CS_TABLETYPE_NAME_SIZE, "%s", "App"); - } - /* There was a problem somewhere, generate an event */ CFE_EVS_SendEvent(CS_TBL_UPDATE_ERR_EID, CFE_EVS_EventType_ERROR, "CS had problems updating table. Res Release: 0x%08X Def Release:0x%08X Res " "Manage:0x%08X Def Manage: 0x%08X Get:0x%08X for table %s", (unsigned int)ReleaseResult1, (unsigned int)ReleaseResult2, (unsigned int)ManageResult1, - (unsigned int)ManageResult2, (unsigned int)GetResult2, TableType); + (unsigned int)ManageResult2, (unsigned int)GetResult2, CS_GetTableTypeAsString(Table)); } } return Result; diff --git a/fsw/src/cs_table_processing.h b/fsw/src/cs_table_processing.h new file mode 100644 index 0000000..2569320 --- /dev/null +++ b/fsw/src/cs_table_processing.h @@ -0,0 +1,321 @@ +/************************************************************************ + * NASA Docket No. GSC-18,915-1, and identified as “cFS Checksum + * Application version 2.5.1” + * + * Copyright (c) 2021 United States Government as represented by the + * Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ************************************************************************/ + +/** + * @file + * Specification for the CFS Checksum tables. + */ +#ifndef CS_TABLE_PROCESSING_H +#define CS_TABLE_PROCESSING_H + +/************************************************************************** + ** + ** Include section + ** + **************************************************************************/ +#include + +/************************************************************************** + ** + ** Macro definitions + ** + **************************************************************************/ + +/** + * \brief table names for definition tables + * \{ + */ +#define CS_DEF_EEPROM_TABLE_NAME "DefEepromTbl" +#define CS_DEF_MEMORY_TABLE_NAME "DefMemoryTbl" +#define CS_DEF_TABLES_TABLE_NAME "DefTablesTbl" +#define CS_DEF_APP_TABLE_NAME "DefAppTbl" +/**\}*/ + +/** + * \brief names for the results tables + * \{ + */ +#define CS_RESULTS_EEPROM_TABLE_NAME "ResEepromTbl" +#define CS_RESULTS_MEMORY_TABLE_NAME "ResMemoryTbl" +#define CS_RESULTS_TABLES_TABLE_NAME "ResTablesTbl" +#define CS_RESULTS_APP_TABLE_NAME "ResAppTbl" +/**\}*/ + +/************************************************************************** + ** + ** Function Prototypes + ** + **************************************************************************/ + +/** + * \brief Validate EEPROM definition table + * + * \par Description + * This function is a callback to cFE Table Services that gets called + * when a validation is requested. + * + * \par Assumptions, External Events, and Notes: + * None + * + * \param [in] TblPtr A pointer to the table to be validated + * + * \return Execution status see \ref CFEReturnCodes + * \retval #CFE_SUCCESS \copydoc CFE_SUCCESS + * \retval #CS_TABLE_ERROR \copydoc CS_TABLE_ERROR + */ +CFE_Status_t CS_ValidateEepromChecksumDefinitionTable(void *TblPtr); + +/** + * \brief Validate Memory definition table + * + * \par Description + * This function is a callback to cFE Table Services that gets called + * when a validation is requested. + * + * \par Assumptions, External Events, and Notes: + * None + * + * \param [in] TblPtr A pointer to the table to be validated + * + * \return Execution status see \ref CFEReturnCodes + * \retval #CFE_SUCCESS \copydoc CFE_SUCCESS + * \retval #CS_TABLE_ERROR \copydoc CS_TABLE_ERROR + */ +CFE_Status_t CS_ValidateMemoryChecksumDefinitionTable(void *TblPtr); + +/** + * \brief Validate Tables definition table + * + * \par Description + * This function is a callback to cFE Table Services that gets called + * when a validation is requested. + * + * \par Assumptions, External Events, and Notes: + * None + * + * \param [in] TblPtr A pointer to the table to be validated + * + * \return Execution status see \ref CFEReturnCodes + * \retval #CFE_SUCCESS \copydoc CFE_SUCCESS + * \retval #CS_TABLE_ERROR \copydoc CS_TABLE_ERROR + */ +CFE_Status_t CS_ValidateTablesChecksumDefinitionTable(void *TblPtr); + +/** + * \brief Validate App definition table + * + * \par Description + * This function is a callback to cFE Table Services that gets called + * when a validation is requested. + * + * \par Assumptions, External Events, and Notes: + * None + * + * \param [in] TblPtr A pointer to the table to be validated + * + * \return Execution status see \ref CFEReturnCodes + * \retval #CFE_SUCCESS \copydoc CFE_SUCCESS + * \retval #CS_TABLE_ERROR \copydoc CS_TABLE_ERROR + */ +CFE_Status_t CS_ValidateAppChecksumDefinitionTable(void *TblPtr); + +/** + * \brief Processes a new definition table for EEPROM or Memory tables + * + * \par Description + * Copies data from the definition table to the results table + * because the results table is where CS keeps all of its + * checksum data + * + * \par Assumptions, External Events, and Notes: + * None + * + * \param [in] DefinitionTblPtr A pointer to the definiton table + * (#CS_Def_EepromMemory_Table_Entry_t) + * that we are operating on + * + * \param [in] ResultsTblPtr A pointer to the result table + * (#CS_Res_EepromMemory_Table_Entry_t) + * to operate on + * \param [in] NumEntries The number of entries in the table + * \param [in] Table The specific table we are operating on + */ +void CS_ProcessNewEepromMemoryDefinitionTable(const CS_Def_EepromMemory_Table_Entry_t *DefinitionTblPtr, + CS_Res_EepromMemory_Table_Entry_t *ResultsTblPtr, uint16 NumEntries, + uint16 Table); + +/** + * \brief Processes a new definition table for the Tables table + * + * \par Description + * Copies data from the definition table to the results table + * because the results table is where CS keeps all of its + * checksum data + * + * \par Assumptions, External Events, and Notes: + * None + * + * \param [in] DefinitionTblPtr A pointer to the definiton table + * (#CS_Def_Tables_Table_Entry_t) + * that we are operating on + * + * \param [in] ResultsTblPtr A pointer to the result table + * (#CS_Res_Tables_Table_Entry_t) + * to operate on + */ +void CS_ProcessNewTablesDefinitionTable(const CS_Def_Tables_Table_Entry_t *DefinitionTblPtr, + CS_Res_Tables_Table_Entry_t * ResultsTblPtr); + +/** + * \brief Processes a new definition table for the App table + * + * \par Description + * Copies data from the definition table to the results table + * because the results table is where CS keeps all of its + * checksum data + * + * \par Assumptions, External Events, and Notes: + * None + * + * \param [in] DefinitionTblPtr A pointer to the definiton table + * (#CS_Def_App_Table_Entry_t) + * that we are operating on + * + * \param [in] ResultsTblPtr A pointer to the result table + * (#CS_Res_App_Table_Entry_t) + * to operate on + */ +void CS_ProcessNewAppDefinitionTable(const CS_Def_App_Table_Entry_t *DefinitionTblPtr, + CS_Res_App_Table_Entry_t * ResultsTblPtr); + +/** + * \brief Initializes the results and definition table on startup + * + * \par Description + * Completes the Table Services registration and table load for + * the definition table and the registration for the results table + * + * \par Assumptions, External Events, and Notes: + * This function is used on all four type of tables individally. + * Also, if the default table file is not found for the definitionm + * table, this function loads a 'blank' table from memory + * + * \param [in] DefinitionTableHandle A #CFE_TBL_Handle_t pointer + * that will get filled in with the + * table handle to the definition + * table + * + * \param [in] ResultsTableHandle A #CFE_TBL_Handle_t pointer + * that will get filled in with the + * table handle to the results + * table + * + * \param [in] DefinitionTblPtr A pointer to the definiton table + * that we are operating on, it + * will get assigned during this + * call + * + * \param [in] ResultsTblPtr A pointer to the result table + * to operate on , it will get + * assigned during this call + * + * \param [in] Table The specific table we are + * operating on + * + * \param [in] DefinitionTableName The name of the definition table + * + * \param [in] ResultsTableName The name of the results table + * + * \param [in] NumEntries The number of entries in the + * table + * + * \param [in] DefinitionTableFileName The name of the file to load the + * definition table from + * + * \param [in] DefaultDefTableAddress The address of the default + * definition table that we may + * have to load from memory if + * the file is absent + * + * \param [in] SizeofDefinitionTableEntry The sizeof an entry in the + * definition table + * + * \param [in] SizeofResultsTableEntry The size of an enrty in the + * results table + * + * \param [in] CallBackFunction A pointer to a function used to + * validate the definition table + * + * \param [out] * DefinitionTableHandle A #CFE_TBL_Handle_t pointer that + * will get filled in with the tbl + * handle to the definition table + * + * \param [out] * ResultsTableHandle A #CFE_TBL_Handle_t pointer that + * will get filled in with the tbl + * handle to the results table + * + * \param [out] * DefinitionTblPtr A pointer to the definiton table + * that we are operating on + * + * \param [in] * ResultsTblPtr A pointer to the result table + * to operate on , it will get + * be used to access the table + * + * \return Execution status, see \ref CFEReturnCodes + * \retval #CFE_SUCCESS \copybrief CFE_SUCCESS + */ +CFE_Status_t CS_TableInit(CFE_TBL_Handle_t *DefinitionTableHandle, CFE_TBL_Handle_t *ResultsTableHandle, + void **DefinitionTblPtr, void **ResultsTblPtr, uint16 Table, const char *DefinitionTableName, + const char *ResultsTableName, uint16 NumEntries, const char *DefinitionTableFileName, + const void *DefaultDefTableAddress, uint16 SizeofDefinitionTableEntry, + uint16 SizeofResultsTableEntry, CFE_TBL_CallbackFuncPtr_t CallBackFunction); + +/** + * \brief Handles table updates for all CS tables + * + * \par Description + * Completes the handshake with Table Services that releases + * Addresses for the tables and checks for updates + * + * \par Assumptions, External Events, and Notes: + * None + * + * \param [in] DefinitionTblPtr A pointer to the definiton table + * that we are operating on + * + * \param [in] ResultsTblPtr A pointer to the result table + * to operate on + * \param [in] DefinitionTableHandle A table handle to the definition + * table + * + * \param [in] ResultsTableHandle A table handle to the results + * table + * + * \param [in] NumEntries The number of entries in the table + * + * \param [in] Table The specific table we are operating + * on + * + * \return Execution status, see \ref CFEReturnCodes + * \retval #CFE_SUCCESS \copybrief CFE_SUCCESS + */ +CFE_Status_t CS_HandleTableUpdate(void **DefinitionTblPtr, void **ResultsTblPtr, CFE_TBL_Handle_t DefinitionTableHandle, + CFE_TBL_Handle_t ResultsTableHandle, uint16 Table, uint16 NumEntries); + +#endif diff --git a/fsw/src/cs_utils.c b/fsw/src/cs_utils.c index 50a3090..8646e93 100644 --- a/fsw/src/cs_utils.c +++ b/fsw/src/cs_utils.c @@ -32,6 +32,7 @@ #include "cs_events.h" #include "cs_compute.h" #include "cs_utils.h" +#include "cs_table_processing.h" #include /************************************************************************** @@ -39,6 +40,43 @@ ** Functions ** **************************************************************************/ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* */ +/* Gets a table type ID value as a printable string */ +/* */ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +const char *CS_GetTableTypeAsString(uint32 TableId) +{ + const char *TableTypeStr; + + switch (TableId) + { + case CS_APP_TABLE: + TableTypeStr = "Apps"; + break; + case CS_TABLES_TABLE: + TableTypeStr = "Tables"; + break; + case CS_EEPROM_TABLE: + TableTypeStr = "EEPROM"; + break; + case CS_MEMORY_TABLE: + TableTypeStr = "Memory"; + break; + case CS_CFECORE: + TableTypeStr = "cFE Core"; + break; + case CS_OSCORE: + TableTypeStr = "OS"; + break; + default: + TableTypeStr = "Undef"; + break; + } + + return TableTypeStr; +} + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CS Zero out the temp chcksum values of EEPROM */ @@ -922,33 +960,33 @@ CFE_Status_t CS_HandleRoutineTableUpdates(void) CFE_Status_t Result = CFE_SUCCESS; CFE_Status_t ErrorCode = CFE_SUCCESS; - if (!((CS_AppData.HkPacket.Payload.RecomputeInProgress == true) && (CS_AppData.HkPacket.Payload.OneShotInProgress == false) && - (CS_AppData.ChildTaskTable == CS_EEPROM_TABLE))) + if (!((CS_AppData.HkPacket.Payload.RecomputeInProgress == true) && + (CS_AppData.HkPacket.Payload.OneShotInProgress == false) && (CS_AppData.ChildTaskTable == CS_EEPROM_TABLE))) { - Result = CS_HandleTableUpdate((void *)&CS_AppData.DefEepromTblPtr, (void *)&CS_AppData.ResEepromTblPtr, + Result = CS_HandleTableUpdate((void **)&CS_AppData.DefEepromTblPtr, (void **)&CS_AppData.ResEepromTblPtr, CS_AppData.DefEepromTableHandle, CS_AppData.ResEepromTableHandle, CS_EEPROM_TABLE, CS_MAX_NUM_EEPROM_TABLE_ENTRIES); if (Result != CFE_SUCCESS) { CS_AppData.HkPacket.Payload.EepromCSState = CS_STATE_DISABLED; - Result = CFE_EVS_SendEvent(CS_UPDATE_EEPROM_ERR_EID, CFE_EVS_EventType_ERROR, + Result = CFE_EVS_SendEvent(CS_UPDATE_EEPROM_ERR_EID, CFE_EVS_EventType_ERROR, "Table update failed for EEPROM: 0x%08X, checksumming EEPROM is disabled", (unsigned int)Result); - ErrorCode = Result; + ErrorCode = Result; } } - if (!((CS_AppData.HkPacket.Payload.RecomputeInProgress == true) && (CS_AppData.HkPacket.Payload.OneShotInProgress == false) && - (CS_AppData.ChildTaskTable == CS_MEMORY_TABLE))) + if (!((CS_AppData.HkPacket.Payload.RecomputeInProgress == true) && + (CS_AppData.HkPacket.Payload.OneShotInProgress == false) && (CS_AppData.ChildTaskTable == CS_MEMORY_TABLE))) { - Result = CS_HandleTableUpdate((void *)&CS_AppData.DefMemoryTblPtr, (void *)&CS_AppData.ResMemoryTblPtr, + Result = CS_HandleTableUpdate((void **)&CS_AppData.DefMemoryTblPtr, (void **)&CS_AppData.ResMemoryTblPtr, CS_AppData.DefMemoryTableHandle, CS_AppData.ResMemoryTableHandle, CS_MEMORY_TABLE, CS_MAX_NUM_MEMORY_TABLE_ENTRIES); if (Result != CFE_SUCCESS) { CS_AppData.HkPacket.Payload.MemoryCSState = CS_STATE_DISABLED; - Result = CFE_EVS_SendEvent(CS_UPDATE_MEMORY_ERR_EID, CFE_EVS_EventType_ERROR, + Result = CFE_EVS_SendEvent(CS_UPDATE_MEMORY_ERR_EID, CFE_EVS_EventType_ERROR, "Table update failed for Memory: 0x%08X, checksumming Memory is disabled", (unsigned int)Result); @@ -959,16 +997,16 @@ CFE_Status_t CS_HandleRoutineTableUpdates(void) } } - if (!((CS_AppData.HkPacket.Payload.RecomputeInProgress == true) && (CS_AppData.HkPacket.Payload.OneShotInProgress == false) && - (CS_AppData.ChildTaskTable == CS_APP_TABLE))) + if (!((CS_AppData.HkPacket.Payload.RecomputeInProgress == true) && + (CS_AppData.HkPacket.Payload.OneShotInProgress == false) && (CS_AppData.ChildTaskTable == CS_APP_TABLE))) { - Result = CS_HandleTableUpdate((void *)&CS_AppData.DefAppTblPtr, (void *)&CS_AppData.ResAppTblPtr, + Result = CS_HandleTableUpdate((void **)&CS_AppData.DefAppTblPtr, (void **)&CS_AppData.ResAppTblPtr, CS_AppData.DefAppTableHandle, CS_AppData.ResAppTableHandle, CS_APP_TABLE, CS_MAX_NUM_APP_TABLE_ENTRIES); if (Result != CFE_SUCCESS) { CS_AppData.HkPacket.Payload.AppCSState = CS_STATE_DISABLED; - Result = CFE_EVS_SendEvent(CS_UPDATE_APP_ERR_EID, CFE_EVS_EventType_ERROR, + Result = CFE_EVS_SendEvent(CS_UPDATE_APP_ERR_EID, CFE_EVS_EventType_ERROR, "Table update failed for Apps: 0x%08X, checksumming Apps is disabled", (unsigned int)Result); if (ErrorCode == CFE_SUCCESS) @@ -978,17 +1016,17 @@ CFE_Status_t CS_HandleRoutineTableUpdates(void) } } - if (!((CS_AppData.HkPacket.Payload.RecomputeInProgress == true) && (CS_AppData.HkPacket.Payload.OneShotInProgress == false) && - (CS_AppData.ChildTaskTable == CS_TABLES_TABLE))) + if (!((CS_AppData.HkPacket.Payload.RecomputeInProgress == true) && + (CS_AppData.HkPacket.Payload.OneShotInProgress == false) && (CS_AppData.ChildTaskTable == CS_TABLES_TABLE))) { - Result = CS_HandleTableUpdate((void *)&CS_AppData.DefTablesTblPtr, (void *)&CS_AppData.ResTablesTblPtr, + Result = CS_HandleTableUpdate((void **)&CS_AppData.DefTablesTblPtr, (void **)&CS_AppData.ResTablesTblPtr, CS_AppData.DefTablesTableHandle, CS_AppData.ResTablesTableHandle, CS_TABLES_TABLE, CS_MAX_NUM_TABLES_TABLE_ENTRIES); if (Result != CFE_SUCCESS) { CS_AppData.HkPacket.Payload.TablesCSState = CS_STATE_DISABLED; - Result = CFE_EVS_SendEvent(CS_UPDATE_TABLES_ERR_EID, CFE_EVS_EventType_ERROR, + Result = CFE_EVS_SendEvent(CS_UPDATE_TABLES_ERR_EID, CFE_EVS_EventType_ERROR, "Table update failed for Tables: 0x%08X, checksumming Tables is disabled", (unsigned int)Result); if (ErrorCode == CFE_SUCCESS) @@ -1033,7 +1071,8 @@ bool CS_CheckRecomputeOneshot(void) { bool Result = false; - if (CS_AppData.HkPacket.Payload.RecomputeInProgress == true || CS_AppData.HkPacket.Payload.OneShotInProgress == true) + if (CS_AppData.HkPacket.Payload.RecomputeInProgress == true || + CS_AppData.HkPacket.Payload.OneShotInProgress == true) { CFE_EVS_SendEvent(CS_CMD_COMPUTE_PROG_ERR_EID, CFE_EVS_EventType_ERROR, "Cannot perform command. Recompute or oneshot in progress."); diff --git a/fsw/src/cs_utils.h b/fsw/src/cs_utils.h index f62e34d..5c0aa61 100644 --- a/fsw/src/cs_utils.h +++ b/fsw/src/cs_utils.h @@ -32,6 +32,15 @@ #include "cfe.h" #include "cs_tbldefs.h" +/** + * \brief Converts the numeric table ID to a string for logging + * + * \param [in] TableId Numeric identifier of table + * + * \return Pointer to printable string (never NULL) + */ +const char *CS_GetTableTypeAsString(uint32 TableId); + /** * \brief Zeros out temporary checksum values of EEPROM table entries * diff --git a/unit-test/CMakeLists.txt b/unit-test/CMakeLists.txt index 4593791..a51d3fa 100644 --- a/unit-test/CMakeLists.txt +++ b/unit-test/CMakeLists.txt @@ -9,6 +9,7 @@ add_cfe_coverage_stubs("cs_internal" utilities/cs_test_utils.c + stubs/cs_appdata_global_stub.c stubs/cs_utils_stubs.c stubs/cs_compute_stubs.c stubs/cs_table_processing_stubs.c @@ -34,13 +35,13 @@ target_include_directories(coverage-cs_internal-stubs PUBLIC ../fsw/src) # a *_tests file for each foreach(SRCFILE ${APP_SRC_FILES}) - # Get the base sourcefile name as a module name without path or the + # Get the base sourcefile name as a module name without path or the # extension, this will be used as the base name of the unit test file. get_filename_component(UNIT_NAME "${SRCFILE}" NAME_WE) # Use the module name to make the test name by adding _tests to the end set(TESTS_NAME "${UNIT_NAME}_tests") - + # Make the test sourcefile name with unit test path and extension set(TESTS_SOURCE_FILE "${PROJECT_SOURCE_DIR}/unit-test/${TESTS_NAME}.c") @@ -49,5 +50,5 @@ foreach(SRCFILE ${APP_SRC_FILES}) # Add dependency to utilities and internal stubs add_cfe_coverage_dependency(cs "${UNIT_NAME}" cs_internal) - + endforeach() diff --git a/unit-test/cs_table_processing_tests.c b/unit-test/cs_table_processing_tests.c index 1d7df7f..3d1a3fa 100644 --- a/unit-test/cs_table_processing_tests.c +++ b/unit-test/cs_table_processing_tests.c @@ -1408,18 +1408,13 @@ void CS_ProcessNewEepromMemoryDefinitionTable_Test_EEPROMTableNominal(void) uint16 NumEntries = 1; uint16 Table = CS_EEPROM_TABLE; - CS_AppData.HkPacket.Payload.EepromCSState = 99; + CS_AppData.HkPacket.Payload.EepromCSState = 99; CS_AppData.DefEepromTblPtr[0].State = 1; CS_AppData.DefEepromTblPtr[0].NumBytesToChecksum = 2; CS_AppData.DefEepromTblPtr[0].StartAddress = 3; /* Execute the function being tested */ - /* Note: first 2 arguments are passed in as addresses of pointers in the source code, even though the variable - types of the arguments are just pointers and the variable names of the arguments suggest that they're just - pointers */ - CS_ProcessNewEepromMemoryDefinitionTable((CS_Def_EepromMemory_Table_Entry_t *)&CS_AppData.DefEepromTblPtr, - (CS_Res_EepromMemory_Table_Entry_t *)&CS_AppData.ResEepromTblPtr, - NumEntries, Table); + CS_ProcessNewEepromMemoryDefinitionTable(CS_AppData.DefEepromTblPtr, CS_AppData.ResEepromTblPtr, NumEntries, Table); /* Verify results */ UtAssert_True(CS_AppData.HkPacket.Payload.EepromCSState == 99, "CS_AppData.HkPacket.Payload.EepromCSState == 99"); @@ -1462,18 +1457,13 @@ void CS_ProcessNewEepromMemoryDefinitionTable_Test_MemoryTableNominal(void) uint16 NumEntries = 1; uint16 Table = CS_MEMORY_TABLE; - CS_AppData.HkPacket.Payload.MemoryCSState = 99; + CS_AppData.HkPacket.Payload.MemoryCSState = 99; CS_AppData.DefMemoryTblPtr[0].State = 1; CS_AppData.DefMemoryTblPtr[0].NumBytesToChecksum = 2; CS_AppData.DefMemoryTblPtr[0].StartAddress = 3; /* Execute the function being tested */ - /* Note: first 2 arguments are passed in as addresses of pointers in the source code, even though the variable - types of the arguments are just pointers and the variable names of the arguments suggest that they're just - pointers */ - CS_ProcessNewEepromMemoryDefinitionTable((CS_Def_EepromMemory_Table_Entry_t *)&CS_AppData.DefMemoryTblPtr, - (CS_Res_EepromMemory_Table_Entry_t *)&CS_AppData.ResMemoryTblPtr, - NumEntries, Table); + CS_ProcessNewEepromMemoryDefinitionTable(CS_AppData.DefMemoryTblPtr, CS_AppData.ResMemoryTblPtr, NumEntries, Table); /* Verify results */ UtAssert_True(CS_AppData.HkPacket.Payload.MemoryCSState == 99, "CS_AppData.HkPacket.Payload.MemoryCSState == 99"); @@ -1524,12 +1514,7 @@ void CS_ProcessNewEepromMemoryDefinitionTable_Test_EEPROMTableNoValidEntries(voi CS_AppData.HkPacket.Payload.MemoryCSState = 99; /* Execute the function being tested */ - /* Note: first 2 arguments are passed in as addresses of pointers in the source code, even though the variable - types of the arguments are just pointers and the variable names of the arguments suggest that they're just - pointers */ - CS_ProcessNewEepromMemoryDefinitionTable((CS_Def_EepromMemory_Table_Entry_t *)&CS_AppData.DefMemoryTblPtr, - (CS_Res_EepromMemory_Table_Entry_t *)&CS_AppData.ResMemoryTblPtr, - NumEntries, Table); + CS_ProcessNewEepromMemoryDefinitionTable(CS_AppData.DefMemoryTblPtr, CS_AppData.ResMemoryTblPtr, NumEntries, Table); /* Verify results */ UtAssert_True(CS_AppData.HkPacket.Payload.MemoryCSState == 99, "CS_AppData.HkPacket.Payload.MemoryCSState == 99"); @@ -1562,12 +1547,7 @@ void CS_ProcessNewEepromMemoryDefinitionTable_Test_MemoryTableNoValidEntries(voi CS_AppData.HkPacket.Payload.MemoryCSState = 99; /* Execute the function being tested */ - /* Note: first 2 arguments are passed in as addresses of pointers in the source code, even though the variable - types of the arguments are just pointers and the variable names of the arguments suggest that they're just - pointers */ - CS_ProcessNewEepromMemoryDefinitionTable((CS_Def_EepromMemory_Table_Entry_t *)&CS_AppData.DefMemoryTblPtr, - (CS_Res_EepromMemory_Table_Entry_t *)&CS_AppData.ResMemoryTblPtr, - NumEntries, Table); + CS_ProcessNewEepromMemoryDefinitionTable(CS_AppData.DefMemoryTblPtr, CS_AppData.ResMemoryTblPtr, NumEntries, Table); /* Verify results */ UtAssert_True(CS_AppData.HkPacket.Payload.MemoryCSState == 99, "CS_AppData.HkPacket.Payload.MemoryCSState == 99"); @@ -1587,8 +1567,8 @@ void CS_ProcessNewEepromMemoryDefinitionTable_Test_MemoryTableNoValidEntries(voi void CS_ProcessNewTablesDefinitionTable_Test_DefEepromTableHandle(void) { - CS_AppData.HkPacket.Payload.TablesCSState = 99; - CS_AppData.DefTablesTblPtr[0].State = 88; + CS_AppData.HkPacket.Payload.TablesCSState = 99; + CS_AppData.DefTablesTblPtr[0].State = 88; strncpy(CS_AppData.DefTablesTblPtr[0].Name, "CS.DefEepromTbl", 20); @@ -1598,11 +1578,7 @@ void CS_ProcessNewTablesDefinitionTable_Test_DefEepromTableHandle(void) UT_SetHandlerFunction(UT_KEY(CFE_ES_GetAppName), CS_TABLE_PROCESSING_TEST_CFE_ES_GetAppNameHandler1, NULL); /* Execute the function being tested */ - /* Note: first 2 arguments are passed in as addresses of pointers in the source code, even though the variable - types of the arguments are just pointers and the variable names of the arguments suggest that they're just - pointers */ - CS_ProcessNewTablesDefinitionTable((CS_Def_Tables_Table_Entry_t *)&CS_AppData.DefTablesTblPtr, - (CS_Res_Tables_Table_Entry_t *)&CS_AppData.ResTablesTblPtr); + CS_ProcessNewTablesDefinitionTable(CS_AppData.DefTablesTblPtr, CS_AppData.ResTablesTblPtr); /* Verify results */ UtAssert_True(CS_AppData.MemResTablesTblPtr == NULL, "CS_AppData.MemResTablesTblPtr == NULL"); @@ -1639,8 +1615,8 @@ void CS_ProcessNewTablesDefinitionTable_Test_DefEepromTableHandle(void) void CS_ProcessNewTablesDefinitionTable_Test_DefMemoryTableHandle(void) { - CS_AppData.HkPacket.Payload.TablesCSState = 99; - CS_AppData.DefTablesTblPtr[0].State = 88; + CS_AppData.HkPacket.Payload.TablesCSState = 99; + CS_AppData.DefTablesTblPtr[0].State = 88; strncpy(CS_AppData.DefTablesTblPtr[0].Name, "CS.DefMemoryTbl", 20); @@ -1650,11 +1626,7 @@ void CS_ProcessNewTablesDefinitionTable_Test_DefMemoryTableHandle(void) UT_SetHandlerFunction(UT_KEY(CFE_ES_GetAppName), CS_TABLE_PROCESSING_TEST_CFE_ES_GetAppNameHandler1, NULL); /* Execute the function being tested */ - /* Note: first 2 arguments are passed in as addresses of pointers in the source code, even though the variable - types of the arguments are just pointers and the variable names of the arguments suggest that they're just - pointers */ - CS_ProcessNewTablesDefinitionTable((CS_Def_Tables_Table_Entry_t *)&CS_AppData.DefTablesTblPtr, - (CS_Res_Tables_Table_Entry_t *)&CS_AppData.ResTablesTblPtr); + CS_ProcessNewTablesDefinitionTable(CS_AppData.DefTablesTblPtr, CS_AppData.ResTablesTblPtr); /* Verify results */ UtAssert_True(CS_AppData.EepResTablesTblPtr == NULL, "CS_AppData.EepResTablesTblPtr == NULL"); @@ -1691,8 +1663,8 @@ void CS_ProcessNewTablesDefinitionTable_Test_DefMemoryTableHandle(void) void CS_ProcessNewTablesDefinitionTable_Test_DefTablesTableHandle(void) { - CS_AppData.HkPacket.Payload.TablesCSState = 99; - CS_AppData.DefTablesTblPtr[0].State = 88; + CS_AppData.HkPacket.Payload.TablesCSState = 99; + CS_AppData.DefTablesTblPtr[0].State = 88; strncpy(CS_AppData.DefTablesTblPtr[0].Name, "CS.DefTablesTbl", 20); @@ -1702,11 +1674,7 @@ void CS_ProcessNewTablesDefinitionTable_Test_DefTablesTableHandle(void) UT_SetHandlerFunction(UT_KEY(CFE_ES_GetAppName), CS_TABLE_PROCESSING_TEST_CFE_ES_GetAppNameHandler1, NULL); /* Execute the function being tested */ - /* Note: first 2 arguments are passed in as addresses of pointers in the source code, even though the variable - types of the arguments are just pointers and the variable names of the arguments suggest that they're just - pointers */ - CS_ProcessNewTablesDefinitionTable((CS_Def_Tables_Table_Entry_t *)&CS_AppData.DefTablesTblPtr, - (CS_Res_Tables_Table_Entry_t *)&CS_AppData.ResTablesTblPtr); + CS_ProcessNewTablesDefinitionTable(CS_AppData.DefTablesTblPtr, CS_AppData.ResTablesTblPtr); /* Verify results */ UtAssert_True(CS_AppData.EepResTablesTblPtr == NULL, "CS_AppData.EepResTablesTblPtr == NULL"); @@ -1743,8 +1711,8 @@ void CS_ProcessNewTablesDefinitionTable_Test_DefTablesTableHandle(void) void CS_ProcessNewTablesDefinitionTable_Test_DefAppTableHandle(void) { - CS_AppData.HkPacket.Payload.TablesCSState = 99; - CS_AppData.DefTablesTblPtr[0].State = 88; + CS_AppData.HkPacket.Payload.TablesCSState = 99; + CS_AppData.DefTablesTblPtr[0].State = 88; strncpy(CS_AppData.DefTablesTblPtr[0].Name, "CS.DefAppTbl", 20); @@ -1754,11 +1722,7 @@ void CS_ProcessNewTablesDefinitionTable_Test_DefAppTableHandle(void) UT_SetHandlerFunction(UT_KEY(CFE_ES_GetAppName), CS_TABLE_PROCESSING_TEST_CFE_ES_GetAppNameHandler1, NULL); /* Execute the function being tested */ - /* Note: first 2 arguments are passed in as addresses of pointers in the source code, even though the variable - types of the arguments are just pointers and the variable names of the arguments suggest that they're just - pointers */ - CS_ProcessNewTablesDefinitionTable((CS_Def_Tables_Table_Entry_t *)&CS_AppData.DefTablesTblPtr, - (CS_Res_Tables_Table_Entry_t *)&CS_AppData.ResTablesTblPtr); + CS_ProcessNewTablesDefinitionTable(CS_AppData.DefTablesTblPtr, CS_AppData.ResTablesTblPtr); /* Verify results */ UtAssert_True(CS_AppData.EepResTablesTblPtr == NULL, "CS_AppData.EepResTablesTblPtr == NULL"); @@ -1795,8 +1759,8 @@ void CS_ProcessNewTablesDefinitionTable_Test_DefAppTableHandle(void) void CS_ProcessNewTablesDefinitionTable_Test_ResEepromTableHandle(void) { - CS_AppData.HkPacket.Payload.TablesCSState = 99; - CS_AppData.DefTablesTblPtr[0].State = 88; + CS_AppData.HkPacket.Payload.TablesCSState = 99; + CS_AppData.DefTablesTblPtr[0].State = 88; strncpy(CS_AppData.DefTablesTblPtr[0].Name, "CS.ResEepromTbl", 20); @@ -1806,11 +1770,7 @@ void CS_ProcessNewTablesDefinitionTable_Test_ResEepromTableHandle(void) UT_SetHandlerFunction(UT_KEY(CFE_ES_GetAppName), CS_TABLE_PROCESSING_TEST_CFE_ES_GetAppNameHandler1, NULL); /* Execute the function being tested */ - /* Note: first 2 arguments are passed in as addresses of pointers in the source code, even though the variable - types of the arguments are just pointers and the variable names of the arguments suggest that they're just - pointers */ - CS_ProcessNewTablesDefinitionTable((CS_Def_Tables_Table_Entry_t *)&CS_AppData.DefTablesTblPtr, - (CS_Res_Tables_Table_Entry_t *)&CS_AppData.ResTablesTblPtr); + CS_ProcessNewTablesDefinitionTable(CS_AppData.DefTablesTblPtr, CS_AppData.ResTablesTblPtr); /* Verify results */ UtAssert_True(CS_AppData.EepResTablesTblPtr == NULL, "CS_AppData.EepResTablesTblPtr == NULL"); @@ -1845,8 +1805,8 @@ void CS_ProcessNewTablesDefinitionTable_Test_ResEepromTableHandle(void) void CS_ProcessNewTablesDefinitionTable_Test_ResMemoryTableHandle(void) { - CS_AppData.HkPacket.Payload.TablesCSState = 99; - CS_AppData.DefTablesTblPtr[0].State = 88; + CS_AppData.HkPacket.Payload.TablesCSState = 99; + CS_AppData.DefTablesTblPtr[0].State = 88; strncpy(CS_AppData.DefTablesTblPtr[0].Name, "CS.ResMemoryTbl", 20); @@ -1856,11 +1816,7 @@ void CS_ProcessNewTablesDefinitionTable_Test_ResMemoryTableHandle(void) UT_SetHandlerFunction(UT_KEY(CFE_ES_GetAppName), CS_TABLE_PROCESSING_TEST_CFE_ES_GetAppNameHandler1, NULL); /* Execute the function being tested */ - /* Note: first 2 arguments are passed in as addresses of pointers in the source code, even though the variable - types of the arguments are just pointers and the variable names of the arguments suggest that they're just - pointers */ - CS_ProcessNewTablesDefinitionTable((CS_Def_Tables_Table_Entry_t *)&CS_AppData.DefTablesTblPtr, - (CS_Res_Tables_Table_Entry_t *)&CS_AppData.ResTablesTblPtr); + CS_ProcessNewTablesDefinitionTable(CS_AppData.DefTablesTblPtr, CS_AppData.ResTablesTblPtr); /* Verify results */ UtAssert_True(CS_AppData.EepResTablesTblPtr == NULL, "CS_AppData.EepResTablesTblPtr == NULL"); @@ -1895,8 +1851,8 @@ void CS_ProcessNewTablesDefinitionTable_Test_ResMemoryTableHandle(void) void CS_ProcessNewTablesDefinitionTable_Test_ResTablesTableHandle(void) { - CS_AppData.HkPacket.Payload.TablesCSState = 99; - CS_AppData.DefTablesTblPtr[0].State = 88; + CS_AppData.HkPacket.Payload.TablesCSState = 99; + CS_AppData.DefTablesTblPtr[0].State = 88; strncpy(CS_AppData.DefTablesTblPtr[0].Name, "CS.ResTablesTbl", 20); @@ -1906,11 +1862,7 @@ void CS_ProcessNewTablesDefinitionTable_Test_ResTablesTableHandle(void) UT_SetHandlerFunction(UT_KEY(CFE_ES_GetAppName), CS_TABLE_PROCESSING_TEST_CFE_ES_GetAppNameHandler1, NULL); /* Execute the function being tested */ - /* Note: first 2 arguments are passed in as addresses of pointers in the source code, even though the variable - types of the arguments are just pointers and the variable names of the arguments suggest that they're just - pointers */ - CS_ProcessNewTablesDefinitionTable((CS_Def_Tables_Table_Entry_t *)&CS_AppData.DefTablesTblPtr, - (CS_Res_Tables_Table_Entry_t *)&CS_AppData.ResTablesTblPtr); + CS_ProcessNewTablesDefinitionTable(CS_AppData.DefTablesTblPtr, CS_AppData.ResTablesTblPtr); /* Verify results */ UtAssert_True(CS_AppData.EepResTablesTblPtr == NULL, "CS_AppData.EepResTablesTblPtr == NULL"); @@ -1945,8 +1897,8 @@ void CS_ProcessNewTablesDefinitionTable_Test_ResTablesTableHandle(void) void CS_ProcessNewTablesDefinitionTable_Test_ResAppTableHandle(void) { - CS_AppData.HkPacket.Payload.TablesCSState = 99; - CS_AppData.DefTablesTblPtr[0].State = 88; + CS_AppData.HkPacket.Payload.TablesCSState = 99; + CS_AppData.DefTablesTblPtr[0].State = 88; strncpy(CS_AppData.DefTablesTblPtr[0].Name, "CS.ResAppTbl", 20); @@ -1956,11 +1908,7 @@ void CS_ProcessNewTablesDefinitionTable_Test_ResAppTableHandle(void) UT_SetHandlerFunction(UT_KEY(CFE_ES_GetAppName), CS_TABLE_PROCESSING_TEST_CFE_ES_GetAppNameHandler1, NULL); /* Execute the function being tested */ - /* Note: first 2 arguments are passed in as addresses of pointers in the source code, even though the variable - types of the arguments are just pointers and the variable names of the arguments suggest that they're just - pointers */ - CS_ProcessNewTablesDefinitionTable((CS_Def_Tables_Table_Entry_t *)&CS_AppData.DefTablesTblPtr, - (CS_Res_Tables_Table_Entry_t *)&CS_AppData.ResTablesTblPtr); + CS_ProcessNewTablesDefinitionTable(CS_AppData.DefTablesTblPtr, CS_AppData.ResTablesTblPtr); /* Verify results */ UtAssert_True(CS_AppData.EepResTablesTblPtr == NULL, "CS_AppData.EepResTablesTblPtr == NULL"); @@ -2000,18 +1948,14 @@ void CS_ProcessNewTablesDefinitionTable_Test_StateEmptyNoValidEntries(void) snprintf(ExpectedEventString, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH, "CS Tables Table: No valid entries in the table"); - CS_AppData.HkPacket.Payload.TablesCSState = 99; - CS_AppData.DefTablesTblPtr[0].State = CS_STATE_EMPTY; + CS_AppData.HkPacket.Payload.TablesCSState = 99; + CS_AppData.DefTablesTblPtr[0].State = CS_STATE_EMPTY; /* Sets AppName to "CS" */ UT_SetHandlerFunction(UT_KEY(CFE_ES_GetAppName), CS_TABLE_PROCESSING_TEST_CFE_ES_GetAppNameHandler1, NULL); /* Execute the function being tested */ - /* Note: first 2 arguments are passed in as addresses of pointers in the source code, even though the variable - types of the arguments are just pointers and the variable names of the arguments suggest that they're just - pointers */ - CS_ProcessNewTablesDefinitionTable((CS_Def_Tables_Table_Entry_t *)&CS_AppData.DefTablesTblPtr, - (CS_Res_Tables_Table_Entry_t *)&CS_AppData.ResTablesTblPtr); + CS_ProcessNewTablesDefinitionTable(CS_AppData.DefTablesTblPtr, CS_AppData.ResTablesTblPtr); /* Verify results */ UtAssert_True(CS_AppData.EepResTablesTblPtr == NULL, "CS_AppData.EepResTablesTblPtr == NULL"); @@ -2057,8 +2001,8 @@ void CS_ProcessNewTablesDefinitionTable_Test_LimitApplicationNameLength(void) uint16 i; const char AppNameX[] = "X"; - CS_AppData.HkPacket.Payload.TablesCSState = 99; - CS_AppData.DefTablesTblPtr[0].State = 88; + CS_AppData.HkPacket.Payload.TablesCSState = 99; + CS_AppData.DefTablesTblPtr[0].State = 88; /* String name chosen to be of length OS_MAX_API_NAME in order to satisfy condition "AppNameIndex == * OS_MAX_API_NAME" */ @@ -2076,11 +2020,7 @@ void CS_ProcessNewTablesDefinitionTable_Test_LimitApplicationNameLength(void) UT_SetDataBuffer(UT_KEY(CFE_ES_GetAppName), (uint8 *)AppNameX, sizeof(AppNameX), false); /* Execute the function being tested */ - /* Note: first 2 arguments are passed in as addresses of pointers in the source code, even though the variable - types of the arguments are just pointers and the variable names of the arguments suggest that they're just - pointers */ - CS_ProcessNewTablesDefinitionTable((CS_Def_Tables_Table_Entry_t *)&CS_AppData.DefTablesTblPtr, - (CS_Res_Tables_Table_Entry_t *)&CS_AppData.ResTablesTblPtr); + CS_ProcessNewTablesDefinitionTable(CS_AppData.DefTablesTblPtr, CS_AppData.ResTablesTblPtr); /* Verify results */ /* Note: This test is a special case where we're only interested in seeing that one branch was taken: "if @@ -2100,8 +2040,8 @@ void CS_ProcessNewTablesDefinitionTable_Test_LimitTableNameLength(void) { uint16 i; - CS_AppData.HkPacket.Payload.TablesCSState = 99; - CS_AppData.DefTablesTblPtr[0].State = 88; + CS_AppData.HkPacket.Payload.TablesCSState = 99; + CS_AppData.DefTablesTblPtr[0].State = 88; strncat(CS_AppData.DefTablesTblPtr[0].Name, "CS.", CFE_TBL_MAX_FULL_NAME_LEN); @@ -2119,11 +2059,7 @@ void CS_ProcessNewTablesDefinitionTable_Test_LimitTableNameLength(void) UT_SetHandlerFunction(UT_KEY(CFE_ES_GetAppName), CS_TABLE_PROCESSING_TEST_CFE_ES_GetAppNameHandler1, NULL); /* Execute the function being tested */ - /* Note: first 2 arguments are passed in as addresses of pointers in the source code, even though the variable - types of the arguments are just pointers and the variable names of the arguments suggest that they're just - pointers */ - CS_ProcessNewTablesDefinitionTable((CS_Def_Tables_Table_Entry_t *)&CS_AppData.DefTablesTblPtr, - (CS_Res_Tables_Table_Entry_t *)&CS_AppData.ResTablesTblPtr); + CS_ProcessNewTablesDefinitionTable(CS_AppData.DefTablesTblPtr, CS_AppData.ResTablesTblPtr); /* Verify results */ /* Note: This test is a special case where we're only interested in seeing that one branch was taken: "if @@ -2143,8 +2079,8 @@ void CS_ProcessNewTablesDefinitionTable_Test_MaxTableNameLength(void) { uint16 i; - CS_AppData.HkPacket.Payload.TablesCSState = 99; - CS_AppData.DefTablesTblPtr[0].State = 88; + CS_AppData.HkPacket.Payload.TablesCSState = 99; + CS_AppData.DefTablesTblPtr[0].State = 88; strncat(CS_AppData.DefTablesTblPtr[0].Name, "CS", CFE_TBL_MAX_FULL_NAME_LEN); @@ -2162,11 +2098,7 @@ void CS_ProcessNewTablesDefinitionTable_Test_MaxTableNameLength(void) UT_SetHandlerFunction(UT_KEY(CFE_ES_GetAppName), CS_TABLE_PROCESSING_TEST_CFE_ES_GetAppNameHandler1, NULL); /* Execute the function being tested */ - /* Note: first 2 arguments are passed in as addresses of pointers in the source code, even though the variable - types of the arguments are just pointers and the variable names of the arguments suggest that they're just - pointers */ - CS_ProcessNewTablesDefinitionTable((CS_Def_Tables_Table_Entry_t *)&CS_AppData.DefTablesTblPtr, - (CS_Res_Tables_Table_Entry_t *)&CS_AppData.ResTablesTblPtr); + CS_ProcessNewTablesDefinitionTable(CS_AppData.DefTablesTblPtr, CS_AppData.ResTablesTblPtr); /* Verify results */ /* Note: This test is a special case where we're only interested in seeing that one branch was taken: "if @@ -2184,17 +2116,13 @@ void CS_ProcessNewTablesDefinitionTable_Test_MaxTableNameLength(void) void CS_ProcessNewAppDefinitionTable_Test_Nominal(void) { - CS_AppData.HkPacket.Payload.AppCSState = 99; - CS_AppData.DefAppTblPtr[0].State = 88; + CS_AppData.HkPacket.Payload.AppCSState = 99; + CS_AppData.DefAppTblPtr[0].State = 88; strncpy(CS_AppData.DefAppTblPtr[0].Name, "name", 20); /* Execute the function being tested */ - /* Note: first 2 arguments are passed in as addresses of pointers in the source code, even though the variable - types of the arguments are just pointers and the variable names of the arguments suggest that they're just - pointers */ - CS_ProcessNewAppDefinitionTable((CS_Def_App_Table_Entry_t *)&CS_AppData.DefAppTblPtr, - (CS_Res_App_Table_Entry_t *)&CS_AppData.ResAppTblPtr); + CS_ProcessNewAppDefinitionTable(CS_AppData.DefAppTblPtr, CS_AppData.ResAppTblPtr); /* Verify results */ UtAssert_True(CS_AppData.ResAppTblPtr[0].State == 88, "CS_AppData.ResAppTblPtr[0].State == 88"); @@ -2224,15 +2152,11 @@ void CS_ProcessNewAppDefinitionTable_Test_StateEmptyNoValidEntries(void) snprintf(ExpectedEventString, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH, "CS Apps Table: No valid entries in the table"); - CS_AppData.HkPacket.Payload.AppCSState = 99; - CS_AppData.DefAppTblPtr[0].State = CS_STATE_EMPTY; + CS_AppData.HkPacket.Payload.AppCSState = 99; + CS_AppData.DefAppTblPtr[0].State = CS_STATE_EMPTY; /* Execute the function being tested */ - /* Note: first 2 arguments are passed in as addresses of pointers in the source code, even though the variable - types of the arguments are just pointers and the variable names of the arguments suggest that they're just - pointers */ - CS_ProcessNewAppDefinitionTable((CS_Def_App_Table_Entry_t *)&CS_AppData.DefAppTblPtr, - (CS_Res_App_Table_Entry_t *)&CS_AppData.ResAppTblPtr); + CS_ProcessNewAppDefinitionTable(CS_AppData.DefAppTblPtr, CS_AppData.ResAppTblPtr); /* Verify results */ UtAssert_True(CS_AppData.ResAppTblPtr[0].State == CS_STATE_EMPTY, @@ -2277,11 +2201,8 @@ void CS_TableInit_Test_DefaultDefinitionTableLoadErrorEEPROM(void) UT_SetDefaultReturnValue(UT_KEY(CFE_TBL_Load), -1); /* Execute the function being tested */ - /* Note: first 2 arguments are passed in as addresses of pointers in the source code, even though the variable - types of the arguments are just pointers and the variable names of the arguments suggest that they're just - pointers */ - Result = CS_TableInit(&DefinitionTableHandle, &ResultsTableHandle, &CS_AppData.DefEepromTblPtr, - &CS_AppData.ResEepromTblPtr, CS_EEPROM_TABLE, CS_DEF_EEPROM_TABLE_NAME, + Result = CS_TableInit(&DefinitionTableHandle, &ResultsTableHandle, (void **)&CS_AppData.DefEepromTblPtr, + (void **)&CS_AppData.ResEepromTblPtr, CS_EEPROM_TABLE, CS_DEF_EEPROM_TABLE_NAME, CS_RESULTS_EEPROM_TABLE_NAME, CS_MAX_NUM_EEPROM_TABLE_ENTRIES, CS_DEF_EEPROM_TABLE_FILENAME, &CS_AppData.DefaultEepromDefTable, sizeof(CS_Def_EepromMemory_Table_Entry_t), sizeof(CS_Res_EepromMemory_Table_Entry_t), NULL); @@ -2320,11 +2241,8 @@ void CS_TableInit_Test_DefinitionTableGetAddressErrorEEPROM(void) UT_SetDeferredRetcode(UT_KEY(CFE_TBL_GetAddress), 2, -1); /* Execute the function being tested */ - /* Note: first 2 arguments are passed in as addresses of pointers in the source code, even though the variable - types of the arguments are just pointers and the variable names of the arguments suggest that they're just - pointers */ - Result = CS_TableInit(&DefinitionTableHandle, &ResultsTableHandle, &CS_AppData.DefEepromTblPtr, - &CS_AppData.ResEepromTblPtr, CS_EEPROM_TABLE, CS_DEF_EEPROM_TABLE_NAME, + Result = CS_TableInit(&DefinitionTableHandle, &ResultsTableHandle, (void **)&CS_AppData.DefEepromTblPtr, + (void **)&CS_AppData.ResEepromTblPtr, CS_EEPROM_TABLE, CS_DEF_EEPROM_TABLE_NAME, CS_RESULTS_EEPROM_TABLE_NAME, CS_MAX_NUM_EEPROM_TABLE_ENTRIES, CS_DEF_EEPROM_TABLE_FILENAME, &CS_AppData.DefaultEepromDefTable, sizeof(CS_Def_EepromMemory_Table_Entry_t), sizeof(CS_Res_EepromMemory_Table_Entry_t), NULL); @@ -2363,11 +2281,8 @@ void CS_TableInit_Test_DefinitionTableGetAddressErrorMemory(void) UT_SetDeferredRetcode(UT_KEY(CFE_TBL_GetAddress), 2, -1); /* Execute the function being tested */ - /* Note: first 2 arguments are passed in as addresses of pointers in the source code, even though the variable - types of the arguments are just pointers and the variable names of the arguments suggest that they're just - pointers */ - Result = CS_TableInit(&DefinitionTableHandle, &ResultsTableHandle, &CS_AppData.DefMemoryTblPtr, - &CS_AppData.ResMemoryTblPtr, CS_MEMORY_TABLE, CS_DEF_MEMORY_TABLE_NAME, + Result = CS_TableInit(&DefinitionTableHandle, &ResultsTableHandle, (void **)&CS_AppData.DefMemoryTblPtr, + (void **)&CS_AppData.ResMemoryTblPtr, CS_MEMORY_TABLE, CS_DEF_MEMORY_TABLE_NAME, CS_RESULTS_MEMORY_TABLE_NAME, CS_MAX_NUM_MEMORY_TABLE_ENTRIES, CS_DEF_MEMORY_TABLE_FILENAME, &CS_AppData.DefaultMemoryDefTable, sizeof(CS_Def_EepromMemory_Table_Entry_t), sizeof(CS_Res_EepromMemory_Table_Entry_t), NULL); @@ -2406,11 +2321,8 @@ void CS_TableInit_Test_DefinitionTableGetAddressErrorTables(void) UT_SetDeferredRetcode(UT_KEY(CFE_TBL_GetAddress), 2, -1); /* Execute the function being tested */ - /* Note: first 2 arguments are passed in as addresses of pointers in the source code, even though the variable - types of the arguments are just pointers and the variable names of the arguments suggest that they're just - pointers */ - Result = CS_TableInit(&DefinitionTableHandle, &ResultsTableHandle, &CS_AppData.DefTablesTblPtr, - &CS_AppData.ResTablesTblPtr, CS_TABLES_TABLE, CS_DEF_TABLES_TABLE_NAME, + Result = CS_TableInit(&DefinitionTableHandle, &ResultsTableHandle, (void **)&CS_AppData.DefTablesTblPtr, + (void **)&CS_AppData.ResTablesTblPtr, CS_TABLES_TABLE, CS_DEF_TABLES_TABLE_NAME, CS_RESULTS_TABLES_TABLE_NAME, CS_MAX_NUM_TABLES_TABLE_ENTRIES, CS_DEF_TABLES_TABLE_FILENAME, &CS_AppData.DefaultTablesDefTable, sizeof(CS_Def_Tables_Table_Entry_t), sizeof(CS_Res_Tables_Table_Entry_t), NULL); @@ -2449,13 +2361,11 @@ void CS_TableInit_Test_DefinitionTableGetAddressErrorApps(void) UT_SetDeferredRetcode(UT_KEY(CFE_TBL_GetAddress), 2, -1); /* Execute the function being tested */ - /* Note: first 2 arguments are passed in as addresses of pointers in the source code, even though the variable - types of the arguments are just pointers and the variable names of the arguments suggest that they're just - pointers */ - Result = CS_TableInit(&DefinitionTableHandle, &ResultsTableHandle, &CS_AppData.DefAppTblPtr, - &CS_AppData.ResAppTblPtr, CS_APP_TABLE, CS_DEF_APP_TABLE_NAME, CS_RESULTS_APP_TABLE_NAME, - CS_MAX_NUM_APP_TABLE_ENTRIES, CS_DEF_APP_TABLE_FILENAME, &CS_AppData.DefaultAppDefTable, - sizeof(CS_Def_App_Table_Entry_t), sizeof(CS_Res_App_Table_Entry_t), NULL); + Result = + CS_TableInit(&DefinitionTableHandle, &ResultsTableHandle, (void **)&CS_AppData.DefAppTblPtr, + (void **)&CS_AppData.ResAppTblPtr, CS_APP_TABLE, CS_DEF_APP_TABLE_NAME, CS_RESULTS_APP_TABLE_NAME, + CS_MAX_NUM_APP_TABLE_ENTRIES, CS_DEF_APP_TABLE_FILENAME, &CS_AppData.DefaultAppDefTable, + sizeof(CS_Def_App_Table_Entry_t), sizeof(CS_Res_App_Table_Entry_t), NULL); /* Verify results */ UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, CS_TBL_INIT_ERR_EID); @@ -2486,11 +2396,8 @@ void CS_TableInit_Test_EepromTableAndNotLoadedFromMemory(void) UT_SetDeferredRetcode(UT_KEY(CFE_TBL_GetAddress), 2, CFE_TBL_INFO_UPDATED); /* Execute the function being tested */ - /* Note: first 2 arguments are passed in as addresses of pointers in the source code, even though the variable - types of the arguments are just pointers and the variable names of the arguments suggest that they're just - pointers */ - Result = CS_TableInit(&DefinitionTableHandle, &ResultsTableHandle, &CS_AppData.DefEepromTblPtr, - &CS_AppData.ResEepromTblPtr, CS_EEPROM_TABLE, CS_DEF_EEPROM_TABLE_NAME, + Result = CS_TableInit(&DefinitionTableHandle, &ResultsTableHandle, (void **)&CS_AppData.DefEepromTblPtr, + (void **)&CS_AppData.ResEepromTblPtr, CS_EEPROM_TABLE, CS_DEF_EEPROM_TABLE_NAME, CS_RESULTS_EEPROM_TABLE_NAME, CS_MAX_NUM_EEPROM_TABLE_ENTRIES, CS_DEF_EEPROM_TABLE_FILENAME, &CS_AppData.DefaultEepromDefTable, sizeof(CS_Def_EepromMemory_Table_Entry_t), sizeof(CS_Res_EepromMemory_Table_Entry_t), NULL); @@ -2521,25 +2428,16 @@ void CS_TableInit_Test_EepromTableAndLoadedFromMemoryAfterResultsTableRegisterEr UT_SetDefaultReturnValue(UT_KEY(CFE_TBL_GetAddress), CFE_SUCCESS); /* Execute the function being tested */ - /* Note: first 2 arguments are passed in as addresses of pointers in the source code, even though the variable - types of the arguments are just pointers and the variable names of the arguments suggest that they're just - pointers */ - Result = CS_TableInit(&DefinitionTableHandle, &ResultsTableHandle, &CS_AppData.DefEepromTblPtr, - &CS_AppData.ResEepromTblPtr, CS_EEPROM_TABLE, CS_DEF_EEPROM_TABLE_NAME, + Result = CS_TableInit(&DefinitionTableHandle, &ResultsTableHandle, (void **)&CS_AppData.DefEepromTblPtr, + (void **)&CS_AppData.ResEepromTblPtr, CS_EEPROM_TABLE, CS_DEF_EEPROM_TABLE_NAME, CS_RESULTS_EEPROM_TABLE_NAME, CS_MAX_NUM_EEPROM_TABLE_ENTRIES, CS_DEF_EEPROM_TABLE_FILENAME, &CS_AppData.DefaultEepromDefTable, sizeof(CS_Def_EepromMemory_Table_Entry_t), sizeof(CS_Res_EepromMemory_Table_Entry_t), NULL); /* Verify results */ - UtAssert_True(CS_AppData.HkPacket.Payload.EepromCSState == CS_STATE_DISABLED, - "CS_AppData.HkPacket.Payload.EepromCSState == CS_STATE_DISABLED"); - - UtAssert_True(Result == CFE_SUCCESS, "Result == CFE_SUCCESS"); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - UtAssert_True(call_count_CFE_EVS_SendEvent == 0, "CFE_EVS_SendEvent was called %u time(s), expected 0", - call_count_CFE_EVS_SendEvent); + UtAssert_INT32_EQ(Result, -1); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); + UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, CS_TBL_INIT_ERR_EID); } void CS_TableInit_Test_EepromTableAndLoadedFromMemoryAfterResultsTableGetAddressError(void) @@ -2555,25 +2453,16 @@ void CS_TableInit_Test_EepromTableAndLoadedFromMemoryAfterResultsTableGetAddress UT_SetDeferredRetcode(UT_KEY(CFE_TBL_GetAddress), 1, -1); /* Execute the function being tested */ - /* Note: first 2 arguments are passed in as addresses of pointers in the source code, even though the variable - types of the arguments are just pointers and the variable names of the arguments suggest that they're just - pointers */ - Result = CS_TableInit(&DefinitionTableHandle, &ResultsTableHandle, &CS_AppData.DefEepromTblPtr, - &CS_AppData.ResEepromTblPtr, CS_EEPROM_TABLE, CS_DEF_EEPROM_TABLE_NAME, + Result = CS_TableInit(&DefinitionTableHandle, &ResultsTableHandle, (void **)&CS_AppData.DefEepromTblPtr, + (void **)&CS_AppData.ResEepromTblPtr, CS_EEPROM_TABLE, CS_DEF_EEPROM_TABLE_NAME, CS_RESULTS_EEPROM_TABLE_NAME, CS_MAX_NUM_EEPROM_TABLE_ENTRIES, CS_DEF_EEPROM_TABLE_FILENAME, &CS_AppData.DefaultEepromDefTable, sizeof(CS_Def_EepromMemory_Table_Entry_t), sizeof(CS_Res_EepromMemory_Table_Entry_t), NULL); /* Verify results */ - UtAssert_True(CS_AppData.HkPacket.Payload.EepromCSState == CS_STATE_DISABLED, - "CS_AppData.HkPacket.Payload.EepromCSState == CS_STATE_DISABLED"); - - UtAssert_True(Result == CFE_SUCCESS, "Result == CFE_SUCCESS"); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - UtAssert_True(call_count_CFE_EVS_SendEvent == 0, "CFE_EVS_SendEvent was called %u time(s), expected 0", - call_count_CFE_EVS_SendEvent); + UtAssert_INT32_EQ(Result, -1); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); + UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, CS_TBL_INIT_ERR_EID); } void CS_TableInit_Test_EepromTableAndLoadedFromMemoryAfterDefinitionTableRegisterError(void) @@ -2592,25 +2481,16 @@ void CS_TableInit_Test_EepromTableAndLoadedFromMemoryAfterDefinitionTableRegiste UT_SetDefaultReturnValue(UT_KEY(CFE_TBL_GetAddress), CFE_SUCCESS); /* Execute the function being tested */ - /* Note: first 2 arguments are passed in as addresses of pointers in the source code, even though the variable - types of the arguments are just pointers and the variable names of the arguments suggest that they're just - pointers */ - Result = CS_TableInit(&DefinitionTableHandle, &ResultsTableHandle, &CS_AppData.DefEepromTblPtr, - &CS_AppData.ResEepromTblPtr, CS_EEPROM_TABLE, CS_DEF_EEPROM_TABLE_NAME, + Result = CS_TableInit(&DefinitionTableHandle, &ResultsTableHandle, (void **)&CS_AppData.DefEepromTblPtr, + (void **)&CS_AppData.ResEepromTblPtr, CS_EEPROM_TABLE, CS_DEF_EEPROM_TABLE_NAME, CS_RESULTS_EEPROM_TABLE_NAME, CS_MAX_NUM_EEPROM_TABLE_ENTRIES, CS_DEF_EEPROM_TABLE_FILENAME, &CS_AppData.DefaultEepromDefTable, sizeof(CS_Def_EepromMemory_Table_Entry_t), sizeof(CS_Res_EepromMemory_Table_Entry_t), NULL); /* Verify results */ - UtAssert_True(CS_AppData.HkPacket.Payload.EepromCSState == CS_STATE_DISABLED, - "CS_AppData.HkPacket.Payload.EepromCSState == CS_STATE_DISABLED"); - - UtAssert_True(Result == CFE_SUCCESS, "Result == CFE_SUCCESS"); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - UtAssert_True(call_count_CFE_EVS_SendEvent == 0, "CFE_EVS_SendEvent was called %u time(s), expected 0", - call_count_CFE_EVS_SendEvent); + UtAssert_INT32_EQ(Result, -1); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); + UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, CS_TBL_INIT_ERR_EID); } void CS_TableInit_Test_EepromTableAndLoadedFromMemoryAfterDefinitionTableFileLoadError(void) @@ -2619,6 +2499,9 @@ void CS_TableInit_Test_EepromTableAndLoadedFromMemoryAfterDefinitionTableFileLoa CFE_TBL_Handle_t DefinitionTableHandle = 0; CFE_TBL_Handle_t ResultsTableHandle = 0; + /* So this can detect the switch to DISABLED */ + CS_AppData.HkPacket.Payload.EepromCSState = CS_STATE_ENABLED; + /* On 1st call, return -1 to satisfy condition "ResultFromLoad != CFE_SUCCESS". On 2nd call, return CFE_SUCCESS to * prevent error */ UT_SetDeferredRetcode(UT_KEY(CFE_TBL_Load), 1, -1); @@ -2627,25 +2510,16 @@ void CS_TableInit_Test_EepromTableAndLoadedFromMemoryAfterDefinitionTableFileLoa UT_SetDefaultReturnValue(UT_KEY(CFE_TBL_GetAddress), CFE_SUCCESS); /* Execute the function being tested */ - /* Note: first 2 arguments are passed in as addresses of pointers in the source code, even though the variable - types of the arguments are just pointers and the variable names of the arguments suggest that they're just - pointers */ - Result = CS_TableInit(&DefinitionTableHandle, &ResultsTableHandle, &CS_AppData.DefEepromTblPtr, - &CS_AppData.ResEepromTblPtr, CS_EEPROM_TABLE, CS_DEF_EEPROM_TABLE_NAME, + Result = CS_TableInit(&DefinitionTableHandle, &ResultsTableHandle, (void **)&CS_AppData.DefEepromTblPtr, + (void **)&CS_AppData.ResEepromTblPtr, CS_EEPROM_TABLE, CS_DEF_EEPROM_TABLE_NAME, CS_RESULTS_EEPROM_TABLE_NAME, CS_MAX_NUM_EEPROM_TABLE_ENTRIES, CS_DEF_EEPROM_TABLE_FILENAME, &CS_AppData.DefaultEepromDefTable, sizeof(CS_Def_EepromMemory_Table_Entry_t), sizeof(CS_Res_EepromMemory_Table_Entry_t), NULL); /* Verify results */ - UtAssert_True(CS_AppData.HkPacket.Payload.EepromCSState == CS_STATE_DISABLED, - "CS_AppData.HkPacket.Payload.EepromCSState == CS_STATE_DISABLED"); - - UtAssert_True(Result == CFE_SUCCESS, "Result == CFE_SUCCESS"); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - UtAssert_True(call_count_CFE_EVS_SendEvent == 0, "CFE_EVS_SendEvent was called %u time(s), expected 0", - call_count_CFE_EVS_SendEvent); + UtAssert_UINT8_EQ(CS_AppData.HkPacket.Payload.EepromCSState, CS_STATE_DISABLED); + UtAssert_INT32_EQ(Result, CFE_SUCCESS); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); } void CS_TableInit_Test_MemoryTableAndNotLoadedFromMemory(void) @@ -2654,6 +2528,9 @@ void CS_TableInit_Test_MemoryTableAndNotLoadedFromMemory(void) CFE_TBL_Handle_t DefinitionTableHandle = 0; CFE_TBL_Handle_t ResultsTableHandle = 0; + /* So this can detect a switch */ + CS_AppData.HkPacket.Payload.MemoryCSState = CS_STATE_ENABLED; + /* Set to prevent unintended errors */ UT_SetDefaultReturnValue(UT_KEY(CFE_TBL_Load), CFE_SUCCESS); @@ -2661,23 +2538,17 @@ void CS_TableInit_Test_MemoryTableAndNotLoadedFromMemory(void) UT_SetDeferredRetcode(UT_KEY(CFE_TBL_GetAddress), 2, CFE_TBL_INFO_UPDATED); /* Execute the function being tested */ - /* Note: first 2 arguments are passed in as addresses of pointers in the source code, even though the variable - types of the arguments are just pointers and the variable names of the arguments suggest that they're just - pointers */ - Result = CS_TableInit(&DefinitionTableHandle, &ResultsTableHandle, &CS_AppData.DefMemoryTblPtr, - &CS_AppData.ResMemoryTblPtr, CS_MEMORY_TABLE, CS_DEF_MEMORY_TABLE_NAME, + Result = CS_TableInit(&DefinitionTableHandle, &ResultsTableHandle, (void **)&CS_AppData.DefMemoryTblPtr, + (void **)&CS_AppData.ResMemoryTblPtr, CS_MEMORY_TABLE, CS_DEF_MEMORY_TABLE_NAME, CS_RESULTS_MEMORY_TABLE_NAME, CS_MAX_NUM_MEMORY_TABLE_ENTRIES, CS_DEF_MEMORY_TABLE_FILENAME, &CS_AppData.DefaultMemoryDefTable, sizeof(CS_Def_EepromMemory_Table_Entry_t), sizeof(CS_Res_EepromMemory_Table_Entry_t), NULL); /* Verify results */ - UtAssert_True(Result == CFE_SUCCESS, "Result == CFE_SUCCESS"); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); + UtAssert_UINT8_EQ(CS_AppData.HkPacket.Payload.MemoryCSState, CS_STATE_ENABLED); + UtAssert_INT32_EQ(Result, CFE_SUCCESS); - UtAssert_True(call_count_CFE_EVS_SendEvent == 1, "CFE_EVS_SendEvent was called %u time(s), expected 1", - call_count_CFE_EVS_SendEvent); - /* Generates 1 error message we don't care about in this test */ + /* Note this may generate an event in the new table processing, checked in other test */ } void CS_TableInit_Test_MemoryTableAndLoadedFromMemory(void) @@ -2686,8 +2557,11 @@ void CS_TableInit_Test_MemoryTableAndLoadedFromMemory(void) CFE_TBL_Handle_t DefinitionTableHandle = 0; CFE_TBL_Handle_t ResultsTableHandle = 0; - /* Set to satisfy condition "ResultFromLoad != CFE_SUCCESS" */ - UT_SetDeferredRetcode(UT_KEY(CFE_TBL_Register), 1, -1); + /* So this can detect a switch */ + CS_AppData.HkPacket.Payload.MemoryCSState = CS_STATE_ENABLED; + + /* First call fails so it proceeds to load from memory */ + UT_SetDeferredRetcode(UT_KEY(CFE_TBL_Load), 1, -1); /* Set to prevent unintended errors */ UT_SetDefaultReturnValue(UT_KEY(CFE_TBL_Load), CFE_SUCCESS); @@ -2696,25 +2570,16 @@ void CS_TableInit_Test_MemoryTableAndLoadedFromMemory(void) UT_SetDefaultReturnValue(UT_KEY(CFE_TBL_GetAddress), CFE_SUCCESS); /* Execute the function being tested */ - /* Note: first 2 arguments are passed in as addresses of pointers in the source code, even though the variable - types of the arguments are just pointers and the variable names of the arguments suggest that they're just - pointers */ - Result = CS_TableInit(&DefinitionTableHandle, &ResultsTableHandle, &CS_AppData.DefMemoryTblPtr, - &CS_AppData.ResMemoryTblPtr, CS_MEMORY_TABLE, CS_DEF_MEMORY_TABLE_NAME, + Result = CS_TableInit(&DefinitionTableHandle, &ResultsTableHandle, (void **)&CS_AppData.DefMemoryTblPtr, + (void **)&CS_AppData.ResMemoryTblPtr, CS_MEMORY_TABLE, CS_DEF_MEMORY_TABLE_NAME, CS_RESULTS_MEMORY_TABLE_NAME, CS_MAX_NUM_MEMORY_TABLE_ENTRIES, CS_DEF_MEMORY_TABLE_FILENAME, &CS_AppData.DefaultMemoryDefTable, sizeof(CS_Def_EepromMemory_Table_Entry_t), sizeof(CS_Res_EepromMemory_Table_Entry_t), NULL); /* Verify results */ - UtAssert_True(CS_AppData.HkPacket.Payload.MemoryCSState == CS_STATE_DISABLED, - "CS_AppData.HkPacket.Payload.MemoryCSState == CS_STATE_DISABLED"); - - UtAssert_True(Result == CFE_SUCCESS, "Result == CFE_SUCCESS"); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - UtAssert_True(call_count_CFE_EVS_SendEvent == 0, "CFE_EVS_SendEvent was called %u time(s), expected 0", - call_count_CFE_EVS_SendEvent); + UtAssert_UINT8_EQ(CS_AppData.HkPacket.Payload.MemoryCSState, CS_STATE_DISABLED); + UtAssert_INT32_EQ(Result, CFE_SUCCESS); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); } void CS_TableInit_Test_AppTableAndNotLoadedFromMemory(void) @@ -2723,6 +2588,9 @@ void CS_TableInit_Test_AppTableAndNotLoadedFromMemory(void) CFE_TBL_Handle_t DefinitionTableHandle = 0; CFE_TBL_Handle_t ResultsTableHandle = 0; + /* So this can detect a switch */ + CS_AppData.HkPacket.Payload.AppCSState = CS_STATE_ENABLED; + /* Set to prevent unintended errors */ UT_SetDefaultReturnValue(UT_KEY(CFE_TBL_Load), CFE_SUCCESS); @@ -2730,22 +2598,16 @@ void CS_TableInit_Test_AppTableAndNotLoadedFromMemory(void) UT_SetDeferredRetcode(UT_KEY(CFE_TBL_GetAddress), 2, CFE_TBL_INFO_UPDATED); /* Execute the function being tested */ - /* Note: first 2 arguments are passed in as addresses of pointers in the source code, even though the variable - types of the arguments are just pointers and the variable names of the arguments suggest that they're just - pointers */ - Result = CS_TableInit(&DefinitionTableHandle, &ResultsTableHandle, &CS_AppData.DefAppTblPtr, - &CS_AppData.ResAppTblPtr, CS_APP_TABLE, CS_DEF_APP_TABLE_NAME, CS_RESULTS_APP_TABLE_NAME, - CS_MAX_NUM_APP_TABLE_ENTRIES, CS_DEF_APP_TABLE_FILENAME, &CS_AppData.DefaultAppDefTable, - sizeof(CS_Def_App_Table_Entry_t), sizeof(CS_Res_App_Table_Entry_t), NULL); + Result = + CS_TableInit(&DefinitionTableHandle, &ResultsTableHandle, (void **)&CS_AppData.DefAppTblPtr, + (void **)&CS_AppData.ResAppTblPtr, CS_APP_TABLE, CS_DEF_APP_TABLE_NAME, CS_RESULTS_APP_TABLE_NAME, + CS_MAX_NUM_APP_TABLE_ENTRIES, CS_DEF_APP_TABLE_FILENAME, &CS_AppData.DefaultAppDefTable, + sizeof(CS_Def_App_Table_Entry_t), sizeof(CS_Res_App_Table_Entry_t), NULL); /* Verify results */ - UtAssert_True(Result == CFE_SUCCESS, "Result == CFE_SUCCESS"); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - UtAssert_True(call_count_CFE_EVS_SendEvent == 1, "CFE_EVS_SendEvent was called %u time(s), expected 1", - call_count_CFE_EVS_SendEvent); - /* Generates 1 event message we don't care about in this test */ + UtAssert_UINT8_EQ(CS_AppData.HkPacket.Payload.AppCSState, CS_STATE_ENABLED); + UtAssert_INT32_EQ(Result, CFE_SUCCESS); + /* Note this may generate an event in the new table processing, checked in other test */ } void CS_TableInit_Test_AppTableAndLoadedFromMemory(void) @@ -2754,8 +2616,11 @@ void CS_TableInit_Test_AppTableAndLoadedFromMemory(void) CFE_TBL_Handle_t DefinitionTableHandle = 0; CFE_TBL_Handle_t ResultsTableHandle = 0; + /* So this can detect a switch */ + CS_AppData.HkPacket.Payload.AppCSState = CS_STATE_ENABLED; + /* Set to satisfy condition "ResultFromLoad != CFE_SUCCESS" */ - UT_SetDeferredRetcode(UT_KEY(CFE_TBL_Register), 1, -1); + UT_SetDeferredRetcode(UT_KEY(CFE_TBL_Load), 1, -1); /* Set to prevent unintended errors */ UT_SetDefaultReturnValue(UT_KEY(CFE_TBL_Load), CFE_SUCCESS); @@ -2764,24 +2629,16 @@ void CS_TableInit_Test_AppTableAndLoadedFromMemory(void) UT_SetDefaultReturnValue(UT_KEY(CFE_TBL_GetAddress), CFE_SUCCESS); /* Execute the function being tested */ - /* Note: first 2 arguments are passed in as addresses of pointers in the source code, even though the variable - types of the arguments are just pointers and the variable names of the arguments suggest that they're just - pointers */ - Result = CS_TableInit(&DefinitionTableHandle, &ResultsTableHandle, &CS_AppData.DefAppTblPtr, - &CS_AppData.ResAppTblPtr, CS_APP_TABLE, CS_DEF_APP_TABLE_NAME, CS_RESULTS_APP_TABLE_NAME, - CS_MAX_NUM_APP_TABLE_ENTRIES, CS_DEF_APP_TABLE_FILENAME, &CS_AppData.DefaultAppDefTable, - sizeof(CS_Def_App_Table_Entry_t), sizeof(CS_Res_App_Table_Entry_t), NULL); + Result = + CS_TableInit(&DefinitionTableHandle, &ResultsTableHandle, (void **)&CS_AppData.DefAppTblPtr, + (void **)&CS_AppData.ResAppTblPtr, CS_APP_TABLE, CS_DEF_APP_TABLE_NAME, CS_RESULTS_APP_TABLE_NAME, + CS_MAX_NUM_APP_TABLE_ENTRIES, CS_DEF_APP_TABLE_FILENAME, &CS_AppData.DefaultAppDefTable, + sizeof(CS_Def_App_Table_Entry_t), sizeof(CS_Res_App_Table_Entry_t), NULL); /* Verify results */ - UtAssert_True(CS_AppData.HkPacket.Payload.AppCSState == CS_STATE_DISABLED, - "CS_AppData.HkPacket.Payload.AppCSState == CS_STATE_DISABLED"); - - UtAssert_True(Result == CFE_SUCCESS, "Result == CFE_SUCCESS"); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - UtAssert_True(call_count_CFE_EVS_SendEvent == 0, "CFE_EVS_SendEvent was called %u time(s), expected 0", - call_count_CFE_EVS_SendEvent); + UtAssert_UINT8_EQ(CS_AppData.HkPacket.Payload.AppCSState, CS_STATE_DISABLED); + UtAssert_INT32_EQ(Result, CFE_SUCCESS); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); } void CS_TableInit_Test_TablesTableAndNotLoadedFromMemory(void) @@ -2790,6 +2647,9 @@ void CS_TableInit_Test_TablesTableAndNotLoadedFromMemory(void) CFE_TBL_Handle_t DefinitionTableHandle = 0; CFE_TBL_Handle_t ResultsTableHandle = 0; + /* So this can detect a switch */ + CS_AppData.HkPacket.Payload.TablesCSState = CS_STATE_ENABLED; + /* Set to prevent unintended errors */ UT_SetDefaultReturnValue(UT_KEY(CFE_TBL_Load), CFE_SUCCESS); @@ -2797,23 +2657,16 @@ void CS_TableInit_Test_TablesTableAndNotLoadedFromMemory(void) UT_SetDeferredRetcode(UT_KEY(CFE_TBL_GetAddress), 2, CFE_TBL_INFO_UPDATED); /* Execute the function being tested */ - /* Note: first 2 arguments are passed in as addresses of pointers in the source code, even though the variable - types of the arguments are just pointers and the variable names of the arguments suggest that they're just - pointers */ - Result = CS_TableInit(&DefinitionTableHandle, &ResultsTableHandle, &CS_AppData.DefTablesTblPtr, - &CS_AppData.ResTablesTblPtr, CS_TABLES_TABLE, CS_DEF_TABLES_TABLE_NAME, + Result = CS_TableInit(&DefinitionTableHandle, &ResultsTableHandle, (void **)&CS_AppData.DefTablesTblPtr, + (void **)&CS_AppData.ResTablesTblPtr, CS_TABLES_TABLE, CS_DEF_TABLES_TABLE_NAME, CS_RESULTS_TABLES_TABLE_NAME, CS_MAX_NUM_TABLES_TABLE_ENTRIES, CS_DEF_TABLES_TABLE_FILENAME, &CS_AppData.DefaultTablesDefTable, sizeof(CS_Def_Tables_Table_Entry_t), sizeof(CS_Res_Tables_Table_Entry_t), NULL); /* Verify results */ - UtAssert_True(Result == CFE_SUCCESS, "Result == CFE_SUCCESS"); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - UtAssert_True(call_count_CFE_EVS_SendEvent == 1, "CFE_EVS_SendEvent was called %u time(s), expected 1", - call_count_CFE_EVS_SendEvent); - /* Generates 1 error message we don't care about in this test */ + UtAssert_UINT8_EQ(CS_AppData.HkPacket.Payload.TablesCSState, CS_STATE_ENABLED); + UtAssert_INT32_EQ(Result, CFE_SUCCESS); + /* Note this may generate an event in the new table processing, checked in other test */ } void CS_TableInit_Test_TablesTableAndLoadedFromMemory(void) @@ -2822,8 +2675,11 @@ void CS_TableInit_Test_TablesTableAndLoadedFromMemory(void) CFE_TBL_Handle_t DefinitionTableHandle = 0; CFE_TBL_Handle_t ResultsTableHandle = 0; + /* So this can detect a switch */ + CS_AppData.HkPacket.Payload.TablesCSState = CS_STATE_ENABLED; + /* Set to satisfy condition "ResultFromLoad != CFE_SUCCESS" */ - UT_SetDeferredRetcode(UT_KEY(CFE_TBL_Register), 1, -1); + UT_SetDeferredRetcode(UT_KEY(CFE_TBL_Load), 1, -1); /* Set to prevent unintended errors */ UT_SetDefaultReturnValue(UT_KEY(CFE_TBL_Load), CFE_SUCCESS); @@ -2832,25 +2688,16 @@ void CS_TableInit_Test_TablesTableAndLoadedFromMemory(void) UT_SetDefaultReturnValue(UT_KEY(CFE_TBL_GetAddress), CFE_SUCCESS); /* Execute the function being tested */ - /* Note: first 2 arguments are passed in as addresses of pointers in the source code, even though the variable - types of the arguments are just pointers and the variable names of the arguments suggest that they're just - pointers */ - Result = CS_TableInit(&DefinitionTableHandle, &ResultsTableHandle, &CS_AppData.DefTablesTblPtr, - &CS_AppData.ResTablesTblPtr, CS_TABLES_TABLE, CS_DEF_TABLES_TABLE_NAME, + Result = CS_TableInit(&DefinitionTableHandle, &ResultsTableHandle, (void **)&CS_AppData.DefTablesTblPtr, + (void **)&CS_AppData.ResTablesTblPtr, CS_TABLES_TABLE, CS_DEF_TABLES_TABLE_NAME, CS_RESULTS_TABLES_TABLE_NAME, CS_MAX_NUM_TABLES_TABLE_ENTRIES, CS_DEF_TABLES_TABLE_FILENAME, &CS_AppData.DefaultTablesDefTable, sizeof(CS_Def_Tables_Table_Entry_t), sizeof(CS_Res_Tables_Table_Entry_t), NULL); /* Verify results */ - UtAssert_True(CS_AppData.HkPacket.Payload.TablesCSState == CS_STATE_DISABLED, - "CS_AppData.HkPacket.Payload.TablesCSState == CS_STATE_DISABLED"); - - UtAssert_True(Result == CFE_SUCCESS, "Result == CFE_SUCCESS"); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - UtAssert_True(call_count_CFE_EVS_SendEvent == 0, "CFE_EVS_SendEvent was called %u time(s), expected 0", - call_count_CFE_EVS_SendEvent); + UtAssert_UINT8_EQ(CS_AppData.HkPacket.Payload.TablesCSState, CS_STATE_DISABLED); + UtAssert_INT32_EQ(Result, CFE_SUCCESS); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); } void CS_TableInit_Test_DefaultAndLoadedFromMemory(void) @@ -2859,45 +2706,12 @@ void CS_TableInit_Test_DefaultAndLoadedFromMemory(void) CFE_TBL_Handle_t DefinitionTableHandle = 0; CFE_TBL_Handle_t ResultsTableHandle = 0; - /* Set to satisfy condition "ResultFromLoad != CFE_SUCCESS" */ - UT_SetDeferredRetcode(UT_KEY(CFE_TBL_Register), 1, -1); - - /* Set to prevent unintended errors */ - UT_SetDefaultReturnValue(UT_KEY(CFE_TBL_Load), CFE_SUCCESS); - - /* Set to prevent unintended errors */ - UT_SetDefaultReturnValue(UT_KEY(CFE_TBL_GetAddress), CFE_SUCCESS); - - /* Execute the function being tested */ - /* Note: first 2 arguments are passed in as addresses of pointers in the source code, even though the variable - types of the arguments are just pointers and the variable names of the arguments suggest that they're just - pointers */ - Result = - CS_TableInit(&DefinitionTableHandle, &ResultsTableHandle, &CS_AppData.DefTablesTblPtr, - &CS_AppData.ResTablesTblPtr, 99, CS_DEF_TABLES_TABLE_NAME, CS_RESULTS_TABLES_TABLE_NAME, - CS_MAX_NUM_TABLES_TABLE_ENTRIES, CS_DEF_TABLES_TABLE_FILENAME, &CS_AppData.DefaultTablesDefTable, - sizeof(CS_Def_Tables_Table_Entry_t), sizeof(CS_Res_Tables_Table_Entry_t), NULL); - - /* Verify results */ - UtAssert_True(CS_AppData.HkPacket.Payload.TablesCSState == CS_STATE_EMPTY, - "CS_AppData.HkPacket.Payload.TablesCSState == CS_STATE_EMPTY"); - - UtAssert_True(Result == CFE_SUCCESS, "Result == CFE_SUCCESS"); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - UtAssert_True(call_count_CFE_EVS_SendEvent == 0, "CFE_EVS_SendEvent was called %u time(s), expected 0", - call_count_CFE_EVS_SendEvent); -} - -void CS_TableInit_Test_OpenCreateError(void) -{ - CFE_Status_t Result; - CFE_TBL_Handle_t DefinitionTableHandle = 0; - CFE_TBL_Handle_t ResultsTableHandle = 0; + /* Note this is not really a valid case; this only covers a possible path + * where the table ID value is not one of the expected values. It exists + * to satisfy branch coverage */ /* Set to satisfy condition "ResultFromLoad != CFE_SUCCESS" */ - UT_SetDeferredRetcode(UT_KEY(CFE_TBL_Register), 1, CFE_SUCCESS); + UT_SetDeferredRetcode(UT_KEY(CFE_TBL_Load), 1, -1); /* Set to prevent unintended errors */ UT_SetDefaultReturnValue(UT_KEY(CFE_TBL_Load), CFE_SUCCESS); @@ -2905,28 +2719,16 @@ void CS_TableInit_Test_OpenCreateError(void) /* Set to prevent unintended errors */ UT_SetDefaultReturnValue(UT_KEY(CFE_TBL_GetAddress), CFE_SUCCESS); - UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), -1); - /* Execute the function being tested */ - /* Note: first 2 arguments are passed in as addresses of pointers in the source code, even though the variable - types of the arguments are just pointers and the variable names of the arguments suggest that they're just - pointers */ Result = - CS_TableInit(&DefinitionTableHandle, &ResultsTableHandle, &CS_AppData.DefTablesTblPtr, - &CS_AppData.ResTablesTblPtr, 99, CS_DEF_TABLES_TABLE_NAME, CS_RESULTS_TABLES_TABLE_NAME, + CS_TableInit(&DefinitionTableHandle, &ResultsTableHandle, (void **)&CS_AppData.DefTablesTblPtr, + (void **)&CS_AppData.ResTablesTblPtr, 99, CS_DEF_TABLES_TABLE_NAME, CS_RESULTS_TABLES_TABLE_NAME, CS_MAX_NUM_TABLES_TABLE_ENTRIES, CS_DEF_TABLES_TABLE_FILENAME, &CS_AppData.DefaultTablesDefTable, sizeof(CS_Def_Tables_Table_Entry_t), sizeof(CS_Res_Tables_Table_Entry_t), NULL); /* Verify results */ - UtAssert_True(CS_AppData.HkPacket.Payload.TablesCSState == CS_STATE_EMPTY, - "CS_AppData.HkPacket.Payload.TablesCSState == CS_STATE_EMPTY"); - - UtAssert_True(Result == CFE_SUCCESS, "Result == CFE_SUCCESS"); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - UtAssert_True(call_count_CFE_EVS_SendEvent == 0, "CFE_EVS_SendEvent was called %u time(s), expected 0", - call_count_CFE_EVS_SendEvent); + UtAssert_INT32_EQ(Result, CFE_SUCCESS); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); } void CS_HandleTableUpdate_Test_ProcessNewTablesDefinitionTable(void) @@ -2936,6 +2738,9 @@ void CS_HandleTableUpdate_Test_ProcessNewTablesDefinitionTable(void) CFE_TBL_Handle_t ResultsTableHandle = 0; uint16 Table = CS_TABLES_TABLE; + void *DefTblPtr = CS_AppData.DefTablesTblPtr; + void *ResultTblPtr = CS_AppData.ResTablesTblPtr; + /* On 1st call, return CFE_SUCCESS to prevent error. On 2nd call, return UT_CFE_TBL_GETADDRESS_INDEX to satisfy * condition "Result == CFE_TBL_INFO_UPDATED". */ UT_SetDeferredRetcode(UT_KEY(CFE_TBL_GetAddress), 2, CFE_TBL_INFO_UPDATED); @@ -2944,11 +2749,8 @@ void CS_HandleTableUpdate_Test_ProcessNewTablesDefinitionTable(void) CS_AppData.ResTablesTblPtr[0].IsCSOwner = false; /* Execute the function being tested */ - /* Note: first 2 arguments are passed in as addresses of pointers in the source code, even though the variable - types of the arguments are just pointers and the variable names of the arguments suggest that they're just - pointers */ - Result = CS_HandleTableUpdate(&CS_AppData.DefTablesTblPtr, &CS_AppData.ResTablesTblPtr, DefinitionTableHandle, - ResultsTableHandle, Table, CS_MAX_NUM_TABLES_TABLE_ENTRIES); + Result = CS_HandleTableUpdate(&DefTblPtr, &ResultTblPtr, DefinitionTableHandle, ResultsTableHandle, Table, + CS_MAX_NUM_TABLES_TABLE_ENTRIES); /* Verify results */ UtAssert_True(Result == CFE_SUCCESS, "Result == CFE_SUCCESS"); @@ -2968,16 +2770,16 @@ void CS_HandleTableUpdate_Test_ProcessNewAppDefinitionTable(void) uint16 Table = CS_APP_TABLE; uint16 NumEntries = 0; + void *DefTblPtr = CS_AppData.DefAppTblPtr; + void *ResultTblPtr = CS_AppData.ResAppTblPtr; + /* On 1st call, return CFE_SUCCESS to prevent error. On 2nd call, return UT_CFE_TBL_GETADDRESS_INDEX to satisfy * condition "Result == CFE_TBL_INFO_UPDATED". */ UT_SetDeferredRetcode(UT_KEY(CFE_TBL_GetAddress), 2, CFE_TBL_INFO_UPDATED); /* Execute the function being tested */ - /* Note: first 2 arguments are passed in as addresses of pointers in the source code, even though the variable - types of the arguments are just pointers and the variable names of the arguments suggest that they're just - pointers */ - Result = CS_HandleTableUpdate(&CS_AppData.DefAppTblPtr, &CS_AppData.ResAppTblPtr, DefinitionTableHandle, - ResultsTableHandle, Table, NumEntries); + Result = + CS_HandleTableUpdate(&DefTblPtr, &ResultTblPtr, DefinitionTableHandle, ResultsTableHandle, Table, NumEntries); /* Verify results */ UtAssert_True(Result == CFE_SUCCESS, "Result == CFE_SUCCESS"); @@ -2997,16 +2799,16 @@ void CS_HandleTableUpdate_Test_ProcessNewEepromMemoryDefinitionTable(void) uint16 Table = CS_EEPROM_TABLE; uint16 NumEntries = CS_MAX_NUM_EEPROM_TABLE_ENTRIES; + void *DefTblPtr = CS_AppData.DefEepromTblPtr; + void *ResultTblPtr = CS_AppData.ResEepromTblPtr; + /* On 1st call, return CFE_SUCCESS to prevent error. On 2nd call, return UT_CFE_TBL_GETADDRESS_INDEX to satisfy * condition "Result == CFE_TBL_INFO_UPDATED". */ UT_SetDeferredRetcode(UT_KEY(CFE_TBL_GetAddress), 2, CFE_TBL_INFO_UPDATED); /* Execute the function being tested */ - /* Note: first 2 arguments are passed in as addresses of pointers in the source code, even though the variable - types of the arguments are just pointers and the variable names of the arguments suggest that they're just - pointers */ - Result = CS_HandleTableUpdate(&CS_AppData.DefEepromTblPtr, &CS_AppData.ResEepromTblPtr, DefinitionTableHandle, - ResultsTableHandle, Table, NumEntries); + Result = + CS_HandleTableUpdate(&DefTblPtr, &ResultTblPtr, DefinitionTableHandle, ResultsTableHandle, Table, NumEntries); /* Verify results */ UtAssert_True(Result == CFE_SUCCESS, "Result == CFE_SUCCESS"); @@ -3028,6 +2830,9 @@ void CS_HandleTableUpdate_Test_ResultsTableGetAddressErrorEEPROM(void) int32 strCmpResult; char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH * 2]; + void *DefTblPtr = CS_AppData.DefEepromTblPtr; + void *ResultTblPtr = CS_AppData.ResEepromTblPtr; + snprintf(ExpectedEventString, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH * 2, "CS had problems updating table. Res Release: 0x%%08X Def Release:0x%%08X Res Manage:0x%%08X Def Manage: " "0x%%08X Get:0x%%08X for table %%s"); @@ -3036,11 +2841,8 @@ void CS_HandleTableUpdate_Test_ResultsTableGetAddressErrorEEPROM(void) UT_SetDeferredRetcode(UT_KEY(CFE_TBL_GetAddress), 1, -1); /* Execute the function being tested */ - /* Note: first 2 arguments are passed in as addresses of pointers in the source code, even though the variable - types of the arguments are just pointers and the variable names of the arguments suggest that they're just - pointers */ - Result = CS_HandleTableUpdate(&CS_AppData.DefEepromTblPtr, &CS_AppData.ResEepromTblPtr, DefinitionTableHandle, - ResultsTableHandle, Table, NumEntries); + Result = + CS_HandleTableUpdate(&DefTblPtr, &ResultTblPtr, DefinitionTableHandle, ResultsTableHandle, Table, NumEntries); /* Verify results */ UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, CS_TBL_UPDATE_ERR_EID); @@ -3071,6 +2873,9 @@ void CS_HandleTableUpdate_Test_DefinitionTableGetAddressErrorEEPROM(void) int32 strCmpResult; char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH * 2]; + void *DefTblPtr = NULL; + void *ResultTblPtr = NULL; + snprintf(ExpectedEventString, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH * 2, "CS had problems updating table. Res Release: 0x%%08X Def Release:0x%%08X Res Manage:0x%%08X Def Manage: " "0x%%08X Get:0x%%08X for table %%s"); @@ -3080,11 +2885,8 @@ void CS_HandleTableUpdate_Test_DefinitionTableGetAddressErrorEEPROM(void) UT_SetDeferredRetcode(UT_KEY(CFE_TBL_GetAddress), 2, -1); /* Execute the function being tested */ - /* Note: first 2 arguments are passed in as addresses of pointers in the source code, even though the variable - types of the arguments are just pointers and the variable names of the arguments suggest that they're just - pointers */ - Result = CS_HandleTableUpdate(&CS_AppData.DefEepromTblPtr, &CS_AppData.ResEepromTblPtr, DefinitionTableHandle, - ResultsTableHandle, Table, NumEntries); + Result = + CS_HandleTableUpdate(&DefTblPtr, &ResultTblPtr, DefinitionTableHandle, ResultsTableHandle, Table, NumEntries); /* Verify results */ UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, CS_TBL_UPDATE_ERR_EID); @@ -3115,6 +2917,9 @@ void CS_HandleTableUpdate_Test_DefinitionTableGetAddressErrorMemory(void) int32 strCmpResult; char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH * 2]; + void *DefTblPtr = CS_AppData.DefMemoryTblPtr; + void *ResultTblPtr = CS_AppData.ResMemoryTblPtr; + snprintf(ExpectedEventString, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH * 2, "CS had problems updating table. Res Release: 0x%%08X Def Release:0x%%08X Res Manage:0x%%08X Def Manage: " "0x%%08X Get:0x%%08X for table %%s"); @@ -3124,11 +2929,8 @@ void CS_HandleTableUpdate_Test_DefinitionTableGetAddressErrorMemory(void) UT_SetDeferredRetcode(UT_KEY(CFE_TBL_GetAddress), 2, -1); /* Execute the function being tested */ - /* Note: first 2 arguments are passed in as addresses of pointers in the source code, even though the variable - types of the arguments are just pointers and the variable names of the arguments suggest that they're just - pointers */ - Result = CS_HandleTableUpdate(&CS_AppData.DefMemoryTblPtr, &CS_AppData.ResMemoryTblPtr, DefinitionTableHandle, - ResultsTableHandle, Table, NumEntries); + Result = + CS_HandleTableUpdate(&DefTblPtr, &ResultTblPtr, DefinitionTableHandle, ResultsTableHandle, Table, NumEntries); /* Verify results */ UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, CS_TBL_UPDATE_ERR_EID); @@ -3159,6 +2961,9 @@ void CS_HandleTableUpdate_Test_DefinitionTableGetAddressErrorTables(void) int32 strCmpResult; char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH * 2]; + void *DefTblPtr = CS_AppData.DefTablesTblPtr; + void *ResultTblPtr = CS_AppData.ResTablesTblPtr; + snprintf(ExpectedEventString, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH * 2, "CS had problems updating table. Res Release: 0x%%08X Def Release:0x%%08X Res Manage:0x%%08X Def Manage: " "0x%%08X Get:0x%%08X for table %%s"); @@ -3168,11 +2973,8 @@ void CS_HandleTableUpdate_Test_DefinitionTableGetAddressErrorTables(void) UT_SetDeferredRetcode(UT_KEY(CFE_TBL_GetAddress), 2, -1); /* Execute the function being tested */ - /* Note: first 2 arguments are passed in as addresses of pointers in the source code, even though the variable - types of the arguments are just pointers and the variable names of the arguments suggest that they're just - pointers */ - Result = CS_HandleTableUpdate(&CS_AppData.DefTablesTblPtr, &CS_AppData.ResTablesTblPtr, DefinitionTableHandle, - ResultsTableHandle, Table, NumEntries); + Result = + CS_HandleTableUpdate(&DefTblPtr, &ResultTblPtr, DefinitionTableHandle, ResultsTableHandle, Table, NumEntries); /* Verify results */ UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, CS_TBL_UPDATE_ERR_EID); @@ -3203,6 +3005,9 @@ void CS_HandleTableUpdate_Test_DefinitionTableGetAddressErrorApps(void) int32 strCmpResult; char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH * 2]; + void *DefTblPtr = CS_AppData.DefAppTblPtr; + void *ResultTblPtr = CS_AppData.ResAppTblPtr; + snprintf(ExpectedEventString, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH * 2, "CS had problems updating table. Res Release: 0x%%08X Def Release:0x%%08X Res Manage:0x%%08X Def Manage: " "0x%%08X Get:0x%%08X for table %%s"); @@ -3212,11 +3017,8 @@ void CS_HandleTableUpdate_Test_DefinitionTableGetAddressErrorApps(void) UT_SetDeferredRetcode(UT_KEY(CFE_TBL_GetAddress), 2, -1); /* Execute the function being tested */ - /* Note: first 2 arguments are passed in as addresses of pointers in the source code, even though the variable - types of the arguments are just pointers and the variable names of the arguments suggest that they're just - pointers */ - Result = CS_HandleTableUpdate(&CS_AppData.DefAppTblPtr, &CS_AppData.ResAppTblPtr, DefinitionTableHandle, - ResultsTableHandle, Table, NumEntries); + Result = + CS_HandleTableUpdate(&DefTblPtr, &ResultTblPtr, DefinitionTableHandle, ResultsTableHandle, Table, NumEntries); /* Verify results */ UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, CS_TBL_UPDATE_ERR_EID); @@ -3244,6 +3046,9 @@ void CS_HandleTableUpdate_Test_BadTableHandle(void) CFE_TBL_Handle_t ResultsTableHandle = 0; uint16 Table = CS_TABLES_TABLE; + void *DefTblPtr = CS_AppData.DefTablesTblPtr; + void *ResultTblPtr = CS_AppData.ResTablesTblPtr; + /* On 1st call, return CFE_SUCCESS to prevent error. On 2nd call, return UT_CFE_TBL_GETADDRESS_INDEX to satisfy * condition "Result == CFE_TBL_INFO_UPDATED". */ UT_SetDeferredRetcode(UT_KEY(CFE_TBL_GetAddress), 2, CFE_TBL_INFO_UPDATED); @@ -3252,11 +3057,8 @@ void CS_HandleTableUpdate_Test_BadTableHandle(void) CS_AppData.ResTablesTblPtr[0].IsCSOwner = true; /* Execute the function being tested */ - /* Note: first 2 arguments are passed in as addresses of pointers in the source code, even though the variable - types of the arguments are just pointers and the variable names of the arguments suggest that they're just - pointers */ - Result = CS_HandleTableUpdate(&CS_AppData.DefTablesTblPtr, &CS_AppData.ResTablesTblPtr, DefinitionTableHandle, - ResultsTableHandle, Table, CS_MAX_NUM_TABLES_TABLE_ENTRIES); + Result = CS_HandleTableUpdate(&DefTblPtr, &ResultTblPtr, DefinitionTableHandle, ResultsTableHandle, Table, + CS_MAX_NUM_TABLES_TABLE_ENTRIES); /* Verify results */ UtAssert_True(Result == CFE_SUCCESS, "Result == CFE_SUCCESS"); @@ -3275,6 +3077,9 @@ void CS_HandleTableUpdate_Test_CsOwner(void) CFE_TBL_Handle_t ResultsTableHandle = 0; uint16 Table = CS_TABLES_TABLE; + void *DefTblPtr = CS_AppData.DefTablesTblPtr; + void *ResultTblPtr = CS_AppData.ResTablesTblPtr; + /* On 1st call, return CFE_SUCCESS to prevent error. On 2nd call, return UT_CFE_TBL_GETADDRESS_INDEX to satisfy * condition "Result == CFE_TBL_INFO_UPDATED". */ UT_SetDeferredRetcode(UT_KEY(CFE_TBL_GetAddress), 2, CFE_TBL_INFO_UPDATED); @@ -3283,11 +3088,8 @@ void CS_HandleTableUpdate_Test_CsOwner(void) CS_AppData.ResTablesTblPtr[0].IsCSOwner = true; /* Execute the function being tested */ - /* Note: first 2 arguments are passed in as addresses of pointers in the source code, even though the variable - types of the arguments are just pointers and the variable names of the arguments suggest that they're just - pointers */ - Result = CS_HandleTableUpdate(&CS_AppData.DefTablesTblPtr, &CS_AppData.ResTablesTblPtr, DefinitionTableHandle, - ResultsTableHandle, Table, CS_MAX_NUM_TABLES_TABLE_ENTRIES); + Result = CS_HandleTableUpdate(&DefTblPtr, &ResultTblPtr, DefinitionTableHandle, ResultsTableHandle, Table, + CS_MAX_NUM_TABLES_TABLE_ENTRIES); /* Verify results */ UtAssert_True(Result == CFE_SUCCESS, "Result == CFE_SUCCESS"); @@ -3306,17 +3108,17 @@ void CS_HandleTableUpdate_Test_GetAddressError(void) CFE_TBL_Handle_t ResultsTableHandle = 0; uint16 Table = CS_TABLES_TABLE; + void *DefTblPtr = CS_AppData.DefTablesTblPtr; + void *ResultTblPtr = CS_AppData.ResTablesTblPtr; + UT_SetDeferredRetcode(UT_KEY(CFE_TBL_GetAddress), 1, 1); CS_AppData.ResTablesTblPtr[0].TblHandle = 99; CS_AppData.ResTablesTblPtr[0].IsCSOwner = true; /* Execute the function being tested */ - /* Note: first 2 arguments are passed in as addresses of pointers in the source code, even though the variable - types of the arguments are just pointers and the variable names of the arguments suggest that they're just - pointers */ - Result = CS_HandleTableUpdate(&CS_AppData.DefTablesTblPtr, &CS_AppData.ResTablesTblPtr, DefinitionTableHandle, - ResultsTableHandle, Table, CS_MAX_NUM_TABLES_TABLE_ENTRIES); + Result = CS_HandleTableUpdate(&DefTblPtr, &ResultTblPtr, DefinitionTableHandle, ResultsTableHandle, Table, + CS_MAX_NUM_TABLES_TABLE_ENTRIES); /* Verify results */ UtAssert_True(Result == 1, "Result == 1"); @@ -3327,6 +3129,25 @@ void CS_HandleTableUpdate_Test_GetAddressError(void) call_count_CFE_EVS_SendEvent); } +void CS_HandleTableUpdate_Test_InvalidTable(void) +{ + CFE_TBL_Handle_t DefinitionTableHandle = CFE_TBL_BAD_TABLE_HANDLE; + CFE_TBL_Handle_t ResultsTableHandle = CFE_TBL_BAD_TABLE_HANDLE; + uint16 Table = CS_NUM_TABLES + 1; + uint32 Temp1; + uint32 Temp2; + + void *DefTblPtr = &Temp1; + void *ResultTblPtr = &Temp2; + + UT_SetDeferredRetcode(UT_KEY(CFE_TBL_GetAddress), 2, CFE_TBL_INFO_UPDATED); + + /* Execute the function being tested */ + UtAssert_INT32_EQ( + CS_HandleTableUpdate(&DefTblPtr, &ResultTblPtr, DefinitionTableHandle, ResultsTableHandle, Table, 1), + CFE_SUCCESS); +} + void UtTest_Setup(void) { UtTest_Add(CS_ValidateEepromChecksumDefinitionTable_Test_Nominal, CS_Test_Setup, CS_Test_TearDown, @@ -3468,7 +3289,6 @@ void UtTest_Setup(void) "CS_TableInit_Test_TablesTableAndLoadedFromMemory"); UtTest_Add(CS_TableInit_Test_DefaultAndLoadedFromMemory, CS_Test_Setup, CS_Test_TearDown, "CS_TableInit_Test_DefaultAndLoadedFromMemory"); - UtTest_Add(CS_TableInit_Test_OpenCreateError, CS_Test_Setup, CS_Test_TearDown, "CS_TableInit_Test_OpenCreateError"); UtTest_Add(CS_HandleTableUpdate_Test_ProcessNewTablesDefinitionTable, CS_Test_Setup, CS_Test_TearDown, "CS_HandleTableUpdate_Test_ProcessNewTablesDefinitionTable"); @@ -3491,4 +3311,6 @@ void UtTest_Setup(void) UtTest_Add(CS_HandleTableUpdate_Test_CsOwner, CS_Test_Setup, CS_Test_TearDown, "CS_HandleTableUpdate_Test_CsOwner"); UtTest_Add(CS_HandleTableUpdate_Test_GetAddressError, CS_Test_Setup, CS_Test_TearDown, "CS_HandleTableUpdate_Test_GetAddressError"); + UtTest_Add(CS_HandleTableUpdate_Test_InvalidTable, CS_Test_Setup, CS_Test_TearDown, + "CS_HandleTableUpdate_Test_InvalidTable"); } diff --git a/unit-test/cs_utils_tests.c b/unit-test/cs_utils_tests.c index 5a8d52c..c37c126 100644 --- a/unit-test/cs_utils_tests.c +++ b/unit-test/cs_utils_tests.c @@ -233,7 +233,7 @@ void CS_FindEnabledEepromEntry_Test(void) /* Set up to find last entry (skip first) */ CS_AppData.ResEepromTblPtr[0].State = CS_STATE_ENABLED; CS_AppData.ResEepromTblPtr[CS_MAX_NUM_EEPROM_TABLE_ENTRIES - 1].State = CS_STATE_ENABLED; - CS_AppData.HkPacket.Payload.CurrentEntryInTable = 1; + CS_AppData.HkPacket.Payload.CurrentEntryInTable = 1; UtAssert_BOOL_TRUE(CS_FindEnabledEepromEntry(&EnabledEntry)); UtAssert_UINT16_EQ(CS_AppData.HkPacket.Payload.CurrentEntryInTable, CS_MAX_NUM_EEPROM_TABLE_ENTRIES - 1); @@ -254,7 +254,7 @@ void CS_FindEnabledMemoryEntry_Test(void) /* Set up to find last entry (skip first) */ CS_AppData.ResMemoryTblPtr[0].State = CS_STATE_ENABLED; CS_AppData.ResMemoryTblPtr[CS_MAX_NUM_MEMORY_TABLE_ENTRIES - 1].State = CS_STATE_ENABLED; - CS_AppData.HkPacket.Payload.CurrentEntryInTable = 1; + CS_AppData.HkPacket.Payload.CurrentEntryInTable = 1; UtAssert_BOOL_TRUE(CS_FindEnabledMemoryEntry(&EnabledEntry)); UtAssert_UINT16_EQ(CS_AppData.HkPacket.Payload.CurrentEntryInTable, CS_MAX_NUM_MEMORY_TABLE_ENTRIES - 1); @@ -275,7 +275,7 @@ void CS_FindEnabledTablesEntry_Test(void) /* Set up to find last entry (skip first) */ CS_AppData.ResTablesTblPtr[0].State = CS_STATE_ENABLED; CS_AppData.ResTablesTblPtr[CS_MAX_NUM_TABLES_TABLE_ENTRIES - 1].State = CS_STATE_ENABLED; - CS_AppData.HkPacket.Payload.CurrentEntryInTable = 1; + CS_AppData.HkPacket.Payload.CurrentEntryInTable = 1; UtAssert_BOOL_TRUE(CS_FindEnabledTablesEntry(&EnabledEntry)); UtAssert_UINT16_EQ(CS_AppData.HkPacket.Payload.CurrentEntryInTable, CS_MAX_NUM_TABLES_TABLE_ENTRIES - 1); @@ -296,7 +296,7 @@ void CS_FindEnabledAppEntry_Test(void) /* Set up to find last entry (skip first) */ CS_AppData.ResAppTblPtr[0].State = CS_STATE_ENABLED; CS_AppData.ResAppTblPtr[CS_MAX_NUM_APP_TABLE_ENTRIES - 1].State = CS_STATE_ENABLED; - CS_AppData.HkPacket.Payload.CurrentEntryInTable = 1; + CS_AppData.HkPacket.Payload.CurrentEntryInTable = 1; UtAssert_BOOL_TRUE(CS_FindEnabledAppEntry(&EnabledEntry)); UtAssert_UINT16_EQ(CS_AppData.HkPacket.Payload.CurrentEntryInTable, CS_MAX_NUM_APP_TABLE_ENTRIES - 1); @@ -340,7 +340,7 @@ void CS_BackgroundCfeCore_Test(void) /* Segment disabled */ CS_AppData.HkPacket.Payload.CfeCoreCSState = CS_STATE_ENABLED; - CS_AppData.CfeCoreCodeSeg.State = CS_STATE_DISABLED; + CS_AppData.CfeCoreCodeSeg.State = CS_STATE_DISABLED; UtAssert_BOOL_FALSE(CS_BackgroundCfeCore()); UtAssert_UINT16_EQ(CS_AppData.HkPacket.Payload.CurrentEntryInTable, 0); UtAssert_UINT16_EQ(CS_AppData.HkPacket.Payload.CurrentCSTable, 2); @@ -374,7 +374,7 @@ void CS_BackgroundOS_Test(void) /* Segment disabled */ CS_AppData.HkPacket.Payload.OSCSState = CS_STATE_ENABLED; - CS_AppData.OSCodeSeg.State = CS_STATE_DISABLED; + CS_AppData.OSCodeSeg.State = CS_STATE_DISABLED; UtAssert_BOOL_FALSE(CS_BackgroundOS()); UtAssert_UINT16_EQ(CS_AppData.HkPacket.Payload.CurrentEntryInTable, 0); UtAssert_UINT16_EQ(CS_AppData.HkPacket.Payload.CurrentCSTable, 2); @@ -407,7 +407,7 @@ void CS_BackgroundEeprom_Test(void) UtAssert_UINT16_EQ(CS_AppData.HkPacket.Payload.CurrentCSTable, 1); /* All entries disabled */ - CS_AppData.HkPacket.Payload.EepromCSState = CS_STATE_ENABLED; + CS_AppData.HkPacket.Payload.EepromCSState = CS_STATE_ENABLED; CS_AppData.ResEepromTblPtr[0].ComparisonValue = 1; CS_AppData.ResEepromTblPtr[1].ComparisonValue = 2; UtAssert_BOOL_FALSE(CS_BackgroundEeprom()); @@ -426,8 +426,8 @@ void CS_BackgroundEeprom_Test(void) UtAssert_UINT16_EQ(CS_AppData.HkPacket.Payload.CurrentCSTable, 2); /* Last entry, Enabled, compares, done with entry */ - CS_AppData.HkPacket.Payload.CurrentEntryInTable = CS_MAX_NUM_EEPROM_TABLE_ENTRIES - 1; - CS_AppData.ResEepromTblPtr[CS_AppData.HkPacket.Payload.CurrentEntryInTable].State = CS_STATE_ENABLED; + CS_AppData.HkPacket.Payload.CurrentEntryInTable = CS_MAX_NUM_EEPROM_TABLE_ENTRIES - 1; + CS_AppData.ResEepromTblPtr[CS_AppData.HkPacket.Payload.CurrentEntryInTable].State = CS_STATE_ENABLED; CS_AppData.ResEepromTblPtr[CS_AppData.HkPacket.Payload.CurrentEntryInTable].ComparisonValue = 3; UT_SetHandlerFunction(UT_KEY(CS_ComputeEepromMemory), CS_UTILS_TEST_CS_ComputeHandler, NULL); UtAssert_BOOL_TRUE(CS_BackgroundEeprom()); @@ -463,7 +463,7 @@ void CS_BackgroundMemory_Test(void) UtAssert_UINT16_EQ(CS_AppData.HkPacket.Payload.CurrentCSTable, 2); /* Last entry, Enabled, compares, done with entry */ - CS_AppData.HkPacket.Payload.CurrentEntryInTable = CS_MAX_NUM_MEMORY_TABLE_ENTRIES - 1; + CS_AppData.HkPacket.Payload.CurrentEntryInTable = CS_MAX_NUM_MEMORY_TABLE_ENTRIES - 1; CS_AppData.ResMemoryTblPtr[CS_AppData.HkPacket.Payload.CurrentEntryInTable].State = CS_STATE_ENABLED; UT_SetHandlerFunction(UT_KEY(CS_ComputeEepromMemory), CS_UTILS_TEST_CS_ComputeHandler, NULL); UtAssert_BOOL_TRUE(CS_BackgroundMemory()); @@ -507,7 +507,7 @@ void CS_BackgroundTables_Test(void) UtAssert_UINT16_EQ(CS_AppData.HkPacket.Payload.CurrentCSTable, 2); /* Last entry, Enabled, compares, done with entry */ - CS_AppData.HkPacket.Payload.CurrentEntryInTable = CS_MAX_NUM_TABLES_TABLE_ENTRIES - 1; + CS_AppData.HkPacket.Payload.CurrentEntryInTable = CS_MAX_NUM_TABLES_TABLE_ENTRIES - 1; CS_AppData.ResTablesTblPtr[CS_AppData.HkPacket.Payload.CurrentEntryInTable].State = CS_STATE_ENABLED; UT_SetHandlerFunction(UT_KEY(CS_ComputeTables), CS_UTILS_TEST_CS_ComputeHandler, NULL); UtAssert_BOOL_TRUE(CS_BackgroundTables()); @@ -705,6 +705,17 @@ void CS_CheckRecomputeOneShot_Test(void) UtAssert_UINT8_EQ(CS_AppData.HkPacket.Payload.CmdErrCounter, 2); } +void CS_GetTableTypeAsString_Test(void) +{ + uint32 i; + + /* Just call the function with every table type, it should never return NULL */ + for (i = 0; i <= CS_NUM_TABLES; ++i) + { + UtAssert_NOT_NULL(CS_GetTableTypeAsString(i)); + } +} + void UtTest_Setup(void) { UtTest_Add(CS_ZeroEepromTempValues_Test, CS_Test_Setup, CS_Test_TearDown, "CS_ZeroEepromTempValues_Test"); @@ -734,4 +745,5 @@ void UtTest_Setup(void) UtTest_Add(CS_HandleRoutineTableUpdates_Test, CS_Test_Setup, CS_Test_TearDown, "CS_HandleRoutineTableUpdates_Test"); UtTest_Add(CS_AttemptTableReshare_Test, CS_Test_Setup, CS_Test_TearDown, "CS_AttemptTableReshare_Test"); UtTest_Add(CS_CheckRecomputeOneShot_Test, CS_Test_Setup, CS_Test_TearDown, "CS_CheckRecomputeOneShot_Test"); + UtTest_Add(CS_GetTableTypeAsString_Test, CS_Test_Setup, CS_Test_TearDown, "CS_GetTableTypeAsString_Test"); } diff --git a/unit-test/stubs/cs_app_cmds_stubs.c b/unit-test/stubs/cs_app_cmds_stubs.c index 91f18ea..ce747d5 100644 --- a/unit-test/stubs/cs_app_cmds_stubs.c +++ b/unit-test/stubs/cs_app_cmds_stubs.c @@ -17,49 +17,83 @@ * limitations under the License. ************************************************************************/ -/* - * Includes +/** + * @file + * + * Auto-Generated stub implementations for functions defined in cs_app_cmds header */ #include "cs_app_cmds.h" +#include "utgenstub.h" -/* UT includes */ -#include "uttest.h" -#include "utassert.h" -#include "utstubs.h" - +/* + * ---------------------------------------------------- + * Generated stub function for CS_DisableAppCmd() + * ---------------------------------------------------- + */ void CS_DisableAppCmd(const CS_NoArgsCmd_t *CmdPtr) { - UT_Stub_RegisterContext(UT_KEY(CS_DisableAppCmd), CmdPtr); - UT_DEFAULT_IMPL(CS_DisableAppCmd); + UT_GenStub_AddParam(CS_DisableAppCmd, const CS_NoArgsCmd_t *, CmdPtr); + + UT_GenStub_Execute(CS_DisableAppCmd, Basic, NULL); } -void CS_EnableAppCmd(const CS_NoArgsCmd_t *CmdPtr) +/* + * ---------------------------------------------------- + * Generated stub function for CS_DisableNameAppCmd() + * ---------------------------------------------------- + */ +void CS_DisableNameAppCmd(const CS_AppNameCmd_t *CmdPtr) { - UT_Stub_RegisterContext(UT_KEY(CS_EnableAppCmd), CmdPtr); - UT_DEFAULT_IMPL(CS_EnableAppCmd); + UT_GenStub_AddParam(CS_DisableNameAppCmd, const CS_AppNameCmd_t *, CmdPtr); + + UT_GenStub_Execute(CS_DisableNameAppCmd, Basic, NULL); } -void CS_ReportBaselineAppCmd(const CS_AppNameCmd_t *CmdPtr) +/* + * ---------------------------------------------------- + * Generated stub function for CS_EnableAppCmd() + * ---------------------------------------------------- + */ +void CS_EnableAppCmd(const CS_NoArgsCmd_t *CmdPtr) { - UT_Stub_RegisterContext(UT_KEY(CS_ReportBaselineAppCmd), CmdPtr); - UT_DEFAULT_IMPL(CS_ReportBaselineAppCmd); + UT_GenStub_AddParam(CS_EnableAppCmd, const CS_NoArgsCmd_t *, CmdPtr); + + UT_GenStub_Execute(CS_EnableAppCmd, Basic, NULL); } -void CS_RecomputeBaselineAppCmd(const CS_AppNameCmd_t *CmdPtr) +/* + * ---------------------------------------------------- + * Generated stub function for CS_EnableNameAppCmd() + * ---------------------------------------------------- + */ +void CS_EnableNameAppCmd(const CS_AppNameCmd_t *CmdPtr) { - UT_Stub_RegisterContext(UT_KEY(CS_RecomputeBaselineAppCmd), CmdPtr); - UT_DEFAULT_IMPL(CS_RecomputeBaselineAppCmd); + UT_GenStub_AddParam(CS_EnableNameAppCmd, const CS_AppNameCmd_t *, CmdPtr); + + UT_GenStub_Execute(CS_EnableNameAppCmd, Basic, NULL); } -void CS_DisableNameAppCmd(const CS_AppNameCmd_t *CmdPtr) +/* + * ---------------------------------------------------- + * Generated stub function for CS_RecomputeBaselineAppCmd() + * ---------------------------------------------------- + */ +void CS_RecomputeBaselineAppCmd(const CS_AppNameCmd_t *CmdPtr) { - UT_Stub_RegisterContext(UT_KEY(CS_DisableNameAppCmd), CmdPtr); - UT_DEFAULT_IMPL(CS_DisableNameAppCmd); + UT_GenStub_AddParam(CS_RecomputeBaselineAppCmd, const CS_AppNameCmd_t *, CmdPtr); + + UT_GenStub_Execute(CS_RecomputeBaselineAppCmd, Basic, NULL); } -void CS_EnableNameAppCmd(const CS_AppNameCmd_t *CmdPtr) +/* + * ---------------------------------------------------- + * Generated stub function for CS_ReportBaselineAppCmd() + * ---------------------------------------------------- + */ +void CS_ReportBaselineAppCmd(const CS_AppNameCmd_t *CmdPtr) { - UT_Stub_RegisterContext(UT_KEY(CS_EnableNameAppCmd), CmdPtr); - UT_DEFAULT_IMPL(CS_EnableNameAppCmd); + UT_GenStub_AddParam(CS_ReportBaselineAppCmd, const CS_AppNameCmd_t *, CmdPtr); + + UT_GenStub_Execute(CS_ReportBaselineAppCmd, Basic, NULL); } diff --git a/unit-test/stubs/cs_app_stubs.c b/unit-test/stubs/cs_app_stubs.c index 492d6e8..fd08536 100644 --- a/unit-test/stubs/cs_app_stubs.c +++ b/unit-test/stubs/cs_app_stubs.c @@ -17,22 +17,101 @@ * limitations under the License. ************************************************************************/ -/* - * Includes +/** + * @file + * + * Auto-Generated stub implementations for functions defined in cs_app header */ #include "cs_app.h" +#include "utgenstub.h" + +/* + * ---------------------------------------------------- + * Generated stub function for CS_AppInit() + * ---------------------------------------------------- + */ +CFE_Status_t CS_AppInit(void) +{ + UT_GenStub_SetupReturnBuffer(CS_AppInit, CFE_Status_t); + + UT_GenStub_Execute(CS_AppInit, Basic, NULL); + + return UT_GenStub_GetReturnValue(CS_AppInit, CFE_Status_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for CS_AppMain() + * ---------------------------------------------------- + */ +void CS_AppMain(void) +{ -/* UT includes */ -#include "uttest.h" -#include "utassert.h" -#include "utstubs.h" + UT_GenStub_Execute(CS_AppMain, Basic, NULL); +} -CS_AppData_t CS_AppData; +/* + * ---------------------------------------------------- + * Generated stub function for CS_AppPipe() + * ---------------------------------------------------- + */ +CFE_Status_t CS_AppPipe(const CFE_SB_Buffer_t *BufPtr) +{ + UT_GenStub_SetupReturnBuffer(CS_AppPipe, CFE_Status_t); -#if (CS_PRESERVE_STATES_ON_PROCESSOR_RESET == true) + UT_GenStub_AddParam(CS_AppPipe, const CFE_SB_Buffer_t *, BufPtr); + + UT_GenStub_Execute(CS_AppPipe, Basic, NULL); + + return UT_GenStub_GetReturnValue(CS_AppPipe, CFE_Status_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for CS_CreateRestoreStatesFromCDS() + * ---------------------------------------------------- + */ +CFE_Status_t CS_CreateRestoreStatesFromCDS(void) +{ + UT_GenStub_SetupReturnBuffer(CS_CreateRestoreStatesFromCDS, CFE_Status_t); + + UT_GenStub_Execute(CS_CreateRestoreStatesFromCDS, Basic, NULL); + + return UT_GenStub_GetReturnValue(CS_CreateRestoreStatesFromCDS, CFE_Status_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for CS_HousekeepingCmd() + * ---------------------------------------------------- + */ +void CS_HousekeepingCmd(const CS_NoArgsCmd_t *CmdPtr) +{ + UT_GenStub_AddParam(CS_HousekeepingCmd, const CS_NoArgsCmd_t *, CmdPtr); + + UT_GenStub_Execute(CS_HousekeepingCmd, Basic, NULL); +} + +/* + * ---------------------------------------------------- + * Generated stub function for CS_ProcessCmd() + * ---------------------------------------------------- + */ +void CS_ProcessCmd(const CFE_SB_Buffer_t *BufPtr) +{ + UT_GenStub_AddParam(CS_ProcessCmd, const CFE_SB_Buffer_t *, BufPtr); + + UT_GenStub_Execute(CS_ProcessCmd, Basic, NULL); +} + +/* + * ---------------------------------------------------- + * Generated stub function for CS_UpdateCDS() + * ---------------------------------------------------- + */ void CS_UpdateCDS(void) { - UT_DEFAULT_IMPL(CS_UpdateCDS); + + UT_GenStub_Execute(CS_UpdateCDS, Basic, NULL); } -#endif /* #if (CS_PRESERVE_STATES_ON_PROCESSOR_RESET == true) */ diff --git a/unit-test/stubs/cs_appdata_global_stub.c b/unit-test/stubs/cs_appdata_global_stub.c new file mode 100644 index 0000000..a7938ac --- /dev/null +++ b/unit-test/stubs/cs_appdata_global_stub.c @@ -0,0 +1,31 @@ +/************************************************************************ + * NASA Docket No. GSC-18,915-1, and identified as “cFS Checksum + * Application version 2.5.1” + * + * Copyright (c) 2021 United States Government as represented by the + * Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ************************************************************************/ + +/* + * Includes + */ + +#include "cs_app.h" + +/* UT includes */ +#include "uttest.h" +#include "utassert.h" +#include "utstubs.h" + +CS_AppData_t CS_AppData; diff --git a/unit-test/stubs/cs_cmds_stubs.c b/unit-test/stubs/cs_cmds_stubs.c index 6ac351b..760e9ba 100644 --- a/unit-test/stubs/cs_cmds_stubs.c +++ b/unit-test/stubs/cs_cmds_stubs.c @@ -17,104 +17,191 @@ * limitations under the License. ************************************************************************/ -/* - * Includes +/** + * @file + * + * Auto-Generated stub implementations for functions defined in cs_cmds header */ -#include "cfe.h" #include "cs_cmds.h" +#include "utgenstub.h" -/* UT includes */ -#include "uttest.h" -#include "utassert.h" -#include "utstubs.h" - -void CS_NoopCmd(const CS_NoArgsCmd_t *CmdPtr) +/* + * ---------------------------------------------------- + * Generated stub function for CS_BackgroundCheckCycle() + * ---------------------------------------------------- + */ +void CS_BackgroundCheckCycle(const CS_NoArgsCmd_t *CmdPtr) { - UT_Stub_RegisterContext(UT_KEY(CS_NoopCmd), CmdPtr); - UT_DEFAULT_IMPL(CS_NoopCmd); -} + UT_GenStub_AddParam(CS_BackgroundCheckCycle, const CS_NoArgsCmd_t *, CmdPtr); -void CS_ResetCmd(const CS_NoArgsCmd_t *CmdPtr) -{ - UT_Stub_RegisterContext(UT_KEY(CS_ResetCmd), CmdPtr); - UT_DEFAULT_IMPL(CS_ResetCmd); + UT_GenStub_Execute(CS_BackgroundCheckCycle, Basic, NULL); } -void CS_BackgroundCheckCycle(const CS_NoArgsCmd_t *CmdPtr) +/* + * ---------------------------------------------------- + * Generated stub function for CS_CancelOneShotCmd() + * ---------------------------------------------------- + */ +void CS_CancelOneShotCmd(const CS_NoArgsCmd_t *CmdPtr) { - UT_Stub_RegisterContext(UT_KEY(CS_BackgroundCheckCycle), CmdPtr); - UT_DEFAULT_IMPL(CS_BackgroundCheckCycle); + UT_GenStub_AddParam(CS_CancelOneShotCmd, const CS_NoArgsCmd_t *, CmdPtr); + + UT_GenStub_Execute(CS_CancelOneShotCmd, Basic, NULL); } +/* + * ---------------------------------------------------- + * Generated stub function for CS_DisableAllCSCmd() + * ---------------------------------------------------- + */ void CS_DisableAllCSCmd(const CS_NoArgsCmd_t *CmdPtr) { - UT_Stub_RegisterContext(UT_KEY(CS_DisableAllCSCmd), CmdPtr); - UT_DEFAULT_IMPL(CS_DisableAllCSCmd); + UT_GenStub_AddParam(CS_DisableAllCSCmd, const CS_NoArgsCmd_t *, CmdPtr); + + UT_GenStub_Execute(CS_DisableAllCSCmd, Basic, NULL); } -void CS_EnableAllCSCmd(const CS_NoArgsCmd_t *CmdPtr) +/* + * ---------------------------------------------------- + * Generated stub function for CS_DisableCfeCoreCmd() + * ---------------------------------------------------- + */ +void CS_DisableCfeCoreCmd(const CS_NoArgsCmd_t *CmdPtr) { - UT_Stub_RegisterContext(UT_KEY(CS_EnableAllCSCmd), CmdPtr); - UT_DEFAULT_IMPL(CS_EnableAllCSCmd); + UT_GenStub_AddParam(CS_DisableCfeCoreCmd, const CS_NoArgsCmd_t *, CmdPtr); + + UT_GenStub_Execute(CS_DisableCfeCoreCmd, Basic, NULL); } -void CS_DisableCfeCoreCmd(const CS_NoArgsCmd_t *CmdPtr) +/* + * ---------------------------------------------------- + * Generated stub function for CS_DisableOSCmd() + * ---------------------------------------------------- + */ +void CS_DisableOSCmd(const CS_NoArgsCmd_t *CmdPtr) { - UT_Stub_RegisterContext(UT_KEY(CS_DisableCfeCoreCmd), CmdPtr); - UT_DEFAULT_IMPL(CS_DisableCfeCoreCmd); + UT_GenStub_AddParam(CS_DisableOSCmd, const CS_NoArgsCmd_t *, CmdPtr); + + UT_GenStub_Execute(CS_DisableOSCmd, Basic, NULL); } -void CS_EnableCfeCoreCmd(const CS_NoArgsCmd_t *CmdPtr) +/* + * ---------------------------------------------------- + * Generated stub function for CS_EnableAllCSCmd() + * ---------------------------------------------------- + */ +void CS_EnableAllCSCmd(const CS_NoArgsCmd_t *CmdPtr) { - UT_Stub_RegisterContext(UT_KEY(CS_EnableCfeCoreCmd), CmdPtr); - UT_DEFAULT_IMPL(CS_EnableCfeCoreCmd); + UT_GenStub_AddParam(CS_EnableAllCSCmd, const CS_NoArgsCmd_t *, CmdPtr); + + UT_GenStub_Execute(CS_EnableAllCSCmd, Basic, NULL); } -void CS_DisableOSCmd(const CS_NoArgsCmd_t *CmdPtr) +/* + * ---------------------------------------------------- + * Generated stub function for CS_EnableCfeCoreCmd() + * ---------------------------------------------------- + */ +void CS_EnableCfeCoreCmd(const CS_NoArgsCmd_t *CmdPtr) { - UT_Stub_RegisterContext(UT_KEY(CS_DisableOSCmd), CmdPtr); - UT_DEFAULT_IMPL(CS_DisableOSCmd); + UT_GenStub_AddParam(CS_EnableCfeCoreCmd, const CS_NoArgsCmd_t *, CmdPtr); + + UT_GenStub_Execute(CS_EnableCfeCoreCmd, Basic, NULL); } +/* + * ---------------------------------------------------- + * Generated stub function for CS_EnableOSCmd() + * ---------------------------------------------------- + */ void CS_EnableOSCmd(const CS_NoArgsCmd_t *CmdPtr) { - UT_Stub_RegisterContext(UT_KEY(CS_EnableOSCmd), CmdPtr); - UT_DEFAULT_IMPL(CS_EnableOSCmd); + UT_GenStub_AddParam(CS_EnableOSCmd, const CS_NoArgsCmd_t *, CmdPtr); + + UT_GenStub_Execute(CS_EnableOSCmd, Basic, NULL); } -void CS_ReportBaselineCfeCoreCmd(const CS_NoArgsCmd_t *CmdPtr) +/* + * ---------------------------------------------------- + * Generated stub function for CS_NoopCmd() + * ---------------------------------------------------- + */ +void CS_NoopCmd(const CS_NoArgsCmd_t *CmdPtr) { - UT_Stub_RegisterContext(UT_KEY(CS_ReportBaselineCfeCoreCmd), CmdPtr); - UT_DEFAULT_IMPL(CS_ReportBaselineCfeCoreCmd); + UT_GenStub_AddParam(CS_NoopCmd, const CS_NoArgsCmd_t *, CmdPtr); + + UT_GenStub_Execute(CS_NoopCmd, Basic, NULL); } -void CS_ReportBaselineOSCmd(const CS_NoArgsCmd_t *CmdPtr) +/* + * ---------------------------------------------------- + * Generated stub function for CS_OneShotCmd() + * ---------------------------------------------------- + */ +void CS_OneShotCmd(const CS_OneShotCmd_t *CmdPtr) { - UT_Stub_RegisterContext(UT_KEY(CS_ReportBaselineOSCmd), CmdPtr); - UT_DEFAULT_IMPL(CS_ReportBaselineOSCmd); + UT_GenStub_AddParam(CS_OneShotCmd, const CS_OneShotCmd_t *, CmdPtr); + + UT_GenStub_Execute(CS_OneShotCmd, Basic, NULL); } +/* + * ---------------------------------------------------- + * Generated stub function for CS_RecomputeBaselineCfeCoreCmd() + * ---------------------------------------------------- + */ void CS_RecomputeBaselineCfeCoreCmd(const CS_NoArgsCmd_t *CmdPtr) { - UT_Stub_RegisterContext(UT_KEY(CS_RecomputeBaselineCfeCoreCmd), CmdPtr); - UT_DEFAULT_IMPL(CS_RecomputeBaselineCfeCoreCmd); + UT_GenStub_AddParam(CS_RecomputeBaselineCfeCoreCmd, const CS_NoArgsCmd_t *, CmdPtr); + + UT_GenStub_Execute(CS_RecomputeBaselineCfeCoreCmd, Basic, NULL); } +/* + * ---------------------------------------------------- + * Generated stub function for CS_RecomputeBaselineOSCmd() + * ---------------------------------------------------- + */ void CS_RecomputeBaselineOSCmd(const CS_NoArgsCmd_t *CmdPtr) { - UT_Stub_RegisterContext(UT_KEY(CS_RecomputeBaselineOSCmd), CmdPtr); - UT_DEFAULT_IMPL(CS_RecomputeBaselineOSCmd); + UT_GenStub_AddParam(CS_RecomputeBaselineOSCmd, const CS_NoArgsCmd_t *, CmdPtr); + + UT_GenStub_Execute(CS_RecomputeBaselineOSCmd, Basic, NULL); } -void CS_OneShotCmd(const CS_OneShotCmd_t *CmdPtr) +/* + * ---------------------------------------------------- + * Generated stub function for CS_ReportBaselineCfeCoreCmd() + * ---------------------------------------------------- + */ +void CS_ReportBaselineCfeCoreCmd(const CS_NoArgsCmd_t *CmdPtr) { - UT_Stub_RegisterContext(UT_KEY(CS_OneShotCmd), CmdPtr); - UT_DEFAULT_IMPL(CS_OneShotCmd); + UT_GenStub_AddParam(CS_ReportBaselineCfeCoreCmd, const CS_NoArgsCmd_t *, CmdPtr); + + UT_GenStub_Execute(CS_ReportBaselineCfeCoreCmd, Basic, NULL); } -void CS_CancelOneShotCmd(const CS_NoArgsCmd_t *CmdPtr) +/* + * ---------------------------------------------------- + * Generated stub function for CS_ReportBaselineOSCmd() + * ---------------------------------------------------- + */ +void CS_ReportBaselineOSCmd(const CS_NoArgsCmd_t *CmdPtr) { - UT_Stub_RegisterContext(UT_KEY(CS_CancelOneShotCmd), CmdPtr); - UT_DEFAULT_IMPL(CS_CancelOneShotCmd); + UT_GenStub_AddParam(CS_ReportBaselineOSCmd, const CS_NoArgsCmd_t *, CmdPtr); + + UT_GenStub_Execute(CS_ReportBaselineOSCmd, Basic, NULL); +} + +/* + * ---------------------------------------------------- + * Generated stub function for CS_ResetCmd() + * ---------------------------------------------------- + */ +void CS_ResetCmd(const CS_NoArgsCmd_t *CmdPtr) +{ + UT_GenStub_AddParam(CS_ResetCmd, const CS_NoArgsCmd_t *, CmdPtr); + + UT_GenStub_Execute(CS_ResetCmd, Basic, NULL); } diff --git a/unit-test/stubs/cs_compute_stubs.c b/unit-test/stubs/cs_compute_stubs.c index 4bd7e1b..111ab5c 100644 --- a/unit-test/stubs/cs_compute_stubs.c +++ b/unit-test/stubs/cs_compute_stubs.c @@ -17,61 +17,110 @@ * limitations under the License. ************************************************************************/ -/* - * Includes +/** + * @file + * + * Auto-Generated stub implementations for functions defined in cs_compute header */ #include "cs_compute.h" +#include "utgenstub.h" + +/* + * ---------------------------------------------------- + * Generated stub function for CS_ComputeApp() + * ---------------------------------------------------- + */ +CFE_Status_t CS_ComputeApp(CS_Res_App_Table_Entry_t *ResultsEntry, uint32 *ComputedCSValue, bool *DoneWithEntry) +{ + UT_GenStub_SetupReturnBuffer(CS_ComputeApp, CFE_Status_t); + + UT_GenStub_AddParam(CS_ComputeApp, CS_Res_App_Table_Entry_t *, ResultsEntry); + UT_GenStub_AddParam(CS_ComputeApp, uint32 *, ComputedCSValue); + UT_GenStub_AddParam(CS_ComputeApp, bool *, DoneWithEntry); -/* UT includes */ -#include "uttest.h" -#include "utassert.h" -#include "utstubs.h" + UT_GenStub_Execute(CS_ComputeApp, Basic, NULL); + + return UT_GenStub_GetReturnValue(CS_ComputeApp, CFE_Status_t); +} +/* + * ---------------------------------------------------- + * Generated stub function for CS_ComputeEepromMemory() + * ---------------------------------------------------- + */ CFE_Status_t CS_ComputeEepromMemory(CS_Res_EepromMemory_Table_Entry_t *ResultsEntry, uint32 *ComputedCSValue, bool *DoneWithEntry) { - UT_Stub_RegisterContext(UT_KEY(CS_ComputeEepromMemory), ResultsEntry); - UT_Stub_RegisterContext(UT_KEY(CS_ComputeEepromMemory), ComputedCSValue); - UT_Stub_RegisterContext(UT_KEY(CS_ComputeEepromMemory), DoneWithEntry); + UT_GenStub_SetupReturnBuffer(CS_ComputeEepromMemory, CFE_Status_t); + + UT_GenStub_AddParam(CS_ComputeEepromMemory, CS_Res_EepromMemory_Table_Entry_t *, ResultsEntry); + UT_GenStub_AddParam(CS_ComputeEepromMemory, uint32 *, ComputedCSValue); + UT_GenStub_AddParam(CS_ComputeEepromMemory, bool *, DoneWithEntry); - return UT_DEFAULT_IMPL(CS_ComputeEepromMemory); + UT_GenStub_Execute(CS_ComputeEepromMemory, Basic, NULL); + + return UT_GenStub_GetReturnValue(CS_ComputeEepromMemory, CFE_Status_t); } +/* + * ---------------------------------------------------- + * Generated stub function for CS_ComputeTables() + * ---------------------------------------------------- + */ CFE_Status_t CS_ComputeTables(CS_Res_Tables_Table_Entry_t *ResultsEntry, uint32 *ComputedCSValue, bool *DoneWithEntry) { - UT_Stub_RegisterContext(UT_KEY(CS_ComputeTables), ResultsEntry); - UT_Stub_RegisterContext(UT_KEY(CS_ComputeTables), ComputedCSValue); - UT_Stub_RegisterContext(UT_KEY(CS_ComputeTables), DoneWithEntry); + UT_GenStub_SetupReturnBuffer(CS_ComputeTables, CFE_Status_t); - return UT_DEFAULT_IMPL(CS_ComputeTables); -} + UT_GenStub_AddParam(CS_ComputeTables, CS_Res_Tables_Table_Entry_t *, ResultsEntry); + UT_GenStub_AddParam(CS_ComputeTables, uint32 *, ComputedCSValue); + UT_GenStub_AddParam(CS_ComputeTables, bool *, DoneWithEntry); -CFE_Status_t CS_ComputeApp(CS_Res_App_Table_Entry_t *ResultsEntry, uint32 *ComputedCSValue, bool *DoneWithEntry) -{ - UT_Stub_RegisterContext(UT_KEY(CS_ComputeApp), ResultsEntry); - UT_Stub_RegisterContext(UT_KEY(CS_ComputeApp), ComputedCSValue); - UT_Stub_RegisterContext(UT_KEY(CS_ComputeApp), DoneWithEntry); + UT_GenStub_Execute(CS_ComputeTables, Basic, NULL); - return UT_DEFAULT_IMPL(CS_ComputeApp); + return UT_GenStub_GetReturnValue(CS_ComputeTables, CFE_Status_t); } -void CS_RecomputeEepromMemoryChildTask(void) +/* + * ---------------------------------------------------- + * Generated stub function for CS_OneShotChildTask() + * ---------------------------------------------------- + */ +void CS_OneShotChildTask(void) { - UT_DEFAULT_IMPL(CS_RecomputeEepromMemoryChildTask); + + UT_GenStub_Execute(CS_OneShotChildTask, Basic, NULL); } -void CS_RecomputeTablesChildTask(void) +/* + * ---------------------------------------------------- + * Generated stub function for CS_RecomputeAppChildTask() + * ---------------------------------------------------- + */ +void CS_RecomputeAppChildTask(void) { - UT_DEFAULT_IMPL(CS_RecomputeTablesChildTask); + + UT_GenStub_Execute(CS_RecomputeAppChildTask, Basic, NULL); } -void CS_RecomputeAppChildTask(void) +/* + * ---------------------------------------------------- + * Generated stub function for CS_RecomputeEepromMemoryChildTask() + * ---------------------------------------------------- + */ +void CS_RecomputeEepromMemoryChildTask(void) { - UT_DEFAULT_IMPL(CS_RecomputeAppChildTask); + + UT_GenStub_Execute(CS_RecomputeEepromMemoryChildTask, Basic, NULL); } -void CS_OneShotChildTask(void) +/* + * ---------------------------------------------------- + * Generated stub function for CS_RecomputeTablesChildTask() + * ---------------------------------------------------- + */ +void CS_RecomputeTablesChildTask(void) { - UT_DEFAULT_IMPL(CS_OneShotChildTask); + + UT_GenStub_Execute(CS_RecomputeTablesChildTask, Basic, NULL); } diff --git a/unit-test/stubs/cs_eeprom_cmds_stubs.c b/unit-test/stubs/cs_eeprom_cmds_stubs.c index d33b89d..372f9c8 100644 --- a/unit-test/stubs/cs_eeprom_cmds_stubs.c +++ b/unit-test/stubs/cs_eeprom_cmds_stubs.c @@ -17,55 +17,95 @@ * limitations under the License. ************************************************************************/ -/* - * Includes +/** + * @file + * + * Auto-Generated stub implementations for functions defined in cs_eeprom_cmds header */ #include "cs_eeprom_cmds.h" +#include "utgenstub.h" -/* UT includes */ -#include "uttest.h" -#include "utassert.h" -#include "utstubs.h" - +/* + * ---------------------------------------------------- + * Generated stub function for CS_DisableEepromCmd() + * ---------------------------------------------------- + */ void CS_DisableEepromCmd(const CS_NoArgsCmd_t *CmdPtr) { - UT_Stub_RegisterContext(UT_KEY(CS_DisableEepromCmd), CmdPtr); - UT_DEFAULT_IMPL(CS_DisableEepromCmd); + UT_GenStub_AddParam(CS_DisableEepromCmd, const CS_NoArgsCmd_t *, CmdPtr); + + UT_GenStub_Execute(CS_DisableEepromCmd, Basic, NULL); } -void CS_EnableEepromCmd(const CS_NoArgsCmd_t *CmdPtr) +/* + * ---------------------------------------------------- + * Generated stub function for CS_DisableEntryIDEepromCmd() + * ---------------------------------------------------- + */ +void CS_DisableEntryIDEepromCmd(const CS_EntryCmd_t *CmdPtr) { - UT_Stub_RegisterContext(UT_KEY(CS_EnableEepromCmd), CmdPtr); - UT_DEFAULT_IMPL(CS_EnableEepromCmd); + UT_GenStub_AddParam(CS_DisableEntryIDEepromCmd, const CS_EntryCmd_t *, CmdPtr); + + UT_GenStub_Execute(CS_DisableEntryIDEepromCmd, Basic, NULL); } -void CS_ReportBaselineEntryIDEepromCmd(const CS_EntryCmd_t *CmdPtr) +/* + * ---------------------------------------------------- + * Generated stub function for CS_EnableEepromCmd() + * ---------------------------------------------------- + */ +void CS_EnableEepromCmd(const CS_NoArgsCmd_t *CmdPtr) { - UT_Stub_RegisterContext(UT_KEY(CS_ReportBaselineEntryIDEepromCmd), CmdPtr); - UT_DEFAULT_IMPL(CS_ReportBaselineEntryIDEepromCmd); + UT_GenStub_AddParam(CS_EnableEepromCmd, const CS_NoArgsCmd_t *, CmdPtr); + + UT_GenStub_Execute(CS_EnableEepromCmd, Basic, NULL); } -void CS_DisableEntryIDEepromCmd(const CS_EntryCmd_t *CmdPtr) +/* + * ---------------------------------------------------- + * Generated stub function for CS_EnableEntryIDEepromCmd() + * ---------------------------------------------------- + */ +void CS_EnableEntryIDEepromCmd(const CS_EntryCmd_t *CmdPtr) { - UT_Stub_RegisterContext(UT_KEY(CS_DisableEntryIDEepromCmd), CmdPtr); - UT_DEFAULT_IMPL(CS_DisableEntryIDEepromCmd); + UT_GenStub_AddParam(CS_EnableEntryIDEepromCmd, const CS_EntryCmd_t *, CmdPtr); + + UT_GenStub_Execute(CS_EnableEntryIDEepromCmd, Basic, NULL); } -void CS_RecomputeBaselineEepromCmd(const CS_EntryCmd_t *CmdPtr) +/* + * ---------------------------------------------------- + * Generated stub function for CS_GetEntryIDEepromCmd() + * ---------------------------------------------------- + */ +void CS_GetEntryIDEepromCmd(const CS_GetEntryIDCmd_t *CmdPtr) { - UT_Stub_RegisterContext(UT_KEY(CS_RecomputeBaselineEepromCmd), CmdPtr); - UT_DEFAULT_IMPL(CS_RecomputeBaselineEepromCmd); + UT_GenStub_AddParam(CS_GetEntryIDEepromCmd, const CS_GetEntryIDCmd_t *, CmdPtr); + + UT_GenStub_Execute(CS_GetEntryIDEepromCmd, Basic, NULL); } -void CS_EnableEntryIDEepromCmd(const CS_EntryCmd_t *CmdPtr) +/* + * ---------------------------------------------------- + * Generated stub function for CS_RecomputeBaselineEepromCmd() + * ---------------------------------------------------- + */ +void CS_RecomputeBaselineEepromCmd(const CS_EntryCmd_t *CmdPtr) { - UT_Stub_RegisterContext(UT_KEY(CS_EnableEntryIDEepromCmd), CmdPtr); - UT_DEFAULT_IMPL(CS_EnableEntryIDEepromCmd); + UT_GenStub_AddParam(CS_RecomputeBaselineEepromCmd, const CS_EntryCmd_t *, CmdPtr); + + UT_GenStub_Execute(CS_RecomputeBaselineEepromCmd, Basic, NULL); } -void CS_GetEntryIDEepromCmd(const CS_GetEntryIDCmd_t *CmdPtr) +/* + * ---------------------------------------------------- + * Generated stub function for CS_ReportBaselineEntryIDEepromCmd() + * ---------------------------------------------------- + */ +void CS_ReportBaselineEntryIDEepromCmd(const CS_EntryCmd_t *CmdPtr) { - UT_Stub_RegisterContext(UT_KEY(CS_GetEntryIDEepromCmd), CmdPtr); - UT_DEFAULT_IMPL(CS_GetEntryIDEepromCmd); + UT_GenStub_AddParam(CS_ReportBaselineEntryIDEepromCmd, const CS_EntryCmd_t *, CmdPtr); + + UT_GenStub_Execute(CS_ReportBaselineEntryIDEepromCmd, Basic, NULL); } diff --git a/unit-test/stubs/cs_init_stubs.c b/unit-test/stubs/cs_init_stubs.c index 5288b1a..a44251f 100644 --- a/unit-test/stubs/cs_init_stubs.c +++ b/unit-test/stubs/cs_init_stubs.c @@ -17,28 +17,50 @@ * limitations under the License. ************************************************************************/ -/* - * Includes +/** + * @file + * + * Auto-Generated stub implementations for functions defined in cs_init header */ -#include "cs_app.h" - -/* UT includes */ -#include "uttest.h" -#include "utassert.h" -#include "utstubs.h" +#include "cs_init.h" +#include "utgenstub.h" -CFE_Status_t CS_SbInit(void) +/* + * ---------------------------------------------------- + * Generated stub function for CS_InitAllTables() + * ---------------------------------------------------- + */ +CFE_Status_t CS_InitAllTables(void) { - return UT_DEFAULT_IMPL(CS_SbInit); + UT_GenStub_SetupReturnBuffer(CS_InitAllTables, CFE_Status_t); + + UT_GenStub_Execute(CS_InitAllTables, Basic, NULL); + + return UT_GenStub_GetReturnValue(CS_InitAllTables, CFE_Status_t); } -CFE_Status_t CS_InitAllTables(void) +/* + * ---------------------------------------------------- + * Generated stub function for CS_InitSegments() + * ---------------------------------------------------- + */ +void CS_InitSegments(void) { - return UT_DEFAULT_IMPL(CS_InitAllTables); + + UT_GenStub_Execute(CS_InitSegments, Basic, NULL); } -CFE_Status_t CS_InitSegments(void) +/* + * ---------------------------------------------------- + * Generated stub function for CS_SbInit() + * ---------------------------------------------------- + */ +CFE_Status_t CS_SbInit(void) { - return UT_DEFAULT_IMPL(CS_InitAllTables); + UT_GenStub_SetupReturnBuffer(CS_SbInit, CFE_Status_t); + + UT_GenStub_Execute(CS_SbInit, Basic, NULL); + + return UT_GenStub_GetReturnValue(CS_SbInit, CFE_Status_t); } diff --git a/unit-test/stubs/cs_memory_cmds_stubs.c b/unit-test/stubs/cs_memory_cmds_stubs.c index 83acebd..31bcf80 100644 --- a/unit-test/stubs/cs_memory_cmds_stubs.c +++ b/unit-test/stubs/cs_memory_cmds_stubs.c @@ -17,55 +17,95 @@ * limitations under the License. ************************************************************************/ -/* - * Includes +/** + * @file + * + * Auto-Generated stub implementations for functions defined in cs_memory_cmds header */ #include "cs_memory_cmds.h" +#include "utgenstub.h" -/* UT includes */ -#include "uttest.h" -#include "utassert.h" -#include "utstubs.h" +/* + * ---------------------------------------------------- + * Generated stub function for CS_DisableEntryIDMemoryCmd() + * ---------------------------------------------------- + */ +void CS_DisableEntryIDMemoryCmd(const CS_EntryCmd_t *CmdPtr) +{ + UT_GenStub_AddParam(CS_DisableEntryIDMemoryCmd, const CS_EntryCmd_t *, CmdPtr); + + UT_GenStub_Execute(CS_DisableEntryIDMemoryCmd, Basic, NULL); +} +/* + * ---------------------------------------------------- + * Generated stub function for CS_DisableMemoryCmd() + * ---------------------------------------------------- + */ void CS_DisableMemoryCmd(const CS_NoArgsCmd_t *CmdPtr) { - UT_Stub_RegisterContext(UT_KEY(CS_DisableMemoryCmd), CmdPtr); - UT_DEFAULT_IMPL(CS_DisableMemoryCmd); + UT_GenStub_AddParam(CS_DisableMemoryCmd, const CS_NoArgsCmd_t *, CmdPtr); + + UT_GenStub_Execute(CS_DisableMemoryCmd, Basic, NULL); } -void CS_EnableMemoryCmd(const CS_NoArgsCmd_t *CmdPtr) +/* + * ---------------------------------------------------- + * Generated stub function for CS_EnableEntryIDMemoryCmd() + * ---------------------------------------------------- + */ +void CS_EnableEntryIDMemoryCmd(const CS_EntryCmd_t *CmdPtr) { - UT_Stub_RegisterContext(UT_KEY(CS_EnableMemoryCmd), CmdPtr); - UT_DEFAULT_IMPL(CS_EnableMemoryCmd); + UT_GenStub_AddParam(CS_EnableEntryIDMemoryCmd, const CS_EntryCmd_t *, CmdPtr); + + UT_GenStub_Execute(CS_EnableEntryIDMemoryCmd, Basic, NULL); } -void CS_ReportBaselineEntryIDMemoryCmd(const CS_EntryCmd_t *CmdPtr) +/* + * ---------------------------------------------------- + * Generated stub function for CS_EnableMemoryCmd() + * ---------------------------------------------------- + */ +void CS_EnableMemoryCmd(const CS_NoArgsCmd_t *CmdPtr) { - UT_Stub_RegisterContext(UT_KEY(CS_ReportBaselineEntryIDMemoryCmd), CmdPtr); - UT_DEFAULT_IMPL(CS_ReportBaselineEntryIDMemoryCmd); + UT_GenStub_AddParam(CS_EnableMemoryCmd, const CS_NoArgsCmd_t *, CmdPtr); + + UT_GenStub_Execute(CS_EnableMemoryCmd, Basic, NULL); } -void CS_DisableEntryIDMemoryCmd(const CS_EntryCmd_t *CmdPtr) +/* + * ---------------------------------------------------- + * Generated stub function for CS_GetEntryIDMemoryCmd() + * ---------------------------------------------------- + */ +void CS_GetEntryIDMemoryCmd(const CS_GetEntryIDCmd_t *CmdPtr) { - UT_Stub_RegisterContext(UT_KEY(CS_DisableEntryIDMemoryCmd), CmdPtr); - UT_DEFAULT_IMPL(CS_DisableEntryIDMemoryCmd); + UT_GenStub_AddParam(CS_GetEntryIDMemoryCmd, const CS_GetEntryIDCmd_t *, CmdPtr); + + UT_GenStub_Execute(CS_GetEntryIDMemoryCmd, Basic, NULL); } +/* + * ---------------------------------------------------- + * Generated stub function for CS_RecomputeBaselineMemoryCmd() + * ---------------------------------------------------- + */ void CS_RecomputeBaselineMemoryCmd(const CS_EntryCmd_t *CmdPtr) { - UT_Stub_RegisterContext(UT_KEY(CS_RecomputeBaselineMemoryCmd), CmdPtr); - UT_DEFAULT_IMPL(CS_RecomputeBaselineMemoryCmd); -} + UT_GenStub_AddParam(CS_RecomputeBaselineMemoryCmd, const CS_EntryCmd_t *, CmdPtr); -void CS_EnableEntryIDMemoryCmd(const CS_EntryCmd_t *CmdPtr) -{ - UT_Stub_RegisterContext(UT_KEY(CS_EnableEntryIDMemoryCmd), CmdPtr); - UT_DEFAULT_IMPL(CS_EnableEntryIDMemoryCmd); + UT_GenStub_Execute(CS_RecomputeBaselineMemoryCmd, Basic, NULL); } -void CS_GetEntryIDMemoryCmd(const CS_GetEntryIDCmd_t *CmdPtr) +/* + * ---------------------------------------------------- + * Generated stub function for CS_ReportBaselineEntryIDMemoryCmd() + * ---------------------------------------------------- + */ +void CS_ReportBaselineEntryIDMemoryCmd(const CS_EntryCmd_t *CmdPtr) { - UT_Stub_RegisterContext(UT_KEY(CS_GetEntryIDMemoryCmd), CmdPtr); - UT_DEFAULT_IMPL(CS_GetEntryIDMemoryCmd); + UT_GenStub_AddParam(CS_ReportBaselineEntryIDMemoryCmd, const CS_EntryCmd_t *, CmdPtr); + + UT_GenStub_Execute(CS_ReportBaselineEntryIDMemoryCmd, Basic, NULL); } diff --git a/unit-test/stubs/cs_table_cmds_stubs.c b/unit-test/stubs/cs_table_cmds_stubs.c index b4c9344..92ffcf7 100644 --- a/unit-test/stubs/cs_table_cmds_stubs.c +++ b/unit-test/stubs/cs_table_cmds_stubs.c @@ -17,49 +17,83 @@ * limitations under the License. ************************************************************************/ -/* - * Includes +/** + * @file + * + * Auto-Generated stub implementations for functions defined in cs_table_cmds header */ #include "cs_table_cmds.h" +#include "utgenstub.h" + +/* + * ---------------------------------------------------- + * Generated stub function for CS_DisableNameTablesCmd() + * ---------------------------------------------------- + */ +void CS_DisableNameTablesCmd(const CS_TableNameCmd_t *CmdPtr) +{ + UT_GenStub_AddParam(CS_DisableNameTablesCmd, const CS_TableNameCmd_t *, CmdPtr); -/* UT includes */ -#include "uttest.h" -#include "utassert.h" -#include "utstubs.h" + UT_GenStub_Execute(CS_DisableNameTablesCmd, Basic, NULL); +} +/* + * ---------------------------------------------------- + * Generated stub function for CS_DisableTablesCmd() + * ---------------------------------------------------- + */ void CS_DisableTablesCmd(const CS_NoArgsCmd_t *CmdPtr) { - UT_Stub_RegisterContext(UT_KEY(CS_DisableTablesCmd), CmdPtr); - UT_DEFAULT_IMPL(CS_DisableTablesCmd); + UT_GenStub_AddParam(CS_DisableTablesCmd, const CS_NoArgsCmd_t *, CmdPtr); + + UT_GenStub_Execute(CS_DisableTablesCmd, Basic, NULL); } -void CS_EnableTablesCmd(const CS_NoArgsCmd_t *CmdPtr) +/* + * ---------------------------------------------------- + * Generated stub function for CS_EnableNameTablesCmd() + * ---------------------------------------------------- + */ +void CS_EnableNameTablesCmd(const CS_TableNameCmd_t *CmdPtr) { - UT_Stub_RegisterContext(UT_KEY(CS_EnableTablesCmd), CmdPtr); - UT_DEFAULT_IMPL(CS_EnableTablesCmd); + UT_GenStub_AddParam(CS_EnableNameTablesCmd, const CS_TableNameCmd_t *, CmdPtr); + + UT_GenStub_Execute(CS_EnableNameTablesCmd, Basic, NULL); } -void CS_ReportBaselineTablesCmd(const CS_TableNameCmd_t *CmdPtr) +/* + * ---------------------------------------------------- + * Generated stub function for CS_EnableTablesCmd() + * ---------------------------------------------------- + */ +void CS_EnableTablesCmd(const CS_NoArgsCmd_t *CmdPtr) { - UT_Stub_RegisterContext(UT_KEY(CS_ReportBaselineTablesCmd), CmdPtr); - UT_DEFAULT_IMPL(CS_ReportBaselineTablesCmd); + UT_GenStub_AddParam(CS_EnableTablesCmd, const CS_NoArgsCmd_t *, CmdPtr); + + UT_GenStub_Execute(CS_EnableTablesCmd, Basic, NULL); } +/* + * ---------------------------------------------------- + * Generated stub function for CS_RecomputeBaselineTablesCmd() + * ---------------------------------------------------- + */ void CS_RecomputeBaselineTablesCmd(const CS_TableNameCmd_t *CmdPtr) { - UT_Stub_RegisterContext(UT_KEY(CS_RecomputeBaselineTablesCmd), CmdPtr); - UT_DEFAULT_IMPL(CS_RecomputeBaselineTablesCmd); -} + UT_GenStub_AddParam(CS_RecomputeBaselineTablesCmd, const CS_TableNameCmd_t *, CmdPtr); -void CS_DisableNameTablesCmd(const CS_TableNameCmd_t *CmdPtr) -{ - UT_Stub_RegisterContext(UT_KEY(CS_DisableNameTablesCmd), CmdPtr); - UT_DEFAULT_IMPL(CS_DisableNameTablesCmd); + UT_GenStub_Execute(CS_RecomputeBaselineTablesCmd, Basic, NULL); } -void CS_EnableNameTablesCmd(const CS_TableNameCmd_t *CmdPtr) +/* + * ---------------------------------------------------- + * Generated stub function for CS_ReportBaselineTablesCmd() + * ---------------------------------------------------- + */ +void CS_ReportBaselineTablesCmd(const CS_TableNameCmd_t *CmdPtr) { - UT_Stub_RegisterContext(UT_KEY(CS_EnableNameTablesCmd), CmdPtr); - UT_DEFAULT_IMPL(CS_EnableNameTablesCmd); + UT_GenStub_AddParam(CS_ReportBaselineTablesCmd, const CS_TableNameCmd_t *, CmdPtr); + + UT_GenStub_Execute(CS_ReportBaselineTablesCmd, Basic, NULL); } diff --git a/unit-test/stubs/cs_table_processing_stubs.c b/unit-test/stubs/cs_table_processing_stubs.c index cca9fe9..0d6b3b7 100644 --- a/unit-test/stubs/cs_table_processing_stubs.c +++ b/unit-test/stubs/cs_table_processing_stubs.c @@ -17,113 +17,175 @@ * limitations under the License. ************************************************************************/ +/** + * @file + * + * Auto-Generated stub implementations for functions defined in cs_table_processing header + */ + +#include "cs_table_processing.h" +#include "utgenstub.h" + /* - * Includes + * ---------------------------------------------------- + * Generated stub function for CS_HandleTableUpdate() + * ---------------------------------------------------- */ +CFE_Status_t CS_HandleTableUpdate(void **DefinitionTblPtr, void **ResultsTblPtr, CFE_TBL_Handle_t DefinitionTableHandle, + CFE_TBL_Handle_t ResultsTableHandle, uint16 Table, uint16 NumEntries) +{ + UT_GenStub_SetupReturnBuffer(CS_HandleTableUpdate, CFE_Status_t); -#include "cs_tbldefs.h" + UT_GenStub_AddParam(CS_HandleTableUpdate, void **, DefinitionTblPtr); + UT_GenStub_AddParam(CS_HandleTableUpdate, void **, ResultsTblPtr); + UT_GenStub_AddParam(CS_HandleTableUpdate, CFE_TBL_Handle_t, DefinitionTableHandle); + UT_GenStub_AddParam(CS_HandleTableUpdate, CFE_TBL_Handle_t, ResultsTableHandle); + UT_GenStub_AddParam(CS_HandleTableUpdate, uint16, Table); + UT_GenStub_AddParam(CS_HandleTableUpdate, uint16, NumEntries); -/* UT includes */ -#include "uttest.h" -#include "utassert.h" -#include "utstubs.h" + UT_GenStub_Execute(CS_HandleTableUpdate, Basic, NULL); -CFE_Status_t CS_ValidateEepromChecksumDefinitionTable(void *TblPtr) + return UT_GenStub_GetReturnValue(CS_HandleTableUpdate, CFE_Status_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for CS_ProcessNewAppDefinitionTable() + * ---------------------------------------------------- + */ +void CS_ProcessNewAppDefinitionTable(const CS_Def_App_Table_Entry_t *DefinitionTblPtr, + CS_Res_App_Table_Entry_t * ResultsTblPtr) { - UT_Stub_RegisterContext(UT_KEY(CS_ValidateEepromChecksumDefinitionTable), TblPtr); + UT_GenStub_AddParam(CS_ProcessNewAppDefinitionTable, const CS_Def_App_Table_Entry_t *, DefinitionTblPtr); + UT_GenStub_AddParam(CS_ProcessNewAppDefinitionTable, CS_Res_App_Table_Entry_t *, ResultsTblPtr); - return UT_DEFAULT_IMPL(CS_ValidateEepromChecksumDefinitionTable); + UT_GenStub_Execute(CS_ProcessNewAppDefinitionTable, Basic, NULL); } -CFE_Status_t CS_ValidateMemoryChecksumDefinitionTable(void *TblPtr) +/* + * ---------------------------------------------------- + * Generated stub function for CS_ProcessNewEepromMemoryDefinitionTable() + * ---------------------------------------------------- + */ +void CS_ProcessNewEepromMemoryDefinitionTable(const CS_Def_EepromMemory_Table_Entry_t *DefinitionTblPtr, + CS_Res_EepromMemory_Table_Entry_t *ResultsTblPtr, uint16 NumEntries, + uint16 Table) { - UT_Stub_RegisterContext(UT_KEY(CS_ValidateMemoryChecksumDefinitionTable), TblPtr); + UT_GenStub_AddParam(CS_ProcessNewEepromMemoryDefinitionTable, const CS_Def_EepromMemory_Table_Entry_t *, + DefinitionTblPtr); + UT_GenStub_AddParam(CS_ProcessNewEepromMemoryDefinitionTable, CS_Res_EepromMemory_Table_Entry_t *, ResultsTblPtr); + UT_GenStub_AddParam(CS_ProcessNewEepromMemoryDefinitionTable, uint16, NumEntries); + UT_GenStub_AddParam(CS_ProcessNewEepromMemoryDefinitionTable, uint16, Table); - return UT_DEFAULT_IMPL(CS_ValidateMemoryChecksumDefinitionTable); + UT_GenStub_Execute(CS_ProcessNewEepromMemoryDefinitionTable, Basic, NULL); } -CFE_Status_t CS_ValidateTablesChecksumDefinitionTable(void *TblPtr) +/* + * ---------------------------------------------------- + * Generated stub function for CS_ProcessNewTablesDefinitionTable() + * ---------------------------------------------------- + */ +void CS_ProcessNewTablesDefinitionTable(const CS_Def_Tables_Table_Entry_t *DefinitionTblPtr, + CS_Res_Tables_Table_Entry_t * ResultsTblPtr) { - UT_Stub_RegisterContext(UT_KEY(CS_ValidateTablesChecksumDefinitionTable), TblPtr); + UT_GenStub_AddParam(CS_ProcessNewTablesDefinitionTable, const CS_Def_Tables_Table_Entry_t *, DefinitionTblPtr); + UT_GenStub_AddParam(CS_ProcessNewTablesDefinitionTable, CS_Res_Tables_Table_Entry_t *, ResultsTblPtr); - return UT_DEFAULT_IMPL(CS_ValidateTablesChecksumDefinitionTable); + UT_GenStub_Execute(CS_ProcessNewTablesDefinitionTable, Basic, NULL); } -CFE_Status_t CS_ValidateAppChecksumDefinitionTable(void *TblPtr) +/* + * ---------------------------------------------------- + * Generated stub function for CS_TableInit() + * ---------------------------------------------------- + */ +CFE_Status_t CS_TableInit(CFE_TBL_Handle_t *DefinitionTableHandle, CFE_TBL_Handle_t *ResultsTableHandle, + void **DefinitionTblPtr, void **ResultsTblPtr, uint16 Table, const char *DefinitionTableName, + const char *ResultsTableName, uint16 NumEntries, const char *DefinitionTableFileName, + const void *DefaultDefTableAddress, uint16 SizeofDefinitionTableEntry, + uint16 SizeofResultsTableEntry, CFE_TBL_CallbackFuncPtr_t CallBackFunction) { - UT_Stub_RegisterContext(UT_KEY(CS_ValidateAppChecksumDefinitionTable), TblPtr); - - return UT_DEFAULT_IMPL(CS_ValidateAppChecksumDefinitionTable); + UT_GenStub_SetupReturnBuffer(CS_TableInit, CFE_Status_t); + + UT_GenStub_AddParam(CS_TableInit, CFE_TBL_Handle_t *, DefinitionTableHandle); + UT_GenStub_AddParam(CS_TableInit, CFE_TBL_Handle_t *, ResultsTableHandle); + UT_GenStub_AddParam(CS_TableInit, void **, DefinitionTblPtr); + UT_GenStub_AddParam(CS_TableInit, void **, ResultsTblPtr); + UT_GenStub_AddParam(CS_TableInit, uint16, Table); + UT_GenStub_AddParam(CS_TableInit, const char *, DefinitionTableName); + UT_GenStub_AddParam(CS_TableInit, const char *, ResultsTableName); + UT_GenStub_AddParam(CS_TableInit, uint16, NumEntries); + UT_GenStub_AddParam(CS_TableInit, const char *, DefinitionTableFileName); + UT_GenStub_AddParam(CS_TableInit, const void *, DefaultDefTableAddress); + UT_GenStub_AddParam(CS_TableInit, uint16, SizeofDefinitionTableEntry); + UT_GenStub_AddParam(CS_TableInit, uint16, SizeofResultsTableEntry); + UT_GenStub_AddParam(CS_TableInit, CFE_TBL_CallbackFuncPtr_t, CallBackFunction); + + UT_GenStub_Execute(CS_TableInit, Basic, NULL); + + return UT_GenStub_GetReturnValue(CS_TableInit, CFE_Status_t); } -void CS_ProcessNewEepromMemoryDefinitionTable(const CS_Def_EepromMemory_Table_Entry_t *DefinitionTblPtr, - const CS_Res_EepromMemory_Table_Entry_t *ResultsTblPtr, - const uint16 NumEntries, const uint16 Table) +/* + * ---------------------------------------------------- + * Generated stub function for CS_ValidateAppChecksumDefinitionTable() + * ---------------------------------------------------- + */ +CFE_Status_t CS_ValidateAppChecksumDefinitionTable(void *TblPtr) { - UT_Stub_RegisterContext(UT_KEY(CS_ProcessNewEepromMemoryDefinitionTable), DefinitionTblPtr); - UT_Stub_RegisterContext(UT_KEY(CS_ProcessNewEepromMemoryDefinitionTable), ResultsTblPtr); - UT_Stub_RegisterContextGenericArg(UT_KEY(CS_ProcessNewEepromMemoryDefinitionTable), Table); - UT_Stub_RegisterContextGenericArg(UT_KEY(CS_ProcessNewEepromMemoryDefinitionTable), NumEntries); + UT_GenStub_SetupReturnBuffer(CS_ValidateAppChecksumDefinitionTable, CFE_Status_t); - UT_DEFAULT_IMPL(CS_ProcessNewEepromMemoryDefinitionTable); -} + UT_GenStub_AddParam(CS_ValidateAppChecksumDefinitionTable, void *, TblPtr); -void CS_ProcessNewTablesDefinitionTable(const CS_Def_Tables_Table_Entry_t *DefinitionTblPtr, - const CS_Res_Tables_Table_Entry_t *ResultsTblPtr) + UT_GenStub_Execute(CS_ValidateAppChecksumDefinitionTable, Basic, NULL); + return UT_GenStub_GetReturnValue(CS_ValidateAppChecksumDefinitionTable, CFE_Status_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for CS_ValidateEepromChecksumDefinitionTable() + * ---------------------------------------------------- + */ +CFE_Status_t CS_ValidateEepromChecksumDefinitionTable(void *TblPtr) { - UT_Stub_RegisterContext(UT_KEY(CS_ProcessNewTablesDefinitionTable), DefinitionTblPtr); - UT_Stub_RegisterContext(UT_KEY(CS_ProcessNewTablesDefinitionTable), ResultsTblPtr); + UT_GenStub_SetupReturnBuffer(CS_ValidateEepromChecksumDefinitionTable, CFE_Status_t); - UT_DEFAULT_IMPL(CS_ProcessNewTablesDefinitionTable); -} + UT_GenStub_AddParam(CS_ValidateEepromChecksumDefinitionTable, void *, TblPtr); -void CS_ProcessNewAppDefinitionTable(const CS_Def_App_Table_Entry_t *DefinitionTblPtr, - const CS_Res_App_Table_Entry_t *ResultsTblPtr) + UT_GenStub_Execute(CS_ValidateEepromChecksumDefinitionTable, Basic, NULL); + + return UT_GenStub_GetReturnValue(CS_ValidateEepromChecksumDefinitionTable, CFE_Status_t); +} +/* + * ---------------------------------------------------- + * Generated stub function for CS_ValidateMemoryChecksumDefinitionTable() + * ---------------------------------------------------- + */ +CFE_Status_t CS_ValidateMemoryChecksumDefinitionTable(void *TblPtr) { - UT_Stub_RegisterContext(UT_KEY(CS_ProcessNewAppDefinitionTable), DefinitionTblPtr); - UT_Stub_RegisterContext(UT_KEY(CS_ProcessNewAppDefinitionTable), ResultsTblPtr); + UT_GenStub_SetupReturnBuffer(CS_ValidateMemoryChecksumDefinitionTable, CFE_Status_t); - UT_DEFAULT_IMPL(CS_ProcessNewAppDefinitionTable); -} + UT_GenStub_AddParam(CS_ValidateMemoryChecksumDefinitionTable, void *, TblPtr); -CFE_Status_t CS_TableInit(CFE_TBL_Handle_t *DefinitionTableHandle, CFE_TBL_Handle_t *ResultsTableHandle, - void *DefinitionTblPtr, void *ResultsTblPtr, const uint16 Table, - const char *DefinitionTableName, const char *ResultsTableName, const uint16 NumEntries, - const char *DefinitionTableFileName, const void *DefaultDefTableAddress, - const uint16 SizeofDefinitionTableEntry, const uint16 SizeofResultsTableEntry, - const CFE_TBL_CallbackFuncPtr_t CallBackFunction) + UT_GenStub_Execute(CS_ValidateMemoryChecksumDefinitionTable, Basic, NULL); -{ - UT_Stub_RegisterContext(UT_KEY(CS_TableInit), DefinitionTableHandle); - UT_Stub_RegisterContext(UT_KEY(CS_TableInit), ResultsTableHandle); - UT_Stub_RegisterContext(UT_KEY(CS_TableInit), DefinitionTblPtr); - UT_Stub_RegisterContext(UT_KEY(CS_TableInit), ResultsTblPtr); - UT_Stub_RegisterContextGenericArg(UT_KEY(CS_TableInit), Table); - UT_Stub_RegisterContext(UT_KEY(CS_TableInit), DefinitionTableName); - UT_Stub_RegisterContext(UT_KEY(CS_TableInit), ResultsTableName); - UT_Stub_RegisterContextGenericArg(UT_KEY(CS_TableInit), NumEntries); - UT_Stub_RegisterContext(UT_KEY(CS_TableInit), DefinitionTableFileName); - UT_Stub_RegisterContext(UT_KEY(CS_TableInit), DefaultDefTableAddress); - UT_Stub_RegisterContextGenericArg(UT_KEY(CS_TableInit), SizeofDefinitionTableEntry); - UT_Stub_RegisterContextGenericArg(UT_KEY(CS_TableInit), SizeofResultsTableEntry); - UT_Stub_RegisterContextGenericArg(UT_KEY(CS_TableInit), CallBackFunction); - - return UT_DEFAULT_IMPL(CS_TableInit); + return UT_GenStub_GetReturnValue(CS_ValidateMemoryChecksumDefinitionTable, CFE_Status_t); } -CFE_Status_t CS_HandleTableUpdate(void *DefinitionTblPtr, void *ResultsTblPtr, - const CFE_TBL_Handle_t DefinitionTableHandle, - const CFE_TBL_Handle_t ResultsTableHandle, const uint16 Table, - const uint16 NumEntries) +/* + * ---------------------------------------------------- + * Generated stub function for CS_ValidateTablesChecksumDefinitionTable() + * ---------------------------------------------------- + */ +CFE_Status_t CS_ValidateTablesChecksumDefinitionTable(void *TblPtr) { - UT_Stub_RegisterContext(UT_KEY(CS_HandleTableUpdate), DefinitionTblPtr); - UT_Stub_RegisterContext(UT_KEY(CS_HandleTableUpdate), ResultsTblPtr); - UT_Stub_RegisterContextGenericArg(UT_KEY(CS_HandleTableUpdate), DefinitionTableHandle); - UT_Stub_RegisterContextGenericArg(UT_KEY(CS_HandleTableUpdate), ResultsTableHandle); - UT_Stub_RegisterContextGenericArg(UT_KEY(CS_HandleTableUpdate), Table); - UT_Stub_RegisterContextGenericArg(UT_KEY(CS_HandleTableUpdate), NumEntries); - - return UT_DEFAULT_IMPL(CS_HandleTableUpdate); + UT_GenStub_SetupReturnBuffer(CS_ValidateTablesChecksumDefinitionTable, CFE_Status_t); + + UT_GenStub_AddParam(CS_ValidateTablesChecksumDefinitionTable, void *, TblPtr); + + UT_GenStub_Execute(CS_ValidateTablesChecksumDefinitionTable, Basic, NULL); + + return UT_GenStub_GetReturnValue(CS_ValidateTablesChecksumDefinitionTable, CFE_Status_t); } diff --git a/unit-test/stubs/cs_utils_stubs.c b/unit-test/stubs/cs_utils_stubs.c index 0e553ef..51c4651 100644 --- a/unit-test/stubs/cs_utils_stubs.c +++ b/unit-test/stubs/cs_utils_stubs.c @@ -17,176 +17,409 @@ * limitations under the License. ************************************************************************/ -/* - * Includes +/** + * @file + * + * Auto-Generated stub implementations for functions defined in cs_utils header */ #include "cs_utils.h" +#include "utgenstub.h" -/* UT includes */ -#include "uttest.h" -#include "utassert.h" -#include "utstubs.h" +/* + * ---------------------------------------------------- + * Generated stub function for CS_AttemptTableReshare() + * ---------------------------------------------------- + */ +CFE_Status_t CS_AttemptTableReshare(CS_Res_Tables_Table_Entry_t *ResultsEntry, CFE_TBL_Handle_t *LocalTblHandle, + CFE_TBL_Info_t *TblInfo, cpuaddr *LocalAddress, int32 *ResultGetInfo) +{ + UT_GenStub_SetupReturnBuffer(CS_AttemptTableReshare, CFE_Status_t); -void CS_ZeroEepromTempValues(void) + UT_GenStub_AddParam(CS_AttemptTableReshare, CS_Res_Tables_Table_Entry_t *, ResultsEntry); + UT_GenStub_AddParam(CS_AttemptTableReshare, CFE_TBL_Handle_t *, LocalTblHandle); + UT_GenStub_AddParam(CS_AttemptTableReshare, CFE_TBL_Info_t *, TblInfo); + UT_GenStub_AddParam(CS_AttemptTableReshare, cpuaddr *, LocalAddress); + UT_GenStub_AddParam(CS_AttemptTableReshare, int32 *, ResultGetInfo); + + UT_GenStub_Execute(CS_AttemptTableReshare, Basic, NULL); + + return UT_GenStub_GetReturnValue(CS_AttemptTableReshare, CFE_Status_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for CS_BackgroundApp() + * ---------------------------------------------------- + */ +bool CS_BackgroundApp(void) { - UT_DEFAULT_IMPL(CS_ZeroEepromTempValues); + UT_GenStub_SetupReturnBuffer(CS_BackgroundApp, bool); + + UT_GenStub_Execute(CS_BackgroundApp, Basic, NULL); + + return UT_GenStub_GetReturnValue(CS_BackgroundApp, bool); } -void CS_ZeroMemoryTempValues(void) +/* + * ---------------------------------------------------- + * Generated stub function for CS_BackgroundCfeCore() + * ---------------------------------------------------- + */ +bool CS_BackgroundCfeCore(void) { - UT_DEFAULT_IMPL(CS_ZeroMemoryTempValues); + UT_GenStub_SetupReturnBuffer(CS_BackgroundCfeCore, bool); + + UT_GenStub_Execute(CS_BackgroundCfeCore, Basic, NULL); + + return UT_GenStub_GetReturnValue(CS_BackgroundCfeCore, bool); } -void CS_ZeroTablesTempValues(void) +/* + * ---------------------------------------------------- + * Generated stub function for CS_BackgroundEeprom() + * ---------------------------------------------------- + */ +bool CS_BackgroundEeprom(void) { - UT_DEFAULT_IMPL(CS_ZeroTablesTempValues); + UT_GenStub_SetupReturnBuffer(CS_BackgroundEeprom, bool); + + UT_GenStub_Execute(CS_BackgroundEeprom, Basic, NULL); + + return UT_GenStub_GetReturnValue(CS_BackgroundEeprom, bool); } -void CS_ZeroAppTempValues(void) +/* + * ---------------------------------------------------- + * Generated stub function for CS_BackgroundMemory() + * ---------------------------------------------------- + */ +bool CS_BackgroundMemory(void) { - UT_DEFAULT_IMPL(CS_ZeroAppTempValues); + UT_GenStub_SetupReturnBuffer(CS_BackgroundMemory, bool); + + UT_GenStub_Execute(CS_BackgroundMemory, Basic, NULL); + + return UT_GenStub_GetReturnValue(CS_BackgroundMemory, bool); } -void CS_ZeroCfeCoreTempValues(void) +/* + * ---------------------------------------------------- + * Generated stub function for CS_BackgroundOS() + * ---------------------------------------------------- + */ +bool CS_BackgroundOS(void) { - UT_DEFAULT_IMPL(CS_ZeroCfeCoreTempValues); + UT_GenStub_SetupReturnBuffer(CS_BackgroundOS, bool); + + UT_GenStub_Execute(CS_BackgroundOS, Basic, NULL); + + return UT_GenStub_GetReturnValue(CS_BackgroundOS, bool); } -void CS_ZeroOSTempValues(void) +/* + * ---------------------------------------------------- + * Generated stub function for CS_BackgroundTables() + * ---------------------------------------------------- + */ +bool CS_BackgroundTables(void) { - UT_DEFAULT_IMPL(CS_ZeroOSTempValues); + UT_GenStub_SetupReturnBuffer(CS_BackgroundTables, bool); + + UT_GenStub_Execute(CS_BackgroundTables, Basic, NULL); + + return UT_GenStub_GetReturnValue(CS_BackgroundTables, bool); } -void CS_InitializeDefaultTables(void) +/* + * ---------------------------------------------------- + * Generated stub function for CS_CheckRecomputeOneshot() + * ---------------------------------------------------- + */ +bool CS_CheckRecomputeOneshot(void) { - UT_DEFAULT_IMPL(CS_InitializeDefaultTables); + UT_GenStub_SetupReturnBuffer(CS_CheckRecomputeOneshot, bool); + + UT_GenStub_Execute(CS_CheckRecomputeOneshot, Basic, NULL); + + return UT_GenStub_GetReturnValue(CS_CheckRecomputeOneshot, bool); } -void CS_GoToNextTable(void) +/* + * ---------------------------------------------------- + * Generated stub function for CS_FindEnabledAppEntry() + * ---------------------------------------------------- + */ +bool CS_FindEnabledAppEntry(uint16 *EnabledEntry) { - UT_DEFAULT_IMPL(CS_GoToNextTable); + UT_GenStub_SetupReturnBuffer(CS_FindEnabledAppEntry, bool); + + UT_GenStub_AddParam(CS_FindEnabledAppEntry, uint16 *, EnabledEntry); + + UT_GenStub_Execute(CS_FindEnabledAppEntry, Basic, NULL); + + return UT_GenStub_GetReturnValue(CS_FindEnabledAppEntry, bool); } -bool CS_GetTableResTblEntryByName(CS_Res_Tables_Table_Entry_t **EntryPtr, const char *Name) +/* + * ---------------------------------------------------- + * Generated stub function for CS_FindEnabledEepromEntry() + * ---------------------------------------------------- + */ +bool CS_FindEnabledEepromEntry(uint16 *EnabledEntry) { - UT_Stub_RegisterContext(UT_KEY(CS_GetTableResTblEntryByName), EntryPtr); - UT_Stub_RegisterContext(UT_KEY(CS_GetTableResTblEntryByName), Name); + UT_GenStub_SetupReturnBuffer(CS_FindEnabledEepromEntry, bool); + + UT_GenStub_AddParam(CS_FindEnabledEepromEntry, uint16 *, EnabledEntry); - return UT_DEFAULT_IMPL(CS_GetTableResTblEntryByName); + UT_GenStub_Execute(CS_FindEnabledEepromEntry, Basic, NULL); + + return UT_GenStub_GetReturnValue(CS_FindEnabledEepromEntry, bool); } -bool CS_GetTableDefTblEntryByName(CS_Def_Tables_Table_Entry_t **EntryPtr, const char *Name) +/* + * ---------------------------------------------------- + * Generated stub function for CS_FindEnabledMemoryEntry() + * ---------------------------------------------------- + */ +bool CS_FindEnabledMemoryEntry(uint16 *EnabledEntry) { - UT_Stub_RegisterContext(UT_KEY(CS_GetTableDefTblEntryByName), EntryPtr); - UT_Stub_RegisterContext(UT_KEY(CS_GetTableDefTblEntryByName), Name); + UT_GenStub_SetupReturnBuffer(CS_FindEnabledMemoryEntry, bool); + + UT_GenStub_AddParam(CS_FindEnabledMemoryEntry, uint16 *, EnabledEntry); + + UT_GenStub_Execute(CS_FindEnabledMemoryEntry, Basic, NULL); - return UT_DEFAULT_IMPL(CS_GetTableDefTblEntryByName); + return UT_GenStub_GetReturnValue(CS_FindEnabledMemoryEntry, bool); } -bool CS_GetAppResTblEntryByName(CS_Res_App_Table_Entry_t **EntryPtr, const char *Name) +/* + * ---------------------------------------------------- + * Generated stub function for CS_FindEnabledTablesEntry() + * ---------------------------------------------------- + */ +bool CS_FindEnabledTablesEntry(uint16 *EnabledEntry) { - UT_Stub_RegisterContext(UT_KEY(CS_GetAppResTblEntryByName), EntryPtr); - UT_Stub_RegisterContext(UT_KEY(CS_GetAppResTblEntryByName), Name); + UT_GenStub_SetupReturnBuffer(CS_FindEnabledTablesEntry, bool); + + UT_GenStub_AddParam(CS_FindEnabledTablesEntry, uint16 *, EnabledEntry); - return UT_DEFAULT_IMPL(CS_GetAppResTblEntryByName); + UT_GenStub_Execute(CS_FindEnabledTablesEntry, Basic, NULL); + + return UT_GenStub_GetReturnValue(CS_FindEnabledTablesEntry, bool); } +/* + * ---------------------------------------------------- + * Generated stub function for CS_GetAppDefTblEntryByName() + * ---------------------------------------------------- + */ bool CS_GetAppDefTblEntryByName(CS_Def_App_Table_Entry_t **EntryPtr, const char *Name) { - UT_Stub_RegisterContext(UT_KEY(CS_GetAppDefTblEntryByName), EntryPtr); - UT_Stub_RegisterContext(UT_KEY(CS_GetAppDefTblEntryByName), Name); + UT_GenStub_SetupReturnBuffer(CS_GetAppDefTblEntryByName, bool); + + UT_GenStub_AddParam(CS_GetAppDefTblEntryByName, CS_Def_App_Table_Entry_t **, EntryPtr); + UT_GenStub_AddParam(CS_GetAppDefTblEntryByName, const char *, Name); + + UT_GenStub_Execute(CS_GetAppDefTblEntryByName, Basic, NULL); - return UT_DEFAULT_IMPL(CS_GetAppDefTblEntryByName); + return UT_GenStub_GetReturnValue(CS_GetAppDefTblEntryByName, bool); } -bool CS_FindEnabledEepromEntry(uint16 *EnabledEntry) +/* + * ---------------------------------------------------- + * Generated stub function for CS_GetAppResTblEntryByName() + * ---------------------------------------------------- + */ +bool CS_GetAppResTblEntryByName(CS_Res_App_Table_Entry_t **EntryPtr, const char *Name) { - UT_Stub_RegisterContext(UT_KEY(CS_FindEnabledEepromEntry), EnabledEntry); - return UT_DEFAULT_IMPL(CS_FindEnabledEepromEntry); + UT_GenStub_SetupReturnBuffer(CS_GetAppResTblEntryByName, bool); + + UT_GenStub_AddParam(CS_GetAppResTblEntryByName, CS_Res_App_Table_Entry_t **, EntryPtr); + UT_GenStub_AddParam(CS_GetAppResTblEntryByName, const char *, Name); + + UT_GenStub_Execute(CS_GetAppResTblEntryByName, Basic, NULL); + + return UT_GenStub_GetReturnValue(CS_GetAppResTblEntryByName, bool); } -bool CS_FindEnabledMemoryEntry(uint16 *EnabledEntry) +/* + * ---------------------------------------------------- + * Generated stub function for CS_GetTableDefTblEntryByName() + * ---------------------------------------------------- + */ +bool CS_GetTableDefTblEntryByName(CS_Def_Tables_Table_Entry_t **EntryPtr, const char *Name) { - UT_Stub_RegisterContext(UT_KEY(CS_FindEnabledMemoryEntry), EnabledEntry); - return UT_DEFAULT_IMPL(CS_FindEnabledMemoryEntry); + UT_GenStub_SetupReturnBuffer(CS_GetTableDefTblEntryByName, bool); + + UT_GenStub_AddParam(CS_GetTableDefTblEntryByName, CS_Def_Tables_Table_Entry_t **, EntryPtr); + UT_GenStub_AddParam(CS_GetTableDefTblEntryByName, const char *, Name); + + UT_GenStub_Execute(CS_GetTableDefTblEntryByName, Basic, NULL); + + return UT_GenStub_GetReturnValue(CS_GetTableDefTblEntryByName, bool); } -bool CS_FindEnabledTablesEntry(uint16 *EnabledEntry) +/* + * ---------------------------------------------------- + * Generated stub function for CS_GetTableResTblEntryByName() + * ---------------------------------------------------- + */ +bool CS_GetTableResTblEntryByName(CS_Res_Tables_Table_Entry_t **EntryPtr, const char *Name) { - UT_Stub_RegisterContext(UT_KEY(CS_FindEnabledTablesEntry), EnabledEntry); - return UT_DEFAULT_IMPL(CS_FindEnabledTablesEntry); + UT_GenStub_SetupReturnBuffer(CS_GetTableResTblEntryByName, bool); + + UT_GenStub_AddParam(CS_GetTableResTblEntryByName, CS_Res_Tables_Table_Entry_t **, EntryPtr); + UT_GenStub_AddParam(CS_GetTableResTblEntryByName, const char *, Name); + + UT_GenStub_Execute(CS_GetTableResTblEntryByName, Basic, NULL); + + return UT_GenStub_GetReturnValue(CS_GetTableResTblEntryByName, bool); } -bool CS_FindEnabledAppEntry(uint16 *EnabledEntry) +/* + * ---------------------------------------------------- + * Generated stub function for CS_GetTableTypeAsString() + * ---------------------------------------------------- + */ +const char *CS_GetTableTypeAsString(uint32 TableId) { - UT_Stub_RegisterContext(UT_KEY(CS_FindEnabledAppEntry), EnabledEntry); - return UT_DEFAULT_IMPL(CS_FindEnabledAppEntry); + UT_GenStub_SetupReturnBuffer(CS_GetTableTypeAsString, const char *); + + UT_GenStub_AddParam(CS_GetTableTypeAsString, uint32, TableId); + + UT_GenStub_Execute(CS_GetTableTypeAsString, Basic, NULL); + + return UT_GenStub_GetReturnValue(CS_GetTableTypeAsString, const char *); } -bool CS_VerifyCmdLength(const CFE_MSG_Message_t *Msg, size_t ExpectedLength) +/* + * ---------------------------------------------------- + * Generated stub function for CS_GoToNextTable() + * ---------------------------------------------------- + */ +void CS_GoToNextTable(void) { - UT_Stub_RegisterContext(UT_KEY(CS_VerifyCmdLength), Msg); - UT_Stub_RegisterContextGenericArg(UT_KEY(CS_VerifyCmdLength), ExpectedLength); - return UT_DEFAULT_IMPL(CS_VerifyCmdLength); + UT_GenStub_Execute(CS_GoToNextTable, Basic, NULL); } -bool CS_BackgroundOS(void) +/* + * ---------------------------------------------------- + * Generated stub function for CS_HandleRoutineTableUpdates() + * ---------------------------------------------------- + */ +CFE_Status_t CS_HandleRoutineTableUpdates(void) { - return UT_DEFAULT_IMPL(CS_BackgroundOS); + UT_GenStub_SetupReturnBuffer(CS_HandleRoutineTableUpdates, CFE_Status_t); + + UT_GenStub_Execute(CS_HandleRoutineTableUpdates, Basic, NULL); + + return UT_GenStub_GetReturnValue(CS_HandleRoutineTableUpdates, CFE_Status_t); } -bool CS_BackgroundCfeCore(void) +/* + * ---------------------------------------------------- + * Generated stub function for CS_InitializeDefaultTables() + * ---------------------------------------------------- + */ +void CS_InitializeDefaultTables(void) { - return UT_DEFAULT_IMPL(CS_BackgroundCfeCore); + + UT_GenStub_Execute(CS_InitializeDefaultTables, Basic, NULL); } -bool CS_BackgroundEeprom(void) +/* + * ---------------------------------------------------- + * Generated stub function for CS_ResetTablesTblResultEntry() + * ---------------------------------------------------- + */ +void CS_ResetTablesTblResultEntry(CS_Res_Tables_Table_Entry_t *TablesTblResultEntry) { - return UT_DEFAULT_IMPL(CS_BackgroundEeprom); + UT_GenStub_AddParam(CS_ResetTablesTblResultEntry, CS_Res_Tables_Table_Entry_t *, TablesTblResultEntry); + + UT_GenStub_Execute(CS_ResetTablesTblResultEntry, Basic, NULL); } -bool CS_BackgroundMemory(void) +/* + * ---------------------------------------------------- + * Generated stub function for CS_VerifyCmdLength() + * ---------------------------------------------------- + */ +bool CS_VerifyCmdLength(const CFE_MSG_Message_t *msg, size_t ExpectedLength) { - return UT_DEFAULT_IMPL(CS_BackgroundMemory); + UT_GenStub_SetupReturnBuffer(CS_VerifyCmdLength, bool); + + UT_GenStub_AddParam(CS_VerifyCmdLength, const CFE_MSG_Message_t *, msg); + UT_GenStub_AddParam(CS_VerifyCmdLength, size_t, ExpectedLength); + + UT_GenStub_Execute(CS_VerifyCmdLength, Basic, NULL); + + return UT_GenStub_GetReturnValue(CS_VerifyCmdLength, bool); } -bool CS_BackgroundTables(void) +/* + * ---------------------------------------------------- + * Generated stub function for CS_ZeroAppTempValues() + * ---------------------------------------------------- + */ +void CS_ZeroAppTempValues(void) { - return UT_DEFAULT_IMPL(CS_BackgroundTables); + + UT_GenStub_Execute(CS_ZeroAppTempValues, Basic, NULL); } -bool CS_BackgroundApp(void) +/* + * ---------------------------------------------------- + * Generated stub function for CS_ZeroCfeCoreTempValues() + * ---------------------------------------------------- + */ +void CS_ZeroCfeCoreTempValues(void) { - return UT_DEFAULT_IMPL(CS_BackgroundApp); + + UT_GenStub_Execute(CS_ZeroCfeCoreTempValues, Basic, NULL); } -void CS_ResetTablesTblResultEntry(CS_Res_Tables_Table_Entry_t *TablesTblResultEntry) +/* + * ---------------------------------------------------- + * Generated stub function for CS_ZeroEepromTempValues() + * ---------------------------------------------------- + */ +void CS_ZeroEepromTempValues(void) { - UT_Stub_RegisterContext(UT_KEY(CS_ResetTablesTblResultEntry), TablesTblResultEntry); - UT_DEFAULT_IMPL(CS_ResetTablesTblResultEntry); + UT_GenStub_Execute(CS_ZeroEepromTempValues, Basic, NULL); } -CFE_Status_t CS_HandleRoutineTableUpdates(void) +/* + * ---------------------------------------------------- + * Generated stub function for CS_ZeroMemoryTempValues() + * ---------------------------------------------------- + */ +void CS_ZeroMemoryTempValues(void) { - return UT_DEFAULT_IMPL(CS_HandleRoutineTableUpdates); + + UT_GenStub_Execute(CS_ZeroMemoryTempValues, Basic, NULL); } -CFE_Status_t CS_AttemptTableReshare(CS_Res_Tables_Table_Entry_t *ResultsEntry, CFE_TBL_Handle_t *LocalTblHandle, - CFE_TBL_Info_t *TblInfo, cpuaddr *LocalAddress, int32 *ResultGetInfo) +/* + * ---------------------------------------------------- + * Generated stub function for CS_ZeroOSTempValues() + * ---------------------------------------------------- + */ +void CS_ZeroOSTempValues(void) { - UT_Stub_RegisterContext(UT_KEY(CS_AttemptTableReshare), ResultsEntry); - UT_Stub_RegisterContext(UT_KEY(CS_AttemptTableReshare), LocalTblHandle); - UT_Stub_RegisterContext(UT_KEY(CS_AttemptTableReshare), TblInfo); - UT_Stub_RegisterContext(UT_KEY(CS_AttemptTableReshare), LocalAddress); - UT_Stub_RegisterContext(UT_KEY(CS_AttemptTableReshare), ResultGetInfo); - return UT_DEFAULT_IMPL(CS_AttemptTableReshare); + UT_GenStub_Execute(CS_ZeroOSTempValues, Basic, NULL); } -bool CS_CheckRecomputeOneshot(void) +/* + * ---------------------------------------------------- + * Generated stub function for CS_ZeroTablesTempValues() + * ---------------------------------------------------- + */ +void CS_ZeroTablesTempValues(void) { - return UT_DEFAULT_IMPL(CS_CheckRecomputeOneshot); + + UT_GenStub_Execute(CS_ZeroTablesTempValues, Basic, NULL); }