Skip to content

Commit

Permalink
fix for osal obj id changes
Browse files Browse the repository at this point in the history
  • Loading branch information
CDKnightNASA committed Sep 11, 2020
1 parent e1a5c23 commit 7305e53
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
#include "sbn_udp_if.h"
#include "sbn_app.h"

#define SBN_PROTOCOL_VERSION 5

SBN_App_t SBN;

SBN_NetInterface_t * NetPtr;
Expand Down Expand Up @@ -140,14 +142,14 @@ static void Init_VerErr(void)
{
START();

UT_TEST_FUNCTION_RC(SBN_UDP_Ops.InitModule(-1, 0), CFE_ES_ERR_APP_CREATE);
UT_TEST_FUNCTION_RC(SBN_UDP_Ops.InitModule(-1, 0), SBN_ERROR);
} /* end Init_VerErr() */

static void Init_Nominal(void)
{
START();

UT_TEST_FUNCTION_RC(SBN_UDP_Ops.InitModule(4, 0), CFE_SUCCESS);
UT_TEST_FUNCTION_RC(SBN_UDP_Ops.InitModule(SBN_PROTOCOL_VERSION, 0), CFE_SUCCESS);
} /* end Init_Nominal() */

void Test_SBN_UDP_Init(void)
Expand Down Expand Up @@ -401,7 +403,7 @@ static void Send_AddrInitErr(void)
{
START();

CFE_SB_MsgPtr_t SBMsgPtr;
CFE_SB_MsgPtr_t SBMsgPtr;
CFE_MSG_TelemetryHeader_t TlmPkt;

SBMsgPtr = (CFE_SB_MsgPtr_t)&TlmPkt;
Expand All @@ -419,7 +421,7 @@ static void Send_AddrInitErr(void)
static void Send_SendErr(void)
{
START();
CFE_SB_MsgPtr_t SBMsgPtr;
CFE_SB_MsgPtr_t SBMsgPtr;
CFE_MSG_TelemetryHeader_t TlmPkt;

SBMsgPtr = (CFE_SB_MsgPtr_t)&TlmPkt;
Expand All @@ -434,7 +436,7 @@ static void Send_SendErr(void)
static void Send_Nominal(void)
{
START();
CFE_SB_MsgPtr_t SBMsgPtr;
CFE_SB_MsgPtr_t SBMsgPtr;
CFE_MSG_TelemetryHeader_t TlmPkt;

SBMsgPtr = (CFE_SB_MsgPtr_t)&TlmPkt;
Expand Down
36 changes: 16 additions & 20 deletions unit-test/coveragetest/coveragetest_sbn_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "cfe_sb_events.h"
#include "sbn_pack.h"

#define STUB_TASKID 1073807361 /* TODO: should be replaced with a call to a stub util fn */
CFE_SB_MsgId_t MsgID = 0x1818;
/********************************** tests ************************************/
static void AppMain_ESRegisterErr(void)
Expand Down Expand Up @@ -1036,6 +1037,7 @@ static void PeerPoll_RecvPeerTask_Nominal(void)
SubRprt.Payload.MsgId = MsgID;
UT_SetDataBuffer(UT_KEY(CFE_SB_RcvMsg), &SubRprtPtr, sizeof(SubRprtPtr), false);
UT_SetDeferredRetcode(UT_KEY(CFE_SB_RcvMsg), 1, CFE_SUCCESS);
PeerPtr->RecvTaskID = STUB_TASKID;

CFE_SB_MsgId_t mid = CFE_SB_ONESUB_TLM_MID;
/* SBN_CheckSubscriptionPipe should succeed to return a sub msg */
Expand Down Expand Up @@ -1693,7 +1695,7 @@ static void RecvPeerTask_Empty(void)
IfOpsPtr->RecvFromNet = NULL;
IfOpsPtr->RecvFromPeer = RecvFromPeer_EmptyOne;

UT_SetDeferredRetcode(UT_KEY(OS_TaskGetId), 1, 0);
PeerPtr->RecvTaskID = STUB_TASKID;

SBN_RecvPeerTask();

Expand All @@ -1718,7 +1720,8 @@ static void RecvPeerTask_Nominal(void)
IfOpsPtr->RecvFromNet = NULL;
IfOpsPtr->RecvFromPeer = RecvFromPeer_One;

UT_SetDeferredRetcode(UT_KEY(OS_TaskGetId), 1, 0);
PeerPtr->RecvTaskID = STUB_TASKID;
/* eventually -- UT_ObjIdCompose(1, UT_OBJTYPE_TASK, &PeerPtr->RecvTaskID); */

SBN_RecvPeerTask();

Expand Down Expand Up @@ -1776,7 +1779,7 @@ static void RecvNetTask_Empty(void)

IfOpsPtr->RecvFromNet = RecvFromNet_EmptyOne;

UT_SetDeferredRetcode(UT_KEY(OS_TaskGetId), 1, 0);
NetPtr->RecvTaskID = STUB_TASKID;

SBN_RecvNetTask();

Expand All @@ -1799,7 +1802,7 @@ static void RecvNetTask_PeerErr(void)

IfOpsPtr->RecvFromNet = RecvFromNet_BadPeer;

UT_SetDeferredRetcode(UT_KEY(OS_TaskGetId), 1, 0);
NetPtr->RecvTaskID = STUB_TASKID;

SBN_RecvNetTask();

Expand Down Expand Up @@ -1828,7 +1831,7 @@ static void RecvNetTask_Nominal(void)

IfOpsPtr->RecvFromNet = RecvFromNet_One;

UT_SetDeferredRetcode(UT_KEY(OS_TaskGetId), 1, 0);
NetPtr->RecvTaskID = STUB_TASKID;

SBN_RecvNetTask();

Expand Down Expand Up @@ -1862,9 +1865,8 @@ static void SendTask_ConnTaskErr(void)
START();

PeerPtr->Connected = true;
PeerPtr->SendTaskID = 1;
PeerPtr->SendTaskID = STUB_TASKID;

UT_SetDeferredRetcode(UT_KEY(OS_TaskGetId), 1, 2);
UT_SetDeferredRetcode(UT_KEY(CFE_SB_RcvMsg), 2, -1);

SBN_SendTask();
Expand All @@ -1887,9 +1889,8 @@ static void SendTask_PeerNotConn(void)
START();

PeerPtr->Connected = false;
PeerPtr->SendTaskID = 1;
PeerPtr->SendTaskID = STUB_TASKID;

UT_SetDeferredRetcode(UT_KEY(OS_TaskGetId), 1, 1);
UT_SetDeferredRetcode(UT_KEY(CFE_SB_RcvMsg), 2, -1);

UT_SetHookFunction(UT_KEY(OS_TaskDelay), TaskDelayConn, NULL);
Expand All @@ -1907,7 +1908,7 @@ static void SendTask_FiltErr(void)
START();

PeerPtr->Connected = true;
PeerPtr->SendTaskID = 1;
PeerPtr->SendTaskID = STUB_TASKID;

SBN_FilterInterface_t Filter_Err;
memset(&Filter_Err, 0, sizeof(Filter_Err));
Expand All @@ -1917,7 +1918,6 @@ static void SendTask_FiltErr(void)
PeerPtr->Filters[0] = &Filter_Err;
PeerPtr->FilterCnt = 1;

UT_SetDeferredRetcode(UT_KEY(OS_TaskGetId), 1, 1);
UT_SetDeferredRetcode(UT_KEY(CFE_SB_RcvMsg), 2, -1);

SBN_SendTask();
Expand All @@ -1938,7 +1938,7 @@ static void SendTask_Filters(void)
START();

PeerPtr->Connected = true;
PeerPtr->SendTaskID = 1;
PeerPtr->SendTaskID = STUB_TASKID;

SBN_FilterInterface_t Filter_Empty, Filter_Nominal, Filter_Out;
memset(&Filter_Empty, 0, sizeof(Filter_Empty));
Expand All @@ -1953,7 +1953,6 @@ static void SendTask_Filters(void)
PeerPtr->Filters[2] = &Filter_Out;
PeerPtr->FilterCnt = 3;

UT_SetDeferredRetcode(UT_KEY(OS_TaskGetId), 1, 1);
UT_SetDeferredRetcode(UT_KEY(CFE_SB_RcvMsg), 2, -1);

SBN_SendTask();
Expand All @@ -1964,12 +1963,10 @@ static void SendTask_SendNetMsgErr(void)
START();

PeerPtr->Connected = true;
PeerPtr->SendTaskID = 1;
PeerPtr->SendTaskID = STUB_TASKID;

IfOpsPtr->Send = Send_Err;

UT_SetDeferredRetcode(UT_KEY(OS_TaskGetId), 1, 1);

SBN_SendTask();

UtAssert_INT32_EQ(PeerPtr->SendTaskID, 0);
Expand All @@ -1982,9 +1979,8 @@ static void SendTask_Nominal(void)
START();

PeerPtr->Connected = true;
PeerPtr->SendTaskID = 1;
PeerPtr->SendTaskID = STUB_TASKID;

UT_SetDeferredRetcode(UT_KEY(OS_TaskGetId), 1, 1);
UT_SetDeferredRetcode(UT_KEY(CFE_SB_RcvMsg), 2, -1);

SBN_SendTask();
Expand All @@ -2007,7 +2003,7 @@ void SendNetMsg_MutexTakeErr(void)

UT_CheckEvent_Setup(SBN_PEER_EID, "unable to take mutex");

PeerPtr->SendTaskID = 1;
PeerPtr->SendTaskID = STUB_TASKID;
UT_SetDeferredRetcode(UT_KEY(OS_MutSemTake), 1, -1);

UtAssert_INT32_EQ(SBN_SendNetMsg(0, 0, NULL, PeerPtr), SBN_ERROR);
Expand All @@ -2021,7 +2017,7 @@ void SendNetMsg_MutexGiveErr(void)

UT_CheckEvent_Setup(SBN_PEER_EID, "unable to give mutex");

PeerPtr->SendTaskID = 1;
PeerPtr->SendTaskID = STUB_TASKID;
UT_SetDeferredRetcode(UT_KEY(OS_MutSemGive), 1, -1);

UtAssert_INT32_EQ(SBN_SendNetMsg(0, 0, NULL, PeerPtr), SBN_ERROR);
Expand Down
2 changes: 1 addition & 1 deletion unit-test/coveragetest/coveragetest_sbn_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "cfe_sb_events.h"
#include "sbn_pack.h"

uint8 Buffer[1024];
uint8 Buffer[1024];

#ifdef _cfe_msg_api_
CFE_MSG_Message_t *CmdPktPtr = (CFE_MSG_Message_t *)Buffer;
Expand Down

0 comments on commit 7305e53

Please sign in to comment.