From ace7b1a4979c8ec64fb343de0b21f7bd91eb1306 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Wed, 10 Jan 2024 15:21:52 -0500 Subject: [PATCH] Fix #430, correct type mismatches Correction for various type mismatches across CF. Notably, many iterators do not use the CFE_Status_t return type, it should be a custom enum. --- fsw/src/cf_cfdp.c | 20 ++--- fsw/src/cf_cfdp.h | 6 +- fsw/src/cf_clist.c | 4 +- fsw/src/cf_clist.h | 21 ++++- fsw/src/cf_cmd.c | 90 ++++++++++--------- fsw/src/cf_cmd.h | 70 +++++++++------ fsw/src/cf_utils.c | 25 +++--- fsw/src/cf_utils.h | 18 ++-- unit-test/cf_cfdp_tests.c | 6 +- unit-test/cf_clist_tests.c | 8 +- unit-test/cf_cmd_tests.c | 150 ++++++++++++++----------------- unit-test/cf_utils_tests.c | 8 +- unit-test/stubs/cf_cfdp_stubs.c | 18 ++-- unit-test/stubs/cf_cmd_stubs.c | 74 +++++++-------- unit-test/stubs/cf_utils_stubs.c | 38 ++++---- 15 files changed, 284 insertions(+), 272 deletions(-) diff --git a/fsw/src/cf_cfdp.c b/fsw/src/cf_cfdp.c index 83a1078d..c79fa8d3 100644 --- a/fsw/src/cf_cfdp.c +++ b/fsw/src/cf_cfdp.c @@ -1054,15 +1054,15 @@ CFE_Status_t CF_CFDP_InitEngine(void) * See description in cf_cfdp.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_CFDP_CycleTxFirstActive(CF_CListNode_t *node, void *context) +CF_CListTraverse_Status_t CF_CFDP_CycleTxFirstActive(CF_CListNode_t *node, void *context) { - CF_CFDP_CycleTx_args_t *args = (CF_CFDP_CycleTx_args_t *)context; - CF_Transaction_t * txn = container_of(node, CF_Transaction_t, cl_node); - CFE_Status_t ret = 1; /* default option is exit traversal */ + CF_CFDP_CycleTx_args_t * args = (CF_CFDP_CycleTx_args_t *)context; + CF_Transaction_t * txn = container_of(node, CF_Transaction_t, cl_node); + CF_CListTraverse_Status_t ret = CF_CLIST_EXIT; /* default option is exit traversal */ if (txn->flags.com.suspended) { - ret = 0; /* suspended, so move on to next */ + ret = CF_CLIST_CONT; /* suspended, so move on to next */ } else { @@ -1133,11 +1133,11 @@ void CF_CFDP_CycleTx(CF_Channel_t *chan) * See description in cf_cfdp.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_CFDP_DoTick(CF_CListNode_t *node, void *context) +CF_CListTraverse_Status_t CF_CFDP_DoTick(CF_CListNode_t *node, void *context) { - CFE_Status_t ret = CF_CLIST_CONT; /* CF_CLIST_CONT means don't tick one, keep looking for cur */ - CF_CFDP_Tick_args_t *args = (CF_CFDP_Tick_args_t *)context; - CF_Transaction_t * txn = container_of(node, CF_Transaction_t, cl_node); + CF_CListTraverse_Status_t ret = CF_CLIST_CONT; /* CF_CLIST_CONT means don't tick one, keep looking for cur */ + CF_CFDP_Tick_args_t * args = (CF_CFDP_Tick_args_t *)context; + CF_Transaction_t * txn = container_of(node, CF_Transaction_t, cl_node); if (!args->chan->cur || (args->chan->cur == txn)) { /* found where we left off, so clear that and move on */ @@ -1787,7 +1787,7 @@ void CF_CFDP_CancelTransaction(CF_Transaction_t *txn) * See description in cf_cfdp.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_CFDP_CloseFiles(CF_CListNode_t *node, void *context) +CF_CListTraverse_Status_t CF_CFDP_CloseFiles(CF_CListNode_t *node, void *context) { CF_Transaction_t *txn = container_of(node, CF_Transaction_t, cl_node); if (OS_ObjectIdDefined(txn->fd)) diff --git a/fsw/src/cf_cfdp.h b/fsw/src/cf_cfdp.h index de6a65c4..1fa54db0 100644 --- a/fsw/src/cf_cfdp.h +++ b/fsw/src/cf_cfdp.h @@ -602,7 +602,7 @@ void CF_CFDP_RecvIdle(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); * @returns integer traversal code * @retval Always CF_LIST_CONT indicate list traversal should not exit early. */ -CFE_Status_t CF_CFDP_CloseFiles(CF_CListNode_t *node, void *context); +CF_CListTraverse_Status_t CF_CFDP_CloseFiles(CF_CListNode_t *node, void *context); /************************************************************************/ /** @brief Cycle the current active tx or make a new one active. @@ -640,7 +640,7 @@ void CF_CFDP_CycleTx(CF_Channel_t *chan); * @retval CF_CLIST_EXIT when it's found, which terminates list traversal * @retval CF_CLIST_CONT when it's isn't found, which causes list traversal to continue */ -CFE_Status_t CF_CFDP_CycleTxFirstActive(CF_CListNode_t *node, void *context); +CF_CListTraverse_Status_t CF_CFDP_CycleTxFirstActive(CF_CListNode_t *node, void *context); /************************************************************************/ /** @brief Call R and then S tick functions for all active transactions. @@ -701,6 +701,6 @@ void CF_CFDP_ProcessPollingDirectories(CF_Channel_t *chan); * @retval CF_CLIST_EXIT when it's found, which terminates list traversal * @retval CF_CLIST_CONT when it's isn't found, which causes list traversal to continue */ -CFE_Status_t CF_CFDP_DoTick(CF_CListNode_t *node, void *context); +CF_CListTraverse_Status_t CF_CFDP_DoTick(CF_CListNode_t *node, void *context); #endif /* !CF_CFDP_H */ diff --git a/fsw/src/cf_clist.c b/fsw/src/cf_clist.c index b7c99007..5f7a25e4 100644 --- a/fsw/src/cf_clist.c +++ b/fsw/src/cf_clist.c @@ -202,7 +202,7 @@ void CF_CList_Traverse(CF_CListNode_t *start, CF_CListFn_t fn, void *context) { last = 1; } - if (fn(node, context)) + if (!CF_CListTraverse_Status_IS_CONTINUE(fn(node, context))) { break; } @@ -246,7 +246,7 @@ void CF_CList_Traverse_R(CF_CListNode_t *end, CF_CListFn_t fn, void *context) last = 1; } - if (fn(node, context)) + if (!CF_CListTraverse_Status_IS_CONTINUE(fn(node, context))) { break; } diff --git a/fsw/src/cf_clist.h b/fsw/src/cf_clist.h index a9c12772..9dc5a662 100644 --- a/fsw/src/cf_clist.h +++ b/fsw/src/cf_clist.h @@ -27,9 +27,24 @@ #define CF_CLIST_H #include +#include -#define CF_CLIST_CONT (0) /**< \brief Constant indicating to continue traversal */ -#define CF_CLIST_EXIT (1) /**< \brief Constant indicating to stop traversal */ +typedef enum +{ + CF_CListTraverse_Status_CONTINUE = 0, + CF_CListTraverse_Status_EXIT = 1 +} CF_CListTraverse_Status_t; + +#define CF_CLIST_CONT CF_CListTraverse_Status_CONTINUE /**< \brief Constant indicating to continue traversal */ +#define CF_CLIST_EXIT CF_CListTraverse_Status_EXIT /**< \brief Constant indicating to stop traversal */ + +/** + * Checks if the list traversal should continue + */ +static inline bool CF_CListTraverse_Status_IS_CONTINUE(CF_CListTraverse_Status_t stat) +{ + return (stat == CF_CListTraverse_Status_CONTINUE); +} /** * @brief Node link structure @@ -63,7 +78,7 @@ typedef struct CF_CListNode CF_CListNode_t; * @retval #CF_CLIST_CONT Indicates to continue traversing the list * @retval #CF_CLIST_EXIT Indicates to stop traversing the list */ -typedef int (*CF_CListFn_t)(CF_CListNode_t *node, void *context); +typedef CF_CListTraverse_Status_t (*CF_CListFn_t)(CF_CListNode_t *node, void *context); /************************************************************************/ /** @brief Initialize a clist node. diff --git a/fsw/src/cf_cmd.c b/fsw/src/cf_cmd.c index d44f23e9..26020994 100644 --- a/fsw/src/cf_cmd.c +++ b/fsw/src/cf_cmd.c @@ -216,11 +216,11 @@ void CF_PlaybackDirCmd(const CF_PlaybackDirCmd_t *msg) * See description in cf_cmd.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_DoChanAction(const CF_UnionArgs_Payload_t *data, const char *errstr, CF_ChanActionFn_t fn, - void *context) +CF_ChanAction_Status_t CF_DoChanAction(const CF_UnionArgs_Payload_t *data, const char *errstr, CF_ChanActionFn_t fn, + void *context) { - int i; - CFE_Status_t ret = 0; + int i; + CF_ChanAction_Status_t ret = CF_ChanAction_Status_SUCCESS; /* this function is generic for any ground command that takes a single channel * argument which must be less than CF_NUM_CHANNELS or 255 which is a special @@ -240,7 +240,7 @@ CFE_Status_t CF_DoChanAction(const CF_UnionArgs_Payload_t *data, const char *err /* bad parameter */ CFE_EVS_SendEvent(CF_EID_ERR_CMD_CHAN_PARAM, CFE_EVS_EventType_ERROR, "CF: %s: channel parameter out of range. received %d", errstr, data->byte[0]); - ret = -1; + ret = CF_ChanAction_Status_ERROR; } return ret; @@ -252,11 +252,12 @@ CFE_Status_t CF_DoChanAction(const CF_UnionArgs_Payload_t *data, const char *err * See description in cf_cmd.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_DoFreezeThaw(uint8 chan_num, const CF_ChanAction_BoolArg_t *context) +CF_ChanAction_Status_t CF_DoFreezeThaw(uint8 chan_num, void *arg) { + const CF_ChanAction_BoolArg_t *context = arg; /* no need to bounds check chan_num, done in caller */ CF_AppData.hk.Payload.channel_hk[chan_num].frozen = context->barg; - return CFE_SUCCESS; + return CF_ChanAction_Status_SUCCESS; } /*---------------------------------------------------------------- @@ -269,7 +270,7 @@ void CF_FreezeCmd(const CF_FreezeCmd_t *msg) { CF_ChanAction_BoolArg_t barg = {1}; /* param is frozen, so 1 means freeze */ - if (CF_DoChanAction(&msg->Payload, "freeze", (CF_ChanActionFn_t)CF_DoFreezeThaw, &barg) == CFE_SUCCESS) + if (CF_ChanAction_Status_IS_SUCCESS(CF_DoChanAction(&msg->Payload, "freeze", CF_DoFreezeThaw, &barg))) { CFE_EVS_SendEvent(CF_EID_INF_CMD_FREEZE, CFE_EVS_EventType_INFORMATION, "CF: freeze successful"); ++CF_AppData.hk.Payload.counters.cmd; @@ -291,7 +292,7 @@ void CF_ThawCmd(const CF_ThawCmd_t *msg) { CF_ChanAction_BoolArg_t barg = {0}; /* param is frozen, so 0 means thawed */ - if (CF_DoChanAction(&msg->Payload, "thaw", (CF_ChanActionFn_t)CF_DoFreezeThaw, &barg) == CFE_SUCCESS) + if (CF_ChanAction_Status_IS_SUCCESS(CF_DoChanAction(&msg->Payload, "thaw", CF_DoFreezeThaw, &barg))) { CFE_EVS_SendEvent(CF_EID_INF_CMD_THAW, CFE_EVS_EventType_INFORMATION, "CF: thaw successful"); ++CF_AppData.hk.Payload.counters.cmd; @@ -337,11 +338,11 @@ CF_Transaction_t *CF_FindTransactionBySequenceNumberAllChannels(CF_TransactionSe * See description in cf_cmd.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_TsnChanAction(const CF_Transaction_Payload_t *data, const char *cmdstr, CF_TsnChanAction_fn_t fn, - void *context) +int32 CF_TsnChanAction(const CF_Transaction_Payload_t *data, const char *cmdstr, CF_TsnChanAction_fn_t fn, + void *context) { CF_Transaction_t *txn; - CFE_Status_t ret = CF_ERROR; + int32 ret = -1; if (data->chan == CF_COMPOUND_KEY) { @@ -533,11 +534,12 @@ void CF_AbandonCmd(const CF_AbandonCmd_t *msg) * See description in cf_cmd.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_DoEnableDisableDequeue(uint8 chan_num, const CF_ChanAction_BoolArg_t *context) +CF_ChanAction_Status_t CF_DoEnableDisableDequeue(uint8 chan_num, void *arg) { + const CF_ChanAction_BoolArg_t *context = arg; /* no need to bounds check chan_num, done in caller */ CF_AppData.config_table->chan[chan_num].dequeue_enabled = context->barg; - return CFE_SUCCESS; + return CF_ChanAction_Status_SUCCESS; } /*---------------------------------------------------------------- @@ -550,8 +552,8 @@ void CF_EnableDequeueCmd(const CF_EnableDequeueCmd_t *msg) { CF_ChanAction_BoolArg_t barg = {1}; - if (CF_DoChanAction(&msg->Payload, "enable_dequeue", (CF_ChanActionFn_t)CF_DoEnableDisableDequeue, &barg) == - CFE_SUCCESS) + if (CF_ChanAction_Status_IS_SUCCESS( + CF_DoChanAction(&msg->Payload, "enable_dequeue", CF_DoEnableDisableDequeue, &barg))) { CFE_EVS_SendEvent(CF_EID_INF_CMD_ENABLE_DEQUEUE, CFE_EVS_EventType_INFORMATION, "CF: dequeue enabled"); ++CF_AppData.hk.Payload.counters.cmd; @@ -573,8 +575,8 @@ void CF_DisableDequeueCmd(const CF_DisableDequeueCmd_t *msg) { CF_ChanAction_BoolArg_t barg = {0}; - if (CF_DoChanAction(&msg->Payload, "disable_dequeue", (CF_ChanActionFn_t)CF_DoEnableDisableDequeue, &barg) == - CFE_SUCCESS) + if (CF_ChanAction_Status_IS_SUCCESS( + CF_DoChanAction(&msg->Payload, "disable_dequeue", CF_DoEnableDisableDequeue, &barg))) { CFE_EVS_SendEvent(CF_EID_INF_CMD_DISABLE_DEQUEUE, CFE_EVS_EventType_INFORMATION, "CF: dequeue disabled"); ++CF_AppData.hk.Payload.counters.cmd; @@ -592,10 +594,11 @@ void CF_DisableDequeueCmd(const CF_DisableDequeueCmd_t *msg) * See description in cf_cmd.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_DoEnableDisablePolldir(uint8 chan_num, const CF_ChanAction_BoolMsgArg_t *context) +CF_ChanAction_Status_t CF_DoEnableDisablePolldir(uint8 chan_num, void *arg) { - int i; - CFE_Status_t ret = CFE_SUCCESS; + int i; + const CF_ChanAction_BoolMsgArg_t *context = arg; + CF_ChanAction_Status_t ret = CF_ChanAction_Status_SUCCESS; /* no need to bounds check chan_num, done in caller */ if (context->data->byte[1] == CF_ALL_POLLDIRS) { @@ -612,7 +615,7 @@ CFE_Status_t CF_DoEnableDisablePolldir(uint8 chan_num, const CF_ChanAction_BoolM CFE_EVS_SendEvent(CF_EID_ERR_CMD_POLLDIR_INVALID, CFE_EVS_EventType_ERROR, "CF: enable/disable polldir: invalid polldir %d on channel %d", context->data->byte[1], chan_num); - ret = CF_ERROR; + ret = CF_ChanAction_Status_ERROR; } return ret; @@ -628,8 +631,8 @@ void CF_EnablePolldirCmd(const CF_EnableDirPollingCmd_t *msg) { CF_ChanAction_BoolMsgArg_t barg = {&msg->Payload, 1}; - if (CF_DoChanAction(&msg->Payload, "enable_polldir", (CF_ChanActionFn_t)CF_DoEnableDisablePolldir, &barg) == - CFE_SUCCESS) + if (CF_ChanAction_Status_IS_SUCCESS( + CF_DoChanAction(&msg->Payload, "enable_polldir", CF_DoEnableDisablePolldir, &barg))) { CFE_EVS_SendEvent(CF_EID_INF_CMD_ENABLE_POLLDIR, CFE_EVS_EventType_INFORMATION, "CF: enabled polling directory"); @@ -653,8 +656,8 @@ void CF_DisablePolldirCmd(const CF_DisableDirPollingCmd_t *msg) { CF_ChanAction_BoolMsgArg_t barg = {&msg->Payload, 0}; - if (CF_DoChanAction(&msg->Payload, "disable_polldir", (CF_ChanActionFn_t)CF_DoEnableDisablePolldir, &barg) == - CFE_SUCCESS) + if (CF_ChanAction_Status_IS_SUCCESS( + CF_DoChanAction(&msg->Payload, "disable_polldir", CF_DoEnableDisablePolldir, &barg))) { CFE_EVS_SendEvent(CF_EID_INF_CMD_DISABLE_POLLDIR, CFE_EVS_EventType_INFORMATION, "CF: disabled polling directory"); @@ -674,8 +677,9 @@ void CF_DisablePolldirCmd(const CF_DisableDirPollingCmd_t *msg) * See description in cf_cmd.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_PurgeHistory(CF_CListNode_t *node, CF_Channel_t *chan) +CF_CListTraverse_Status_t CF_PurgeHistory(CF_CListNode_t *node, void *arg) { + CF_Channel_t *chan = arg; CF_History_t *history = container_of(node, CF_History_t, cl_node); CF_ResetHistory(chan, history); /* ok to reset transaction since it's in PEND it hasn't started yet */ return CF_CLIST_CONT; @@ -687,7 +691,7 @@ CFE_Status_t CF_PurgeHistory(CF_CListNode_t *node, CF_Channel_t *chan) * See description in cf_cmd.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_PurgeTransaction(CF_CListNode_t *node, void *ignored) +CF_CListTraverse_Status_t CF_PurgeTransaction(CF_CListNode_t *node, void *ignored) { CF_Transaction_t *txn = container_of(node, CF_Transaction_t, cl_node); CF_CFDP_ResetTransaction(txn, 0); @@ -700,9 +704,9 @@ CFE_Status_t CF_PurgeTransaction(CF_CListNode_t *node, void *ignored) * See description in cf_cmd.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_DoPurgeQueue(uint8 chan_num, void *arg) +CF_ChanAction_Status_t CF_DoPurgeQueue(uint8 chan_num, void *arg) { - CFE_Status_t ret = CFE_SUCCESS; + CF_ChanAction_Status_t ret = CF_ChanAction_Status_SUCCESS; /* no need to bounds check chan_num, done in caller */ CF_Channel_t * chan = &CF_AppData.engine.channels[chan_num]; const CF_UnionArgs_Payload_t *data = ((CF_ChanAction_MsgArg_t *)arg)->data; @@ -728,7 +732,7 @@ CFE_Status_t CF_DoPurgeQueue(uint8 chan_num, void *arg) default: CFE_EVS_SendEvent(CF_EID_ERR_CMD_PURGE_ARG, CFE_EVS_EventType_ERROR, "CF: purge queue invalid arg %d", data->byte[1]); - ret = -1; + ret = CF_ChanAction_Status_ERROR; break; } @@ -739,7 +743,7 @@ CFE_Status_t CF_DoPurgeQueue(uint8 chan_num, void *arg) if (hist) { - CF_CList_Traverse(chan->qs[CF_QueueIdx_HIST], (CF_CListFn_t)CF_PurgeHistory, chan); + CF_CList_Traverse(chan->qs[CF_QueueIdx_HIST], CF_PurgeHistory, chan); } return ret; @@ -754,7 +758,7 @@ CFE_Status_t CF_DoPurgeQueue(uint8 chan_num, void *arg) void CF_PurgeQueueCmd(const CF_PurgeQueueCmd_t *msg) { CF_ChanAction_MsgArg_t arg = {&msg->Payload}; - if (CF_DoChanAction(&msg->Payload, "purge_queue", (CF_ChanActionFn_t)CF_DoPurgeQueue, &arg) == CFE_SUCCESS) + if (CF_ChanAction_Status_IS_SUCCESS(CF_DoChanAction(&msg->Payload, "purge_queue", CF_DoPurgeQueue, &arg))) { CFE_EVS_SendEvent(CF_EID_INF_CMD_PURGE_QUEUE, CFE_EVS_EventType_INFORMATION, "CF: queue purged"); ++CF_AppData.hk.Payload.counters.cmd; @@ -906,12 +910,12 @@ void CF_WriteQueueCmd(const CF_WriteQueueCmd_t *msg) * See description in cf_cmd.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_CmdValidateChunkSize(uint32 val, uint8 chan_num /* ignored */) +CF_ChanAction_Status_t CF_CmdValidateChunkSize(uint32 val, uint8 chan_num /* ignored */) { - CFE_Status_t ret = CFE_SUCCESS; + CF_ChanAction_Status_t ret = CF_ChanAction_Status_SUCCESS; if (val > sizeof(CF_CFDP_PduFileDataContent_t)) { - ret = CF_ERROR; /* failed */ + ret = CF_ChanAction_Status_ERROR; /* failed */ } return ret; } @@ -922,14 +926,14 @@ CFE_Status_t CF_CmdValidateChunkSize(uint32 val, uint8 chan_num /* ignored */) * See description in cf_cmd.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_CmdValidateMaxOutgoing(uint32 val, uint8 chan_num) +CF_ChanAction_Status_t CF_CmdValidateMaxOutgoing(uint32 val, uint8 chan_num) { - CFE_Status_t ret = CFE_SUCCESS; + CF_ChanAction_Status_t ret = CF_ChanAction_Status_SUCCESS; if (!val && !CF_AppData.config_table->chan[chan_num].sem_name[0]) { /* can't have unlimited messages and no semaphore */ - ret = CF_ERROR; /* failed */ + ret = CF_ChanAction_Status_ERROR; /* failed */ } return ret; @@ -950,7 +954,7 @@ void CF_GetSetParamCmd(uint8 is_set, CF_GetSet_ValueID_t param_id, uint32 value, { void * ptr; uint32 size; - int (*fn)(uint32, uint8 chan_num); + CF_ChanAction_Status_t (*fn)(uint32, uint8 chan_num); } item; valid_set = false; @@ -1019,7 +1023,7 @@ void CF_GetSetParamCmd(uint8 is_set, CF_GetSet_ValueID_t param_id, uint32 value, { if (item.fn) { - if (!item.fn(value, chan_num)) + if (CF_ChanAction_Status_IS_SUCCESS(item.fn(value, chan_num))) { valid_set = 1; } @@ -1260,8 +1264,8 @@ void CF_ProcessGroundCommand(CFE_SB_Buffer_t *msg) } else { - CFE_EVS_SendEvent(CF_CC_ERR_EID, CFE_EVS_EventType_ERROR, - "CF: invalid ground command packet cmd_code=0x%02x", cmd); + CFE_EVS_SendEvent(CF_CC_ERR_EID, CFE_EVS_EventType_ERROR, "CF: invalid ground command packet cmd_code=0x%02x", + cmd); ++CF_AppData.hk.Payload.counters.err; } } diff --git a/fsw/src/cf_cmd.h b/fsw/src/cf_cmd.h index b1aad7ab..30f4b9f0 100644 --- a/fsw/src/cf_cmd.h +++ b/fsw/src/cf_cmd.h @@ -30,13 +30,27 @@ #include "cf_app.h" #include "cf_utils.h" +typedef enum +{ + CF_ChanAction_Status_SUCCESS = 0, + CF_ChanAction_Status_ERROR = -1 +} CF_ChanAction_Status_t; + +/** + * Checks if the channel action was successful + */ +static inline bool CF_ChanAction_Status_IS_SUCCESS(CF_ChanAction_Status_t stat) +{ + return (stat == CF_ChanAction_Status_SUCCESS); +} + /** * @brief A callback function for use with CF_DoChanAction() * * @param chan_num The CF channel number, for statistics purposes * @param context Opaque object passed through from initial call */ -typedef int (*CF_ChanActionFn_t)(uint8 chan_num, void *context); +typedef CF_ChanAction_Status_t (*CF_ChanActionFn_t)(uint8 chan_num, void *context); /** * @brief An object to use with channel-scope actions requiring only a boolean argument @@ -165,10 +179,10 @@ void CF_PlaybackDirCmd(const CF_PlaybackDirCmd_t *msg); * @param context Opaque pointer to pass through to callback (not used in this function) * * @returns The return value from the given action function. - * @retval CF_ERROR on error + * @retval CF_ChanAction_Status_ERROR on error */ -CFE_Status_t CF_DoChanAction(const CF_UnionArgs_Payload_t *data, const char *errstr, CF_ChanActionFn_t fn, - void *context); +CF_ChanAction_Status_t CF_DoChanAction(const CF_UnionArgs_Payload_t *data, const char *errstr, CF_ChanActionFn_t fn, + void *context); /************************************************************************/ /** @brief Channel action to set the frozen bit for a channel. @@ -177,11 +191,11 @@ CFE_Status_t CF_DoChanAction(const CF_UnionArgs_Payload_t *data, const char *err * context must not be NULL. * * @param chan_num channel number - * @param context Pointer to object passed through from initial call + * @param arg context pointer to object, must be CF_ChanAction_BoolArg_t* * - * @returns Always succeeds, so returns CFE_SUCCESS. + * @returns Always succeeds, so returns CF_ChanAction_Status_SUCCESS. */ -CFE_Status_t CF_DoFreezeThaw(uint8 chan_num, const CF_ChanAction_BoolArg_t *context); +CF_ChanAction_Status_t CF_DoFreezeThaw(uint8 chan_num, void *arg); /************************************************************************/ /** @brief Freeze a channel. @@ -237,8 +251,8 @@ CF_Transaction_t *CF_FindTransactionBySequenceNumberAllChannels(CF_TransactionSe * @returns returns the number of transactions acted upon * */ -CFE_Status_t CF_TsnChanAction(const CF_Transaction_Payload_t *data, const char *cmdstr, CF_TsnChanAction_fn_t fn, - void *context); +int32 CF_TsnChanAction(const CF_Transaction_Payload_t *data, const char *cmdstr, CF_TsnChanAction_fn_t fn, + void *context); /************************************************************************/ /** @brief Set the suspended bit in a transaction. @@ -339,12 +353,12 @@ void CF_AbandonCmd(const CF_AbandonCmd_t *msg); * context must not be NULL. * * @param chan_num channel number - * @param context Pointer to object passed through from initial call + * @param arg context pointer to object, must be CF_ChanAction_BoolArg_t* * - * @returns Always succeeds, so returns CFE_SUCCESS. + * @returns Always succeeds, so returns CF_ChanAction_Status_SUCCESS. * */ -CFE_Status_t CF_DoEnableDisableDequeue(uint8 chan_num, const CF_ChanAction_BoolArg_t *context); +CF_ChanAction_Status_t CF_DoEnableDisableDequeue(uint8 chan_num, void *arg); /************************************************************************/ /** @brief Handle an enable dequeue ground command. @@ -373,13 +387,13 @@ void CF_DisableDequeueCmd(const CF_DisableDequeueCmd_t *msg); * context must not be NULL. * * @param chan_num channel number - * @param context Pointer to object passed through from initial call + * @param arg context pointer to object, must be CF_ChanAction_BoolMsgArg_t* * * @returns success/fail status code - * @retval CFE_SUCCESS if successful - * @retval CF_ERROR if failed + * @retval CF_ChanAction_Status_SUCCESS if successful + * @retval CF_ChanAction_Status_ERROR if failed */ -CFE_Status_t CF_DoEnableDisablePolldir(uint8 chan_num, const CF_ChanAction_BoolMsgArg_t *context); +CF_ChanAction_Status_t CF_DoEnableDisablePolldir(uint8 chan_num, void *arg); /************************************************************************/ /** @brief Enable a polling dir ground command. @@ -410,11 +424,11 @@ void CF_DisablePolldirCmd(const CF_DisableDirPollingCmd_t *msg); * node must not be NULL. chan must not be NULL. * * @param node Current list node being traversed - * @param chan Channel pointer passed through as opaque object + * @param arg Channel pointer passed through as opaque object, must be CF_Channel_t* * * @returns Always #CF_CLIST_CONT to process all entries */ -CFE_Status_t CF_PurgeHistory(CF_CListNode_t *node, CF_Channel_t *chan); +CF_CListTraverse_Status_t CF_PurgeHistory(CF_CListNode_t *node, void *arg); /************************************************************************/ /** @brief Purge the pending transaction queue. @@ -429,7 +443,7 @@ CFE_Status_t CF_PurgeHistory(CF_CListNode_t *node, CF_Channel_t *chan); * * @returns Always #CF_CLIST_CONT to process all entries */ -CFE_Status_t CF_PurgeTransaction(CF_CListNode_t *node, void *ignored); +CF_CListTraverse_Status_t CF_PurgeTransaction(CF_CListNode_t *node, void *ignored); /************************************************************************/ /** @brief Channel action command to perform purge queue operations. @@ -445,10 +459,10 @@ CFE_Status_t CF_PurgeTransaction(CF_CListNode_t *node, void *ignored); * @param arg Pointer to purge queue command * * @returns integer status code indicating success or failure - * @retval CFE_SUCCESS if successful - * @retval CF_ERROR on error + * @retval CF_ChanAction_Status_SUCCESS if successful + * @retval CF_ChanAction_Status_ERROR on error */ -CFE_Status_t CF_DoPurgeQueue(uint8 chan_num, void *arg); +CF_ChanAction_Status_t CF_DoPurgeQueue(uint8 chan_num, void *arg); /************************************************************************/ /** @brief Ground command to purge either the history or pending queues. @@ -480,11 +494,11 @@ void CF_WriteQueueCmd(const CF_WriteQueueCmd_t *msg); * @param chan_num Ignored by this implementation * * @returns status code indicating if check passed - * @retval CFE_SUCCESS if successful (val is less than or equal to max PDU) - * @retval CF_ERROR if failed (val is greater than max PDU) + * @retval CF_ChanAction_Status_SUCCESS if successful (val is less than or equal to max PDU) + * @retval CF_ChanAction_Status_ERROR if failed (val is greater than max PDU) * */ -CFE_Status_t CF_CmdValidateChunkSize(uint32 val, uint8 chan_num); +CF_ChanAction_Status_t CF_CmdValidateChunkSize(uint32 val, uint8 chan_num); /************************************************************************/ /** @brief Checks if the value is within allowable range as outgoing packets per wakeup @@ -496,11 +510,11 @@ CFE_Status_t CF_CmdValidateChunkSize(uint32 val, uint8 chan_num); * @param chan_num CF channel number * * @returns status code indicating if check passed - * @retval CFE_SUCCESS if successful (val is allowable as max packets per wakeup) - * @retval CF_ERROR if failed (val is not allowed) + * @retval CF_ChanAction_Status_SUCCESS if successful (val is allowable as max packets per wakeup) + * @retval CF_ChanAction_Status_ERROR if failed (val is not allowed) * */ -CFE_Status_t CF_CmdValidateMaxOutgoing(uint32 val, uint8 chan_num); +CF_ChanAction_Status_t CF_CmdValidateMaxOutgoing(uint32 val, uint8 chan_num); /************************************************************************/ /** @brief Perform a configuration get/set operation. diff --git a/fsw/src/cf_utils.c b/fsw/src/cf_utils.c index b2a91d01..75624723 100644 --- a/fsw/src/cf_utils.c +++ b/fsw/src/cf_utils.c @@ -216,7 +216,7 @@ CFE_Status_t CF_WriteHistoryEntryToFile(osal_id_t fd, const CF_History_t *histor * See description in cf_utils.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_Traverse_WriteHistoryQueueEntryToFile(CF_CListNode_t *node, void *arg) +CF_CListTraverse_Status_t CF_Traverse_WriteHistoryQueueEntryToFile(CF_CListNode_t *node, void *arg) { CF_Traverse_WriteHistoryFileArg_t *context = arg; CF_History_t * history = container_of(node, CF_History_t, cl_node); @@ -243,7 +243,7 @@ CFE_Status_t CF_Traverse_WriteHistoryQueueEntryToFile(CF_CListNode_t *node, void * See description in cf_utils.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_Traverse_WriteTxnQueueEntryToFile(CF_CListNode_t *node, void *arg) +CF_CListTraverse_Status_t CF_Traverse_WriteTxnQueueEntryToFile(CF_CListNode_t *node, void *arg) { CF_Traverse_WriteTxnFileArg_t *context = arg; CF_Transaction_t * txn = container_of(node, CF_Transaction_t, cl_node); @@ -302,7 +302,7 @@ CFE_Status_t CF_WriteHistoryQueueDataToFile(osal_id_t fd, CF_Channel_t *chan, CF * See description in cf_utils.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_PrioSearch(CF_CListNode_t *node, void *context) +CF_CListTraverse_Status_t CF_PrioSearch(CF_CListNode_t *node, void *context) { CF_Transaction_t * txn = container_of(node, CF_Transaction_t, cl_node); CF_Traverse_PriorityArg_t *arg = (CF_Traverse_PriorityArg_t *)context; @@ -369,11 +369,12 @@ void CF_InsertSortPrio(CF_Transaction_t *txn, CF_QueueIdx_t queue) * See description in cf_utils.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_TraverseAllTransactions_Impl(CF_CListNode_t *node, CF_TraverseAll_Arg_t *args) +CF_CListTraverse_Status_t CF_TraverseAllTransactions_Impl(CF_CListNode_t *node, void *arg) { - CF_Transaction_t *txn = container_of(node, CF_Transaction_t, cl_node); - args->fn(txn, args->context); - ++args->counter; + CF_TraverseAll_Arg_t *traverse_all = arg; + CF_Transaction_t * txn = container_of(node, CF_Transaction_t, cl_node); + traverse_all->fn(txn, traverse_all->context); + ++traverse_all->counter; return CF_CLIST_CONT; } @@ -383,12 +384,12 @@ CFE_Status_t CF_TraverseAllTransactions_Impl(CF_CListNode_t *node, CF_TraverseAl * See description in cf_utils.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_TraverseAllTransactions(CF_Channel_t *chan, CF_TraverseAllTransactions_fn_t fn, void *context) +int32 CF_TraverseAllTransactions(CF_Channel_t *chan, CF_TraverseAllTransactions_fn_t fn, void *context) { CF_TraverseAll_Arg_t args = {fn, context, 0}; CF_QueueIdx_t queueidx; for (queueidx = CF_QueueIdx_PEND; queueidx <= CF_QueueIdx_RX; ++queueidx) - CF_CList_Traverse(chan->qs[queueidx], (CF_CListFn_t)CF_TraverseAllTransactions_Impl, &args); + CF_CList_Traverse(chan->qs[queueidx], CF_TraverseAllTransactions_Impl, &args); return args.counter; } @@ -399,10 +400,10 @@ CFE_Status_t CF_TraverseAllTransactions(CF_Channel_t *chan, CF_TraverseAllTransa * See description in cf_utils.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_TraverseAllTransactions_All_Channels(CF_TraverseAllTransactions_fn_t fn, void *context) +int32 CF_TraverseAllTransactions_All_Channels(CF_TraverseAllTransactions_fn_t fn, void *context) { - int i; - CFE_Status_t ret = 0; + int i; + int32 ret = 0; for (i = 0; i < CF_NUM_CHANNELS; ++i) ret += CF_TraverseAllTransactions(CF_AppData.engine.channels + i, fn, context); return ret; diff --git a/fsw/src/cf_utils.h b/fsw/src/cf_utils.h index 132225eb..fd839ce0 100644 --- a/fsw/src/cf_utils.h +++ b/fsw/src/cf_utils.h @@ -96,7 +96,7 @@ typedef struct CF_TraverseAll_Arg { CF_TraverseAllTransactions_fn_t fn; /**< \brief internal callback to use for each CList_Traverse */ void * context; /**< \brief opaque object to pass to internal callback */ - int counter; /**< \brief Running tally of all nodes traversed from all lists */ + int32 counter; /**< \brief Running tally of all nodes traversed from all lists */ } CF_TraverseAll_Arg_t; /** @@ -312,7 +312,7 @@ void CF_InsertSortPrio(CF_Transaction_t *txn, CF_QueueIdx_t queue); * * @returns Number of transactions traversed */ -CFE_Status_t CF_TraverseAllTransactions(CF_Channel_t *chan, CF_TraverseAllTransactions_fn_t fn, void *context); +int32 CF_TraverseAllTransactions(CF_Channel_t *chan, CF_TraverseAllTransactions_fn_t fn, void *context); /************************************************************************/ /** @brief Traverses all transactions on all channels and performs an operation on them. @@ -325,7 +325,7 @@ CFE_Status_t CF_TraverseAllTransactions(CF_Channel_t *chan, CF_TraverseAllTransa * * @returns Number of transactions traversed */ -CFE_Status_t CF_TraverseAllTransactions_All_Channels(CF_TraverseAllTransactions_fn_t fn, void *context); +int32 CF_TraverseAllTransactions_All_Channels(CF_TraverseAllTransactions_fn_t fn, void *context); /************************************************************************/ /** @brief List traversal function performs operation on every active transaction. @@ -337,12 +337,12 @@ CFE_Status_t CF_TraverseAllTransactions_All_Channels(CF_TraverseAllTransactions_ * @par Assumptions, External Events, and Notes: * node must not be NULL. args must not be NULL. * - * @param node Node being currently traversed - * @param args Intermediate context object from initial call + * @param node Node being currently traversed + * @param arg Intermediate context object from initial call * * @retval 0 for do not exit early (always continue) */ -CFE_Status_t CF_TraverseAllTransactions_Impl(CF_CListNode_t *node, CF_TraverseAll_Arg_t *args); +CF_CListTraverse_Status_t CF_TraverseAllTransactions_Impl(CF_CListNode_t *node, void *arg); /************************************************************************/ /** @brief Writes a human readable representation of a history queue entry to a file @@ -362,7 +362,7 @@ CFE_Status_t CF_TraverseAllTransactions_Impl(CF_CListNode_t *node, CF_TraverseAl * @retval CF_CLIST_CONT if everything is going well * @retval CF_CLIST_EXIT if a write error occurred, which means traversal should stop */ -CFE_Status_t CF_Traverse_WriteHistoryQueueEntryToFile(CF_CListNode_t *node, void *arg); +CF_CListTraverse_Status_t CF_Traverse_WriteHistoryQueueEntryToFile(CF_CListNode_t *node, void *arg); /************************************************************************/ /** @brief Writes a human readable representation of a transaction history entry to a file @@ -379,7 +379,7 @@ CFE_Status_t CF_Traverse_WriteHistoryQueueEntryToFile(CF_CListNode_t *node, void * @retval CF_CLIST_CONT if everything is going well * @retval CF_CLIST_EXIT if a write error occurred, which means traversal should stop */ -CFE_Status_t CF_Traverse_WriteTxnQueueEntryToFile(CF_CListNode_t *node, void *arg); +CF_CListTraverse_Status_t CF_Traverse_WriteTxnQueueEntryToFile(CF_CListNode_t *node, void *arg); /************************************************************************/ /** @brief Searches for the first transaction with a lower priority than given. @@ -394,7 +394,7 @@ CFE_Status_t CF_Traverse_WriteTxnQueueEntryToFile(CF_CListNode_t *node, void *ar * @retval CF_CLIST_CONT when it isn't found, which causes list traversal to continue * */ -CFE_Status_t CF_PrioSearch(CF_CListNode_t *node, void *context); +CF_CListTraverse_Status_t CF_PrioSearch(CF_CListNode_t *node, void *context); /************************************************************************/ /** @brief Wrap the filesystem open call with a perf counter. diff --git a/unit-test/cf_cfdp_tests.c b/unit-test/cf_cfdp_tests.c index cafa1cb1..0c238d0b 100644 --- a/unit-test/cf_cfdp_tests.c +++ b/unit-test/cf_cfdp_tests.c @@ -1057,13 +1057,13 @@ void Test_CF_CFDP_CycleTxFirstActive(void) /* suspended, should return 0 */ UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); txn->flags.com.suspended = 1; - UtAssert_INT32_EQ(CF_CFDP_CycleTxFirstActive(&txn->cl_node, &args), 0); + UtAssert_INT32_EQ(CF_CFDP_CycleTxFirstActive(&txn->cl_node, &args), CF_CListTraverse_Status_CONTINUE); /* nominal, with chan->cur set non-null, should skip loop and return 1 */ UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, &args.chan, NULL, &txn, NULL); txn->flags.com.q_index = CF_QueueIdx_TXA; /* must be this */ args.chan->cur = txn; - UtAssert_INT32_EQ(CF_CFDP_CycleTxFirstActive(&txn->cl_node, &args), 1); + UtAssert_INT32_EQ(CF_CFDP_CycleTxFirstActive(&txn->cl_node, &args), CF_CListTraverse_Status_EXIT); UtAssert_BOOL_TRUE(args.ran_one); /* nominal, with chan->cur set null, should do loop and return 1 */ @@ -1074,7 +1074,7 @@ void Test_CF_CFDP_CycleTxFirstActive(void) txn->flags.com.q_index = CF_QueueIdx_TXA; /* must be this */ args.chan->cur = NULL; UT_SetHookFunction(UT_KEY(CF_CFDP_TxStateDispatch), Ut_Hook_StateHandler_SetQIndex, NULL); - UtAssert_INT32_EQ(CF_CFDP_CycleTxFirstActive(&txn->cl_node, &args), 1); + UtAssert_INT32_EQ(CF_CFDP_CycleTxFirstActive(&txn->cl_node, &args), CF_CListTraverse_Status_EXIT); } static void DoTickFnClearCont(CF_Transaction_t *txn, int *cont) diff --git a/unit-test/cf_clist_tests.c b/unit-test/cf_clist_tests.c index 0f8ee277..c89d4b65 100644 --- a/unit-test/cf_clist_tests.c +++ b/unit-test/cf_clist_tests.c @@ -27,10 +27,10 @@ ** *******************************************************************************/ -int UT_CListFn(CF_CListNode_t *node, void *context) +CF_CListTraverse_Status_t UT_CListFn(CF_CListNode_t *node, void *context) { - int status = CF_CLIST_CONT; - int *param = context; + CF_CListTraverse_Status_t status = CF_CLIST_CONT; + int * param = context; /* Passing in a negative value will exit when zero is hit */ (*param)++; @@ -42,7 +42,7 @@ int UT_CListFn(CF_CListNode_t *node, void *context) return status; } -int UT_CListFn_Rm(CF_CListNode_t *node, void *context) +CF_CListTraverse_Status_t UT_CListFn_Rm(CF_CListNode_t *node, void *context) { (*((int *)context))--; node->next = node; diff --git a/unit-test/cf_cmd_tests.c b/unit-test/cf_cmd_tests.c index 0e6858f2..063198dd 100644 --- a/unit-test/cf_cmd_tests.c +++ b/unit-test/cf_cmd_tests.c @@ -23,7 +23,6 @@ #include "cf_events.h" #include "cf_test_alt_handler.h" - /******************************************************************************* ** ** cf_cmd_tests Setup and Teardown @@ -97,7 +96,7 @@ typedef struct void * context; } CF_TsnChanAction_fn_t_context_t; -int Chan_action_fn_t(uint8 chan_num, void *context) +CF_ChanAction_Status_t Chan_action_fn_t(uint8 chan_num, void *context) { /* This one does not need to save its context, just call default so count works */ return UT_DEFAULT_IMPL(Chan_action_fn_t); @@ -594,7 +593,7 @@ void Test_CF_DoChanAction_CF_ALL_CHANNELS_WhenAny_fn_returns_1_Return_1(void) int context; void * arg_context = &context; uint8 random_fn_call = Any_uint8_LessThan(CF_NUM_CHANNELS) + 1; - int local_result; + CF_ChanAction_Status_t local_result; memset(&utbuf, 0, sizeof(utbuf)); @@ -611,7 +610,7 @@ void Test_CF_DoChanAction_CF_ALL_CHANNELS_WhenAny_fn_returns_1_Return_1(void) /* Assert */ UtAssert_STUB_COUNT(Chan_action_fn_t, CF_NUM_CHANNELS); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); - UtAssert_True(local_result == 1, "CF_DoChanAction returned %d and should be 1 (an fn returned 1)", local_result); + UtAssert_INT32_EQ(local_result, CF_ChanAction_Status_SUCCESS | 1); } void Test_CF_DoChanAction_CF_ALL_CHANNELS_WhenAll_fn_return_1_Return_1(void) @@ -623,7 +622,7 @@ void Test_CF_DoChanAction_CF_ALL_CHANNELS_WhenAll_fn_return_1_Return_1(void) CF_ChanActionFn_t arg_fn = &Chan_action_fn_t; int context; void * arg_context = &context; - int local_result; + CF_ChanAction_Status_t local_result; memset(&utbuf, 0, sizeof(utbuf)); @@ -640,7 +639,7 @@ void Test_CF_DoChanAction_CF_ALL_CHANNELS_WhenAll_fn_return_1_Return_1(void) /* Assert */ UtAssert_STUB_COUNT(Chan_action_fn_t, CF_NUM_CHANNELS); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); - UtAssert_True(local_result == 1, "CF_DoChanAction returned %d and should be 1 (an fn returned 1)", local_result); + UtAssert_INT32_EQ(local_result, CF_ChanAction_Status_SUCCESS | 1); } void Test_CF_DoChanAction_CF_ALL_CHANNELS_WhenNo_fn_returns_0_Return_0(void) @@ -652,7 +651,7 @@ void Test_CF_DoChanAction_CF_ALL_CHANNELS_WhenNo_fn_returns_0_Return_0(void) CF_ChanActionFn_t arg_fn = &Chan_action_fn_t; int context; void * arg_context = &context; - int local_result; + CF_ChanAction_Status_t local_result; memset(&utbuf, 0, sizeof(utbuf)); @@ -669,7 +668,7 @@ void Test_CF_DoChanAction_CF_ALL_CHANNELS_WhenNo_fn_returns_0_Return_0(void) /* Assert */ UtAssert_STUB_COUNT(Chan_action_fn_t, CF_NUM_CHANNELS); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); - UtAssert_True(local_result == 0, "CF_DoChanAction returned %d and should be 0 (all fn returned 0)", local_result); + UtAssert_INT32_EQ(local_result, CF_ChanAction_Status_SUCCESS); } void Test_CF_DoChanAction_WhenChannel_fn_ActionReturns_1_Return_1(void) @@ -681,7 +680,7 @@ void Test_CF_DoChanAction_WhenChannel_fn_ActionReturns_1_Return_1(void) CF_ChanActionFn_t arg_fn = &Chan_action_fn_t; int context; void * arg_context = &context; - int local_result; + CF_ChanAction_Status_t local_result; memset(&utbuf, 0, sizeof(utbuf)); @@ -698,7 +697,7 @@ void Test_CF_DoChanAction_WhenChannel_fn_ActionReturns_1_Return_1(void) /* Assert */ UtAssert_STUB_COUNT(Chan_action_fn_t, 1); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); - UtAssert_True(local_result == 1, "CF_DoChanAction returned %d and should be 1 (fn returned 1)", local_result); + UtAssert_INT32_EQ(local_result, 1); } void Test_CF_DoChanAction_WhenChannel_fn_ActionReturns_0_Return_1(void) @@ -710,7 +709,7 @@ void Test_CF_DoChanAction_WhenChannel_fn_ActionReturns_0_Return_1(void) CF_ChanActionFn_t arg_fn = &Chan_action_fn_t; int context; void * arg_context = &context; - int local_result; + CF_ChanAction_Status_t local_result; memset(&utbuf, 0, sizeof(utbuf)); @@ -727,7 +726,7 @@ void Test_CF_DoChanAction_WhenChannel_fn_ActionReturns_0_Return_1(void) /* Assert */ UtAssert_STUB_COUNT(Chan_action_fn_t, 1); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); - UtAssert_True(local_result == 0, "CF_DoChanAction returned %d and should be 0 (fn returned 0)", local_result); + UtAssert_INT32_EQ(local_result, 0); } void Test_CF_DoChanAction_WhenChanNumberEq_CF_NUM_CHANNELS_Return_neg1_And_SendEvent_(void) @@ -739,7 +738,7 @@ void Test_CF_DoChanAction_WhenChanNumberEq_CF_NUM_CHANNELS_Return_neg1_And_SendE CF_ChanActionFn_t arg_fn = &Chan_action_fn_t; int context; void * arg_context = &context; - int local_result; + CF_ChanAction_Status_t local_result; memset(&utbuf, 0, sizeof(utbuf)); @@ -756,8 +755,7 @@ void Test_CF_DoChanAction_WhenChanNumberEq_CF_NUM_CHANNELS_Return_neg1_And_SendE UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UT_CF_AssertEventID(CF_EID_ERR_CMD_CHAN_PARAM); - UtAssert_True(local_result == -1, - "CF_DoChanAction returned %d and should be -1 (cmd->data.byte[0] >= CF_NUM_CHANNELS)", local_result); + UtAssert_INT32_EQ(local_result, CF_ChanAction_Status_ERROR); } void Test_CF_DoChanAction_WhenBadChannelNumber_Return_neg1_And_SendEvent(void) @@ -769,7 +767,7 @@ void Test_CF_DoChanAction_WhenBadChannelNumber_Return_neg1_And_SendEvent(void) CF_ChanActionFn_t arg_fn = &Chan_action_fn_t; int context; void * arg_context = &context; - int local_result; + CF_ChanAction_Status_t local_result; int catastrophe_count = 0; memset(&utbuf, 0, sizeof(utbuf)); @@ -799,8 +797,7 @@ void Test_CF_DoChanAction_WhenBadChannelNumber_Return_neg1_And_SendEvent(void) UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UT_CF_AssertEventID(CF_EID_ERR_CMD_CHAN_PARAM); - UtAssert_True(local_result == -1, - "CF_DoChanAction returned %d and should be -1 (cmd->data.byte[0] >= CF_NUM_CHANNELS)", local_result); + UtAssert_INT32_EQ(local_result, CF_ChanAction_Status_ERROR); } /******************************************************************************* @@ -812,28 +809,24 @@ void Test_CF_DoChanAction_WhenBadChannelNumber_Return_neg1_And_SendEvent(void) void Test_CF_DoFreezeThaw_Set_frozen_ToGiven_context_barg_AndReturn_0(void) { /* Arrange */ - uint8 arg_chan_num = Any_cf_channel(); - CF_ChanAction_BoolArg_t context; - const CF_ChanAction_BoolArg_t *arg_context; - CFE_Status_t local_result; + uint8 arg_chan_num = Any_cf_channel(); + CF_ChanAction_BoolArg_t context; + CF_ChanAction_Status_t local_result; context.barg = Any_bool_arg_t_barg(); - arg_context = &context; - /* set frozen to opposite to ensure change was done - not required for test, * but it is helpful for verification that the function did the change */ CF_AppData.hk.Payload.channel_hk[arg_chan_num].frozen = !context.barg; /* Act */ - local_result = CF_DoFreezeThaw(arg_chan_num, arg_context); + local_result = CF_DoFreezeThaw(arg_chan_num, &context); /* Assert */ UtAssert_True(CF_AppData.hk.Payload.channel_hk[arg_chan_num].frozen == context.barg, "CF_DoFreezeThaw set frozen to %d and should be %d (context->barg))", CF_AppData.hk.Payload.channel_hk[arg_chan_num].frozen, context.barg); - UtAssert_True(local_result == CFE_SUCCESS, - "CF_DoFreezeThaw returned %d and should be 0 (CFE_SUCCESS) (only returns 0)", local_result); + UtAssert_INT32_EQ(local_result, CF_ChanAction_Status_SUCCESS); } /************************************************************************** @@ -1705,7 +1698,7 @@ void Test_CF_DoEnableDisablePolldir_When_CF_ALL_CHANNELS_SetAllPolldirsInChannel uint8 arg_chan_num = Any_cf_channel(); uint8 expected_enabled; uint8 current_polldir = 0; - CFE_Status_t local_result; + CF_ChanAction_Status_t local_result; memset(&utbuf, 0, sizeof(utbuf)); memset(&config_table, 0, sizeof(config_table)); @@ -1729,8 +1722,7 @@ void Test_CF_DoEnableDisablePolldir_When_CF_ALL_CHANNELS_SetAllPolldirsInChannel CF_AppData.config_table->chan[arg_chan_num].polldir[current_polldir].enabled, expected_enabled); } UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); - UtAssert_True(local_result == CFE_SUCCESS, "CF_DoEnableDisablePolldir returned %d and should be 0 (CFE_SUCCESS)", - local_result); + UtAssert_INT32_EQ(local_result, CF_ChanAction_Status_SUCCESS); } void Test_CF_DoEnableDisablePolldir_WhenSetToSpecificPolldirSetPolldirFrom_context_ChannelEnabledTo_context_barg(void) @@ -1744,7 +1736,7 @@ void Test_CF_DoEnableDisablePolldir_WhenSetToSpecificPolldirSetPolldirFrom_conte CF_ChanAction_BoolMsgArg_t *arg_context = &context; CF_ConfigTable_t config_table; uint8 expected_enabled; - int local_result; + CF_ChanAction_Status_t local_result; memset(&utbuf, 0, sizeof(utbuf)); memset(&config_table, 0, sizeof(config_table)); @@ -1765,7 +1757,7 @@ void Test_CF_DoEnableDisablePolldir_WhenSetToSpecificPolldirSetPolldirFrom_conte "Channel %u Polldir %u set to %u and should be %u (context->barg)", arg_chan_num, polldir, CF_AppData.config_table->chan[arg_chan_num].polldir[polldir].enabled, expected_enabled); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); - UtAssert_True(local_result == 0, "CF_DoEnableDisablePolldir returned %d and should be 0", local_result); + UtAssert_INT32_EQ(local_result, CF_ChanAction_Status_SUCCESS); } void Test_CF_DoEnableDisablePolldir_FailPolldirEq_CF_MAX_POLLING_DIR_PER_CHAN_AndSendEvent(void) @@ -1777,7 +1769,7 @@ void Test_CF_DoEnableDisablePolldir_FailPolldirEq_CF_MAX_POLLING_DIR_PER_CHAN_An CF_ChanAction_BoolMsgArg_t context; CF_ChanAction_BoolMsgArg_t *arg_context = &context; CF_ConfigTable_t config_table; - CFE_Status_t local_result; + CF_ChanAction_Status_t local_result; memset(&utbuf, 0, sizeof(utbuf)); @@ -1794,8 +1786,7 @@ void Test_CF_DoEnableDisablePolldir_FailPolldirEq_CF_MAX_POLLING_DIR_PER_CHAN_An /* Assert */ UT_CF_AssertEventID(CF_EID_ERR_CMD_POLLDIR_INVALID); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); - UtAssert_True(local_result == CF_ERROR, "CF_DoEnableDisablePolldir returned %d and should be -1 (CF_ERROR)", - local_result); + UtAssert_INT32_EQ(local_result, CF_ChanAction_Status_ERROR); } void Test_CF_DoEnableDisablePolldir_FailAnyBadPolldirSendEvent(void) @@ -1807,7 +1798,7 @@ void Test_CF_DoEnableDisablePolldir_FailAnyBadPolldirSendEvent(void) CF_ChanAction_BoolMsgArg_t context; CF_ChanAction_BoolMsgArg_t *arg_context = &context; CF_ConfigTable_t config_table; - CFE_Status_t local_result; + CF_ChanAction_Status_t local_result; memset(&utbuf, 0, sizeof(utbuf)); @@ -1824,8 +1815,7 @@ void Test_CF_DoEnableDisablePolldir_FailAnyBadPolldirSendEvent(void) /* Assert */ UT_CF_AssertEventID(CF_EID_ERR_CMD_POLLDIR_INVALID); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); - UtAssert_True(local_result == CF_ERROR, "CF_DoEnableDisablePolldir returned %d and should be -1 (CF_ERROR)", - local_result); + UtAssert_INT32_EQ(local_result, CF_ChanAction_Status_ERROR); } /******************************************************************************* @@ -1995,7 +1985,7 @@ void Test_CF_PurgeHistory_Call_CF_CFDP_ResetHistory_AndReturn_CLIST_CONT(void) CF_CListNode_t * arg_n = &history.cl_node; CF_Channel_t chan; CF_Channel_t * arg_c = &chan; - int local_result; + CF_CListTraverse_Status_t local_result; CF_CFDP_ResetHistory_context_t context_CF_CFDP_ResetHistory; UT_SetDataBuffer(UT_KEY(CF_ResetHistory), &context_CF_CFDP_ResetHistory, sizeof(context_CF_CFDP_ResetHistory), @@ -2024,7 +2014,7 @@ void Test_CF_PurgeTransaction_Call_CF_CFDP_ResetTransaction_AndReturn_CLIST_CONT CF_CListNode_t * arg_n = &txn.cl_node; int ignored; void * arg_ignored = &ignored; - int local_result; + CF_CListTraverse_Status_t local_result; CF_CFDP_ResetTransaction_context_t context_CF_CFDP_ResetTransaction; UT_SetDataBuffer(UT_KEY(CF_CFDP_ResetTransaction), &context_CF_CFDP_ResetTransaction, @@ -2058,7 +2048,7 @@ void Test_CF_DoPurgeQueue_PendOnly(void) CF_Channel_t * chan; CF_CListNode_t start; CF_CListNode_t * expected_start = &start; - CFE_Status_t local_result; + CF_ChanAction_Status_t local_result; CF_CList_Traverse_POINTER_context_t context_CF_CList_Traverse; memset(&utbuf, 0, sizeof(utbuf)); @@ -2081,8 +2071,7 @@ void Test_CF_DoPurgeQueue_PendOnly(void) UtAssert_True(context_CF_CList_Traverse.fn == CF_PurgeTransaction, "context_CF_CList_Traverse.fn == CF_PurgeTransaction"); UtAssert_ADDRESS_EQ(context_CF_CList_Traverse.context, NULL); - UtAssert_True(local_result == CFE_SUCCESS, "CF_DoPurgeQueue returned %d and should be 0 (CFE_SUCCESS)", - local_result); + UtAssert_INT32_EQ(local_result, CF_ChanAction_Status_SUCCESS); } void Test_CF_DoPurgeQueue_HistoryOnly(void) @@ -2095,7 +2084,7 @@ void Test_CF_DoPurgeQueue_HistoryOnly(void) CF_Channel_t * chan; CF_CListNode_t start; CF_CListNode_t * expected_start = &start; - CFE_Status_t local_result; + CF_ChanAction_Status_t local_result; CF_CList_Traverse_POINTER_context_t context_CF_CList_Traverse; memset(&utbuf, 0, sizeof(utbuf)); @@ -2120,8 +2109,7 @@ void Test_CF_DoPurgeQueue_HistoryOnly(void) UtAssert_True(context_CF_CList_Traverse.fn == (CF_CListFn_t)CF_PurgeHistory, "context_CF_CList_Traverse.fn == (CF_CListFn_t )CF_PurgeHistory"); UtAssert_ADDRESS_EQ(context_CF_CList_Traverse.context, chan); - UtAssert_True(local_result == CFE_SUCCESS, "CF_DoPurgeQueue returned %d and should be 0 (CFE_SUCCESS)", - local_result); + UtAssert_INT32_EQ(local_result, CF_ChanAction_Status_SUCCESS); } void Test_CF_DoPurgeQueue_Both(void) @@ -2136,7 +2124,7 @@ void Test_CF_DoPurgeQueue_Both(void) CF_CListNode_t * expected_pend_start = &pend_start; CF_CListNode_t history_start; CF_CListNode_t * expected_history_start = &history_start; - CFE_Status_t local_result; + CF_ChanAction_Status_t local_result; CF_CList_Traverse_POINTER_context_t context_CF_CList_Traverse[2]; memset(&utbuf, 0, sizeof(utbuf)); @@ -2167,8 +2155,7 @@ void Test_CF_DoPurgeQueue_Both(void) UtAssert_True(context_CF_CList_Traverse[1].fn == (CF_CListFn_t)CF_PurgeHistory, "context_CF_CList_Traverse[1].fn == (CF_CListFn_t )CF_PurgeHistory"); UtAssert_ADDRESS_EQ(context_CF_CList_Traverse[1].context, chan); - UtAssert_True(local_result == CFE_SUCCESS, "CF_DoPurgeQueue returned %d and should be 0 (CFE_SUCCESS)", - local_result); + UtAssert_INT32_EQ(local_result, CF_ChanAction_Status_SUCCESS); } void Test_CF_DoPurgeQueue_GivenBad_data_byte_1_SendEventAndReturn_neg1(void) @@ -2178,7 +2165,7 @@ void Test_CF_DoPurgeQueue_GivenBad_data_byte_1_SendEventAndReturn_neg1(void) CF_UnionArgs_Payload_t utbuf; CF_UnionArgs_Payload_t *data = &utbuf; CF_ChanAction_MsgArg_t msgarg = {data}; - CFE_Status_t local_result; + CF_ChanAction_Status_t local_result; memset(&utbuf, 0, sizeof(utbuf)); @@ -2190,7 +2177,7 @@ void Test_CF_DoPurgeQueue_GivenBad_data_byte_1_SendEventAndReturn_neg1(void) UT_GetStubCount(UT_KEY(CF_CList_Traverse)); /* Assert */ - UtAssert_True(local_result == CF_ERROR, "CF_DoPurgeQueue returned %d and should be -1 (CF_ERROR)", local_result); + UtAssert_INT32_EQ(local_result, CF_ChanAction_Status_ERROR); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UT_CF_AssertEventID(CF_EID_ERR_CMD_PURGE_ARG); UtAssert_STUB_COUNT(CF_CList_Traverse, 0); @@ -2203,7 +2190,7 @@ void Test_CF_DoPurgeQueue_AnyGivenBad_data_byte_1_SendEventAndReturn_neg1(void) CF_UnionArgs_Payload_t utbuf; CF_UnionArgs_Payload_t *data = &utbuf; CF_ChanAction_MsgArg_t msgarg = {data}; - CFE_Status_t local_result; + CF_ChanAction_Status_t local_result; memset(&utbuf, 0, sizeof(utbuf)); @@ -2215,7 +2202,7 @@ void Test_CF_DoPurgeQueue_AnyGivenBad_data_byte_1_SendEventAndReturn_neg1(void) UT_GetStubCount(UT_KEY(CF_CList_Traverse)); /* Assert */ - UtAssert_True(local_result == CF_ERROR, "CF_DoPurgeQueue returned %d and should be -1 (CF_ERROR)", local_result); + UtAssert_INT32_EQ(local_result, CF_ChanAction_Status_ERROR); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UT_CF_AssertEventID(CF_EID_ERR_CMD_PURGE_ARG); UtAssert_STUB_COUNT(CF_CList_Traverse, 0); @@ -3319,61 +3306,57 @@ void Test_CF_CmdWriteQueue_Success_type_DownAnd_q_Pend(void) void Test_CF_CmdValidateChunkSize_val_GreaterThan_pdu_fd_data_t_FailAndReturn_1(void) { /* Arrange */ - uint8 arg_chan_num = Any_uint8(); /* value labeled as 'ignored' in func def */ - uint32 arg_val = sizeof(CF_CFDP_PduFileDataContent_t) + 1; - CFE_Status_t local_result; + uint8 arg_chan_num = Any_uint8(); /* value labeled as 'ignored' in func def */ + uint32 arg_val = sizeof(CF_CFDP_PduFileDataContent_t) + 1; + CF_ChanAction_Status_t local_result; /* Act */ local_result = CF_CmdValidateChunkSize(arg_val, arg_chan_num); /* Assert */ - UtAssert_True(local_result == CF_ERROR, "CF_CmdValidateChunkSize returned %d and should be -1 (CF_ERROR)", - local_result); + UtAssert_INT32_EQ(local_result, CF_ChanAction_Status_ERROR); } void Test_CF_CmdValidateChunkSize_Any_val_GreaterThan_pdu_fd_data_t_FailAndReturn_1(void) { /* Arrange */ - uint8 arg_chan_num = Any_uint8(); /* value labeled as 'ignored' in func def */ - uint32 arg_val = Any_uint32_GreaterThan(sizeof(CF_CFDP_PduFileDataContent_t)); - CFE_Status_t local_result; + uint8 arg_chan_num = Any_uint8(); /* value labeled as 'ignored' in func def */ + uint32 arg_val = Any_uint32_GreaterThan(sizeof(CF_CFDP_PduFileDataContent_t)); + CF_ChanAction_Status_t local_result; /* Act */ local_result = CF_CmdValidateChunkSize(arg_val, arg_chan_num); /* Assert */ - UtAssert_True(local_result == CF_ERROR, "CF_CmdValidateChunkSize returned %d and should be -1 (CF_ERROR)", - local_result); + UtAssert_INT32_EQ(local_result, CF_ChanAction_Status_ERROR); } void Test_CF_CmdValidateChunkSize_val_SizeOf_pdu_fd_data_t_SuccessAndReturn_0(void) { /* Arrange */ - uint8 arg_chan_num = Any_uint8(); /* value labeled as 'ignored' in func def */ - uint32 arg_val = sizeof(CF_CFDP_PduFileDataContent_t); - CFE_Status_t local_result; + uint8 arg_chan_num = Any_uint8(); /* value labeled as 'ignored' in func def */ + uint32 arg_val = sizeof(CF_CFDP_PduFileDataContent_t); + CF_ChanAction_Status_t local_result; /* Act */ local_result = CF_CmdValidateChunkSize(arg_val, arg_chan_num); /* Assert */ - UtAssert_True(local_result == CFE_SUCCESS, "CF_CmdValidateChunkSize returned %d and should be 0 (CFE_SUCCESS)", - local_result); + UtAssert_INT32_EQ(local_result, CF_ChanAction_Status_SUCCESS); } void Test_CF_CmdValidateChunkSize_val_LessThanOrEqSizeOf_pdu_fd_data_t_SuccessAndReturn_0(void) { /* Arrange */ - uint8 arg_chan_num = Any_uint8(); /* value labeled as 'ignored' in func def */ - uint32 arg_val = Any_uint32_LessThan_or_EqualTo(sizeof(CF_CFDP_PduFileDataContent_t)); - CFE_Status_t local_result; + uint8 arg_chan_num = Any_uint8(); /* value labeled as 'ignored' in func def */ + uint32 arg_val = Any_uint32_LessThan_or_EqualTo(sizeof(CF_CFDP_PduFileDataContent_t)); + CF_ChanAction_Status_t local_result; /* Act */ local_result = CF_CmdValidateChunkSize(arg_val, arg_chan_num); /* Assert */ - UtAssert_True(local_result == CFE_SUCCESS, "CF_CmdValidateChunkSize returned %d and should be 0 (CFE_SUCCESS)", - local_result); + UtAssert_INT32_EQ(local_result, CF_ChanAction_Status_SUCCESS); } /******************************************************************************* @@ -3387,14 +3370,13 @@ void Test_CF_CmdValidateMaxOutgoing_WhenGiven_val_IsNot_0_Return_0_Success(void) /* Arrange */ uint32 arg_val = Any_uint32_Except(0); uint8 arg_chan_num = Any_uint8(); /* Any_uint8() used here because it shows value does not matter in this test */ - CFE_Status_t local_result; + CF_ChanAction_Status_t local_result; /* Act */ local_result = CF_CmdValidateMaxOutgoing(arg_val, arg_chan_num); /* Assert */ - UtAssert_True(local_result == CFE_SUCCESS, "CF_CmdValidateMaxOutgoing returned %d and should be 0 (CFE_SUCCESS)", - local_result); + UtAssert_INT32_EQ(local_result, CF_ChanAction_Status_SUCCESS); } void Test_CF_CmdValidateMaxOutgoing_WhenGiven_val_Is_0_But_sem_name_IsNot_NULL_Return_0_Success(void) @@ -3402,8 +3384,8 @@ void Test_CF_CmdValidateMaxOutgoing_WhenGiven_val_Is_0_But_sem_name_IsNot_NULL_R /* Arrange */ uint32 arg_val = 0; uint8 arg_chan_num = Any_cf_chan_num(); /* Any_cf_chan_num used here because value matters to this test */ - CF_ConfigTable_t config_table; - CFE_Status_t local_result; + CF_ConfigTable_t config_table; + CF_ChanAction_Status_t local_result; CF_AppData.config_table = &config_table; memset(CF_AppData.config_table->chan[arg_chan_num].sem_name, (char)Any_uint8_Except(0), 1); @@ -3412,8 +3394,7 @@ void Test_CF_CmdValidateMaxOutgoing_WhenGiven_val_Is_0_But_sem_name_IsNot_NULL_R local_result = CF_CmdValidateMaxOutgoing(arg_val, arg_chan_num); /* Assert */ - UtAssert_True(local_result == CFE_SUCCESS, "CF_CmdValidateMaxOutgoing returned %d and should be 0 (CFE_SUCCESS)", - local_result); + UtAssert_INT32_EQ(local_result, CF_ChanAction_Status_SUCCESS); } void Test_CF_CmdValidateMaxOutgoing_WhenGiven_val_Is_0_And_sem_name_Is_NULL_Return_1_Fail(void) @@ -3421,8 +3402,8 @@ void Test_CF_CmdValidateMaxOutgoing_WhenGiven_val_Is_0_And_sem_name_Is_NULL_Retu /* Arrange */ uint32 arg_val = 0; uint8 arg_chan_num = Any_cf_chan_num(); /* Any_cf_chan_num used here because value matters to this test */ - CF_ConfigTable_t config_table; - CFE_Status_t local_result; + CF_ConfigTable_t config_table; + CF_ChanAction_Status_t local_result; CF_AppData.config_table = &config_table; memset(CF_AppData.config_table->chan[arg_chan_num].sem_name, (char)0, 1); @@ -3431,8 +3412,7 @@ void Test_CF_CmdValidateMaxOutgoing_WhenGiven_val_Is_0_And_sem_name_Is_NULL_Retu local_result = CF_CmdValidateMaxOutgoing(arg_val, arg_chan_num); /* Assert */ - UtAssert_True(local_result == CF_ERROR, "CF_CmdValidateMaxOutgoing returned %d and should be -1 (CF_ERROR)", - local_result); + UtAssert_INT32_EQ(local_result, CF_ChanAction_Status_ERROR); } /******************************************************************************* @@ -3608,7 +3588,7 @@ void Test_CF_CmdEnableEngine_WithEngineNotEnableFailsInitSendEventAndIncrementEr { /* Arrange */ CF_EnableEngineCmd_t utbuf; - uint32 forced_return_CF_CFDP_InitEngine = Any_uint32_Except(CFE_SUCCESS); + uint32 forced_return_CF_CFDP_InitEngine = Any_uint32_Except(CF_ChanAction_Status_SUCCESS); uint16 initial_hk_err_counter = Any_uint16(); memset(&utbuf, 0, sizeof(utbuf)); diff --git a/unit-test/cf_utils_tests.c b/unit-test/cf_utils_tests.c index 6707fc45..41010c91 100644 --- a/unit-test/cf_utils_tests.c +++ b/unit-test/cf_utils_tests.c @@ -844,9 +844,9 @@ void Test_CF_TraverseAllTransactions_Impl_GetContainer_t_Call_args_fn_AndAdd_1_T CF_CListNode_t * arg_n = &txn.cl_node; CF_TraverseAll_Arg_t args; CF_TraverseAll_Arg_t *arg_args; - int context_val; + int32 context_val; void * context = &context_val; - int initial_args_counter = Any_int(); + int32 initial_args_counter = 57; CF_Transaction_t * expected_t; void * expected_context; int32 result; @@ -872,9 +872,7 @@ void Test_CF_TraverseAllTransactions_Impl_GetContainer_t_Call_args_fn_AndAdd_1_T /* Assert */ UtAssert_ADDRESS_EQ(func_ptr_context.txn, expected_t); UtAssert_ADDRESS_EQ(func_ptr_context.context, expected_context); - UtAssert_True(arg_args->counter == initial_args_counter + 1, - "CF_TraverseAllTransactions_Impl set args->counter to %d which is 1 more than initial value %d", - arg_args->counter, initial_args_counter); + UtAssert_UINT32_EQ(arg_args->counter, initial_args_counter + 1); UtAssert_INT32_EQ(result, CF_CLIST_CONT); } diff --git a/unit-test/stubs/cf_cfdp_stubs.c b/unit-test/stubs/cf_cfdp_stubs.c index a9d67b14..3db3c393 100644 --- a/unit-test/stubs/cf_cfdp_stubs.c +++ b/unit-test/stubs/cf_cfdp_stubs.c @@ -74,16 +74,16 @@ void CF_CFDP_CancelTransaction(CF_Transaction_t *txn) * Generated stub function for CF_CFDP_CloseFiles() * ---------------------------------------------------- */ -CFE_Status_t CF_CFDP_CloseFiles(CF_CListNode_t *node, void *context) +CF_CListTraverse_Status_t CF_CFDP_CloseFiles(CF_CListNode_t *node, void *context) { - UT_GenStub_SetupReturnBuffer(CF_CFDP_CloseFiles, CFE_Status_t); + UT_GenStub_SetupReturnBuffer(CF_CFDP_CloseFiles, CF_CListTraverse_Status_t); UT_GenStub_AddParam(CF_CFDP_CloseFiles, CF_CListNode_t *, node); UT_GenStub_AddParam(CF_CFDP_CloseFiles, void *, context); UT_GenStub_Execute(CF_CFDP_CloseFiles, Basic, NULL); - return UT_GenStub_GetReturnValue(CF_CFDP_CloseFiles, CFE_Status_t); + return UT_GenStub_GetReturnValue(CF_CFDP_CloseFiles, CF_CListTraverse_Status_t); } /* @@ -156,16 +156,16 @@ void CF_CFDP_CycleTx(CF_Channel_t *chan) * Generated stub function for CF_CFDP_CycleTxFirstActive() * ---------------------------------------------------- */ -CFE_Status_t CF_CFDP_CycleTxFirstActive(CF_CListNode_t *node, void *context) +CF_CListTraverse_Status_t CF_CFDP_CycleTxFirstActive(CF_CListNode_t *node, void *context) { - UT_GenStub_SetupReturnBuffer(CF_CFDP_CycleTxFirstActive, CFE_Status_t); + UT_GenStub_SetupReturnBuffer(CF_CFDP_CycleTxFirstActive, CF_CListTraverse_Status_t); UT_GenStub_AddParam(CF_CFDP_CycleTxFirstActive, CF_CListNode_t *, node); UT_GenStub_AddParam(CF_CFDP_CycleTxFirstActive, void *, context); UT_GenStub_Execute(CF_CFDP_CycleTxFirstActive, Basic, NULL); - return UT_GenStub_GetReturnValue(CF_CFDP_CycleTxFirstActive, CFE_Status_t); + return UT_GenStub_GetReturnValue(CF_CFDP_CycleTxFirstActive, CF_CListTraverse_Status_t); } /* @@ -214,16 +214,16 @@ void CF_CFDP_DispatchRecv(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) * Generated stub function for CF_CFDP_DoTick() * ---------------------------------------------------- */ -CFE_Status_t CF_CFDP_DoTick(CF_CListNode_t *node, void *context) +CF_CListTraverse_Status_t CF_CFDP_DoTick(CF_CListNode_t *node, void *context) { - UT_GenStub_SetupReturnBuffer(CF_CFDP_DoTick, CFE_Status_t); + UT_GenStub_SetupReturnBuffer(CF_CFDP_DoTick, CF_CListTraverse_Status_t); UT_GenStub_AddParam(CF_CFDP_DoTick, CF_CListNode_t *, node); UT_GenStub_AddParam(CF_CFDP_DoTick, void *, context); UT_GenStub_Execute(CF_CFDP_DoTick, Basic, NULL); - return UT_GenStub_GetReturnValue(CF_CFDP_DoTick, CFE_Status_t); + return UT_GenStub_GetReturnValue(CF_CFDP_DoTick, CF_CListTraverse_Status_t); } /* diff --git a/unit-test/stubs/cf_cmd_stubs.c b/unit-test/stubs/cf_cmd_stubs.c index 48cbf833..3201c806 100644 --- a/unit-test/stubs/cf_cmd_stubs.c +++ b/unit-test/stubs/cf_cmd_stubs.c @@ -83,16 +83,16 @@ void CF_CmdCancel_Txn(CF_Transaction_t *txn, void *ignored) * Generated stub function for CF_CmdValidateChunkSize() * ---------------------------------------------------- */ -CFE_Status_t CF_CmdValidateChunkSize(uint32 val, uint8 chan_num) +CF_ChanAction_Status_t CF_CmdValidateChunkSize(uint32 val, uint8 chan_num) { - UT_GenStub_SetupReturnBuffer(CF_CmdValidateChunkSize, CFE_Status_t); + UT_GenStub_SetupReturnBuffer(CF_CmdValidateChunkSize, CF_ChanAction_Status_t); UT_GenStub_AddParam(CF_CmdValidateChunkSize, uint32, val); UT_GenStub_AddParam(CF_CmdValidateChunkSize, uint8, chan_num); UT_GenStub_Execute(CF_CmdValidateChunkSize, Basic, NULL); - return UT_GenStub_GetReturnValue(CF_CmdValidateChunkSize, CFE_Status_t); + return UT_GenStub_GetReturnValue(CF_CmdValidateChunkSize, CF_ChanAction_Status_t); } /* @@ -100,16 +100,16 @@ CFE_Status_t CF_CmdValidateChunkSize(uint32 val, uint8 chan_num) * Generated stub function for CF_CmdValidateMaxOutgoing() * ---------------------------------------------------- */ -CFE_Status_t CF_CmdValidateMaxOutgoing(uint32 val, uint8 chan_num) +CF_ChanAction_Status_t CF_CmdValidateMaxOutgoing(uint32 val, uint8 chan_num) { - UT_GenStub_SetupReturnBuffer(CF_CmdValidateMaxOutgoing, CFE_Status_t); + UT_GenStub_SetupReturnBuffer(CF_CmdValidateMaxOutgoing, CF_ChanAction_Status_t); UT_GenStub_AddParam(CF_CmdValidateMaxOutgoing, uint32, val); UT_GenStub_AddParam(CF_CmdValidateMaxOutgoing, uint8, chan_num); UT_GenStub_Execute(CF_CmdValidateMaxOutgoing, Basic, NULL); - return UT_GenStub_GetReturnValue(CF_CmdValidateMaxOutgoing, CFE_Status_t); + return UT_GenStub_GetReturnValue(CF_CmdValidateMaxOutgoing, CF_ChanAction_Status_t); } /* @@ -153,10 +153,10 @@ void CF_DisablePolldirCmd(const CF_DisableDirPollingCmd_t *msg) * Generated stub function for CF_DoChanAction() * ---------------------------------------------------- */ -CFE_Status_t CF_DoChanAction(const CF_UnionArgs_Payload_t *data, const char *errstr, CF_ChanActionFn_t fn, - void *context) +CF_ChanAction_Status_t CF_DoChanAction(const CF_UnionArgs_Payload_t *data, const char *errstr, CF_ChanActionFn_t fn, + void *context) { - UT_GenStub_SetupReturnBuffer(CF_DoChanAction, CFE_Status_t); + UT_GenStub_SetupReturnBuffer(CF_DoChanAction, CF_ChanAction_Status_t); UT_GenStub_AddParam(CF_DoChanAction, const CF_UnionArgs_Payload_t *, data); UT_GenStub_AddParam(CF_DoChanAction, const char *, errstr); @@ -165,7 +165,7 @@ CFE_Status_t CF_DoChanAction(const CF_UnionArgs_Payload_t *data, const char *err UT_GenStub_Execute(CF_DoChanAction, Basic, NULL); - return UT_GenStub_GetReturnValue(CF_DoChanAction, CFE_Status_t); + return UT_GenStub_GetReturnValue(CF_DoChanAction, CF_ChanAction_Status_t); } /* @@ -173,16 +173,16 @@ CFE_Status_t CF_DoChanAction(const CF_UnionArgs_Payload_t *data, const char *err * Generated stub function for CF_DoEnableDisableDequeue() * ---------------------------------------------------- */ -CFE_Status_t CF_DoEnableDisableDequeue(uint8 chan_num, const CF_ChanAction_BoolArg_t *context) +CF_ChanAction_Status_t CF_DoEnableDisableDequeue(uint8 chan_num, void *arg) { - UT_GenStub_SetupReturnBuffer(CF_DoEnableDisableDequeue, CFE_Status_t); + UT_GenStub_SetupReturnBuffer(CF_DoEnableDisableDequeue, CF_ChanAction_Status_t); UT_GenStub_AddParam(CF_DoEnableDisableDequeue, uint8, chan_num); - UT_GenStub_AddParam(CF_DoEnableDisableDequeue, const CF_ChanAction_BoolArg_t *, context); + UT_GenStub_AddParam(CF_DoEnableDisableDequeue, void *, arg); UT_GenStub_Execute(CF_DoEnableDisableDequeue, Basic, NULL); - return UT_GenStub_GetReturnValue(CF_DoEnableDisableDequeue, CFE_Status_t); + return UT_GenStub_GetReturnValue(CF_DoEnableDisableDequeue, CF_ChanAction_Status_t); } /* @@ -190,16 +190,16 @@ CFE_Status_t CF_DoEnableDisableDequeue(uint8 chan_num, const CF_ChanAction_BoolA * Generated stub function for CF_DoEnableDisablePolldir() * ---------------------------------------------------- */ -CFE_Status_t CF_DoEnableDisablePolldir(uint8 chan_num, const CF_ChanAction_BoolMsgArg_t *context) +CF_ChanAction_Status_t CF_DoEnableDisablePolldir(uint8 chan_num, void *arg) { - UT_GenStub_SetupReturnBuffer(CF_DoEnableDisablePolldir, CFE_Status_t); + UT_GenStub_SetupReturnBuffer(CF_DoEnableDisablePolldir, CF_ChanAction_Status_t); UT_GenStub_AddParam(CF_DoEnableDisablePolldir, uint8, chan_num); - UT_GenStub_AddParam(CF_DoEnableDisablePolldir, const CF_ChanAction_BoolMsgArg_t *, context); + UT_GenStub_AddParam(CF_DoEnableDisablePolldir, void *, arg); UT_GenStub_Execute(CF_DoEnableDisablePolldir, Basic, NULL); - return UT_GenStub_GetReturnValue(CF_DoEnableDisablePolldir, CFE_Status_t); + return UT_GenStub_GetReturnValue(CF_DoEnableDisablePolldir, CF_ChanAction_Status_t); } /* @@ -207,16 +207,16 @@ CFE_Status_t CF_DoEnableDisablePolldir(uint8 chan_num, const CF_ChanAction_BoolM * Generated stub function for CF_DoFreezeThaw() * ---------------------------------------------------- */ -CFE_Status_t CF_DoFreezeThaw(uint8 chan_num, const CF_ChanAction_BoolArg_t *context) +CF_ChanAction_Status_t CF_DoFreezeThaw(uint8 chan_num, void *arg) { - UT_GenStub_SetupReturnBuffer(CF_DoFreezeThaw, CFE_Status_t); + UT_GenStub_SetupReturnBuffer(CF_DoFreezeThaw, CF_ChanAction_Status_t); UT_GenStub_AddParam(CF_DoFreezeThaw, uint8, chan_num); - UT_GenStub_AddParam(CF_DoFreezeThaw, const CF_ChanAction_BoolArg_t *, context); + UT_GenStub_AddParam(CF_DoFreezeThaw, void *, arg); UT_GenStub_Execute(CF_DoFreezeThaw, Basic, NULL); - return UT_GenStub_GetReturnValue(CF_DoFreezeThaw, CFE_Status_t); + return UT_GenStub_GetReturnValue(CF_DoFreezeThaw, CF_ChanAction_Status_t); } /* @@ -224,16 +224,16 @@ CFE_Status_t CF_DoFreezeThaw(uint8 chan_num, const CF_ChanAction_BoolArg_t *cont * Generated stub function for CF_DoPurgeQueue() * ---------------------------------------------------- */ -CFE_Status_t CF_DoPurgeQueue(uint8 chan_num, void *arg) +CF_ChanAction_Status_t CF_DoPurgeQueue(uint8 chan_num, void *arg) { - UT_GenStub_SetupReturnBuffer(CF_DoPurgeQueue, CFE_Status_t); + UT_GenStub_SetupReturnBuffer(CF_DoPurgeQueue, CF_ChanAction_Status_t); UT_GenStub_AddParam(CF_DoPurgeQueue, uint8, chan_num); UT_GenStub_AddParam(CF_DoPurgeQueue, void *, arg); UT_GenStub_Execute(CF_DoPurgeQueue, Basic, NULL); - return UT_GenStub_GetReturnValue(CF_DoPurgeQueue, CFE_Status_t); + return UT_GenStub_GetReturnValue(CF_DoPurgeQueue, CF_ChanAction_Status_t); } /* @@ -395,16 +395,16 @@ void CF_ProcessGroundCommand(CFE_SB_Buffer_t *msg) * Generated stub function for CF_PurgeHistory() * ---------------------------------------------------- */ -CFE_Status_t CF_PurgeHistory(CF_CListNode_t *node, CF_Channel_t *chan) +CF_CListTraverse_Status_t CF_PurgeHistory(CF_CListNode_t *node, void *arg) { - UT_GenStub_SetupReturnBuffer(CF_PurgeHistory, CFE_Status_t); + UT_GenStub_SetupReturnBuffer(CF_PurgeHistory, CF_CListTraverse_Status_t); UT_GenStub_AddParam(CF_PurgeHistory, CF_CListNode_t *, node); - UT_GenStub_AddParam(CF_PurgeHistory, CF_Channel_t *, chan); + UT_GenStub_AddParam(CF_PurgeHistory, void *, arg); UT_GenStub_Execute(CF_PurgeHistory, Basic, NULL); - return UT_GenStub_GetReturnValue(CF_PurgeHistory, CFE_Status_t); + return UT_GenStub_GetReturnValue(CF_PurgeHistory, CF_CListTraverse_Status_t); } /* @@ -424,16 +424,16 @@ void CF_PurgeQueueCmd(const CF_PurgeQueueCmd_t *msg) * Generated stub function for CF_PurgeTransaction() * ---------------------------------------------------- */ -CFE_Status_t CF_PurgeTransaction(CF_CListNode_t *node, void *ignored) +CF_CListTraverse_Status_t CF_PurgeTransaction(CF_CListNode_t *node, void *ignored) { - UT_GenStub_SetupReturnBuffer(CF_PurgeTransaction, CFE_Status_t); + UT_GenStub_SetupReturnBuffer(CF_PurgeTransaction, CF_CListTraverse_Status_t); UT_GenStub_AddParam(CF_PurgeTransaction, CF_CListNode_t *, node); UT_GenStub_AddParam(CF_PurgeTransaction, void *, ignored); UT_GenStub_Execute(CF_PurgeTransaction, Basic, NULL); - return UT_GenStub_GetReturnValue(CF_PurgeTransaction, CFE_Status_t); + return UT_GenStub_GetReturnValue(CF_PurgeTransaction, CF_CListTraverse_Status_t); } /* @@ -501,19 +501,19 @@ void CF_ThawCmd(const CF_ThawCmd_t *msg) * Generated stub function for CF_TsnChanAction() * ---------------------------------------------------- */ -CFE_Status_t CF_TsnChanAction(const CF_Transaction_Payload_t *payload, const char *cmdstr, CF_TsnChanAction_fn_t fn, - void *context) +int32 CF_TsnChanAction(const CF_Transaction_Payload_t *data, const char *cmdstr, CF_TsnChanAction_fn_t fn, + void *context) { - UT_GenStub_SetupReturnBuffer(CF_TsnChanAction, CFE_Status_t); + UT_GenStub_SetupReturnBuffer(CF_TsnChanAction, int32); - UT_GenStub_AddParam(CF_TsnChanAction, const CF_Transaction_Payload_t *, payload); + UT_GenStub_AddParam(CF_TsnChanAction, const CF_Transaction_Payload_t *, data); UT_GenStub_AddParam(CF_TsnChanAction, const char *, cmdstr); UT_GenStub_AddParam(CF_TsnChanAction, CF_TsnChanAction_fn_t, fn); UT_GenStub_AddParam(CF_TsnChanAction, void *, context); UT_GenStub_Execute(CF_TsnChanAction, Basic, NULL); - return UT_GenStub_GetReturnValue(CF_TsnChanAction, CFE_Status_t); + return UT_GenStub_GetReturnValue(CF_TsnChanAction, int32); } /* diff --git a/unit-test/stubs/cf_utils_stubs.c b/unit-test/stubs/cf_utils_stubs.c index 2786f0bd..bf36813b 100644 --- a/unit-test/stubs/cf_utils_stubs.c +++ b/unit-test/stubs/cf_utils_stubs.c @@ -119,16 +119,16 @@ void CF_InsertSortPrio(CF_Transaction_t *txn, CF_QueueIdx_t queue) * Generated stub function for CF_PrioSearch() * ---------------------------------------------------- */ -CFE_Status_t CF_PrioSearch(CF_CListNode_t *node, void *context) +CF_CListTraverse_Status_t CF_PrioSearch(CF_CListNode_t *node, void *context) { - UT_GenStub_SetupReturnBuffer(CF_PrioSearch, CFE_Status_t); + UT_GenStub_SetupReturnBuffer(CF_PrioSearch, CF_CListTraverse_Status_t); UT_GenStub_AddParam(CF_PrioSearch, CF_CListNode_t *, node); UT_GenStub_AddParam(CF_PrioSearch, void *, context); UT_GenStub_Execute(CF_PrioSearch, Basic, NULL); - return UT_GenStub_GetReturnValue(CF_PrioSearch, CFE_Status_t); + return UT_GenStub_GetReturnValue(CF_PrioSearch, CF_CListTraverse_Status_t); } /* @@ -149,9 +149,9 @@ void CF_ResetHistory(CF_Channel_t *chan, CF_History_t *history) * Generated stub function for CF_TraverseAllTransactions() * ---------------------------------------------------- */ -CFE_Status_t CF_TraverseAllTransactions(CF_Channel_t *chan, CF_TraverseAllTransactions_fn_t fn, void *context) +int32 CF_TraverseAllTransactions(CF_Channel_t *chan, CF_TraverseAllTransactions_fn_t fn, void *context) { - UT_GenStub_SetupReturnBuffer(CF_TraverseAllTransactions, CFE_Status_t); + UT_GenStub_SetupReturnBuffer(CF_TraverseAllTransactions, int32); UT_GenStub_AddParam(CF_TraverseAllTransactions, CF_Channel_t *, chan); UT_GenStub_AddParam(CF_TraverseAllTransactions, CF_TraverseAllTransactions_fn_t, fn); @@ -159,7 +159,7 @@ CFE_Status_t CF_TraverseAllTransactions(CF_Channel_t *chan, CF_TraverseAllTransa UT_GenStub_Execute(CF_TraverseAllTransactions, Basic, UT_DefaultHandler_CF_TraverseAllTransactions); - return UT_GenStub_GetReturnValue(CF_TraverseAllTransactions, CFE_Status_t); + return UT_GenStub_GetReturnValue(CF_TraverseAllTransactions, int32); } /* @@ -167,9 +167,9 @@ CFE_Status_t CF_TraverseAllTransactions(CF_Channel_t *chan, CF_TraverseAllTransa * Generated stub function for CF_TraverseAllTransactions_All_Channels() * ---------------------------------------------------- */ -CFE_Status_t CF_TraverseAllTransactions_All_Channels(CF_TraverseAllTransactions_fn_t fn, void *context) +int32 CF_TraverseAllTransactions_All_Channels(CF_TraverseAllTransactions_fn_t fn, void *context) { - UT_GenStub_SetupReturnBuffer(CF_TraverseAllTransactions_All_Channels, CFE_Status_t); + UT_GenStub_SetupReturnBuffer(CF_TraverseAllTransactions_All_Channels, int32); UT_GenStub_AddParam(CF_TraverseAllTransactions_All_Channels, CF_TraverseAllTransactions_fn_t, fn); UT_GenStub_AddParam(CF_TraverseAllTransactions_All_Channels, void *, context); @@ -177,7 +177,7 @@ CFE_Status_t CF_TraverseAllTransactions_All_Channels(CF_TraverseAllTransactions_ UT_GenStub_Execute(CF_TraverseAllTransactions_All_Channels, Basic, UT_DefaultHandler_CF_TraverseAllTransactions_All_Channels); - return UT_GenStub_GetReturnValue(CF_TraverseAllTransactions_All_Channels, CFE_Status_t); + return UT_GenStub_GetReturnValue(CF_TraverseAllTransactions_All_Channels, int32); } /* @@ -185,16 +185,16 @@ CFE_Status_t CF_TraverseAllTransactions_All_Channels(CF_TraverseAllTransactions_ * Generated stub function for CF_TraverseAllTransactions_Impl() * ---------------------------------------------------- */ -CFE_Status_t CF_TraverseAllTransactions_Impl(CF_CListNode_t *node, CF_TraverseAll_Arg_t *args) +CF_CListTraverse_Status_t CF_TraverseAllTransactions_Impl(CF_CListNode_t *node, void *arg) { - UT_GenStub_SetupReturnBuffer(CF_TraverseAllTransactions_Impl, CFE_Status_t); + UT_GenStub_SetupReturnBuffer(CF_TraverseAllTransactions_Impl, CF_CListTraverse_Status_t); UT_GenStub_AddParam(CF_TraverseAllTransactions_Impl, CF_CListNode_t *, node); - UT_GenStub_AddParam(CF_TraverseAllTransactions_Impl, CF_TraverseAll_Arg_t *, args); + UT_GenStub_AddParam(CF_TraverseAllTransactions_Impl, void *, arg); UT_GenStub_Execute(CF_TraverseAllTransactions_Impl, Basic, NULL); - return UT_GenStub_GetReturnValue(CF_TraverseAllTransactions_Impl, CFE_Status_t); + return UT_GenStub_GetReturnValue(CF_TraverseAllTransactions_Impl, CF_CListTraverse_Status_t); } /* @@ -202,16 +202,16 @@ CFE_Status_t CF_TraverseAllTransactions_Impl(CF_CListNode_t *node, CF_TraverseAl * Generated stub function for CF_Traverse_WriteHistoryQueueEntryToFile() * ---------------------------------------------------- */ -CFE_Status_t CF_Traverse_WriteHistoryQueueEntryToFile(CF_CListNode_t *node, void *arg) +CF_CListTraverse_Status_t CF_Traverse_WriteHistoryQueueEntryToFile(CF_CListNode_t *node, void *arg) { - UT_GenStub_SetupReturnBuffer(CF_Traverse_WriteHistoryQueueEntryToFile, CFE_Status_t); + UT_GenStub_SetupReturnBuffer(CF_Traverse_WriteHistoryQueueEntryToFile, CF_CListTraverse_Status_t); UT_GenStub_AddParam(CF_Traverse_WriteHistoryQueueEntryToFile, CF_CListNode_t *, node); UT_GenStub_AddParam(CF_Traverse_WriteHistoryQueueEntryToFile, void *, arg); UT_GenStub_Execute(CF_Traverse_WriteHistoryQueueEntryToFile, Basic, NULL); - return UT_GenStub_GetReturnValue(CF_Traverse_WriteHistoryQueueEntryToFile, CFE_Status_t); + return UT_GenStub_GetReturnValue(CF_Traverse_WriteHistoryQueueEntryToFile, CF_CListTraverse_Status_t); } /* @@ -219,16 +219,16 @@ CFE_Status_t CF_Traverse_WriteHistoryQueueEntryToFile(CF_CListNode_t *node, void * Generated stub function for CF_Traverse_WriteTxnQueueEntryToFile() * ---------------------------------------------------- */ -CFE_Status_t CF_Traverse_WriteTxnQueueEntryToFile(CF_CListNode_t *node, void *arg) +CF_CListTraverse_Status_t CF_Traverse_WriteTxnQueueEntryToFile(CF_CListNode_t *node, void *arg) { - UT_GenStub_SetupReturnBuffer(CF_Traverse_WriteTxnQueueEntryToFile, CFE_Status_t); + UT_GenStub_SetupReturnBuffer(CF_Traverse_WriteTxnQueueEntryToFile, CF_CListTraverse_Status_t); UT_GenStub_AddParam(CF_Traverse_WriteTxnQueueEntryToFile, CF_CListNode_t *, node); UT_GenStub_AddParam(CF_Traverse_WriteTxnQueueEntryToFile, void *, arg); UT_GenStub_Execute(CF_Traverse_WriteTxnQueueEntryToFile, Basic, NULL); - return UT_GenStub_GetReturnValue(CF_Traverse_WriteTxnQueueEntryToFile, CFE_Status_t); + return UT_GenStub_GetReturnValue(CF_Traverse_WriteTxnQueueEntryToFile, CF_CListTraverse_Status_t); } /*