Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unsubscribe test case to cover #862 #873

Closed
skliper opened this issue Sep 9, 2020 · 2 comments · Fixed by #875 or #876
Closed

Add unsubscribe test case to cover #862 #873

skliper opened this issue Sep 9, 2020 · 2 comments · Fixed by #875 or #876
Assignees
Milestone

Comments

@skliper
Copy link
Contributor

skliper commented Sep 9, 2020

Is your feature request related to a problem? Please describe.
#862 looks like it could have resulted in a seg fault, fixed in #865
Unsubscribe after no subscriptions are left...

Describe the solution you'd like
Add test case.

Describe alternatives you've considered
None. Should add test to confirm code works.

Additional context
#862 #865

Requester Info
Jacob Hageman - NASA/GSFC
@CDKnightNASA

@CDKnightNASA
Copy link
Contributor

Looks like current tests hits it ... lcov report shows that lines 1102-1110 were covered one time. But I will assume you mean that you'd like an explicit test.

@skliper
Copy link
Contributor Author

skliper commented Sep 10, 2020

Note `Test_Unsubscribe_NoMatch) doesn't actually unsubscribe from MsgId or SB_UT_TLM_MID1, so it's not checking the unsubscribe followed by unsubscribe case. The test modifies the PipeId for the MsgId description such that it won't unsubscribe. I had to dig a bit since the test is light on comments as to the "why"...

void Test_Unsubscribe_NoMatch(void)
{
CFE_SB_PipeId_t TestPipe;
CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID;
CFE_SB_MsgRouteIdx_t Idx;
uint16 PipeDepth = 50;
SETUP(CFE_SB_CreatePipe(&TestPipe, PipeDepth, "TestPipe"));
SETUP(CFE_SB_Subscribe(MsgId, TestPipe));
ASSERT(CFE_SB_Unsubscribe(SB_UT_TLM_MID1, TestPipe));
/* Get index into routing table */
Idx = CFE_SB_GetRoutingTblIdx(CFE_SB_ConvertMsgIdtoMsgKey(MsgId));
CFE_SB.RoutingTbl[CFE_SB_RouteIdxToValue(Idx)].ListHeadPtr->PipeId = 1;
CFE_SB.RoutingTbl[CFE_SB_RouteIdxToValue(Idx)].ListHeadPtr->Next = NULL;
ASSERT(CFE_SB_Unsubscribe(MsgId, TestPipe));
EVTCNT(7);
EVTSENT(CFE_SB_UNSUB_NO_SUBS_EID);
TEARDOWN(CFE_SB_DeletePipe(TestPipe));
} /* end Test_Unsubscribe_NoMatch */

yammajamma added a commit that referenced this issue Sep 10, 2020
Fix #873, Add test for SB subscribe/unusubscribe/unsubscribe
@astrogeco astrogeco added this to the 7.0.0 milestone Oct 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants