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

Use "CallTaskPipe" wrapper in sb_UT #1988

Closed
jphickey opened this issue Oct 6, 2021 · 0 comments · Fixed by #1995 or #2001
Closed

Use "CallTaskPipe" wrapper in sb_UT #1988

jphickey opened this issue Oct 6, 2021 · 0 comments · Fixed by #1995 or #2001
Assignees
Milestone

Comments

@jphickey
Copy link
Contributor

jphickey commented Oct 6, 2021

Is your feature request related to a problem? Please describe.
All other unit test modules (es, evs, tbl, time) go through a wrapper provided in the support code called UT_CallTaskPipe to invoke a command handler via the task's message handler function. This helper function would set up the MSG stubs properly to dispatch to the given command code, avoiding the need to repeat the same setup calls dozens of times in the UT.

For historical reasons, the SB unit test did not do this - because the message accessor functions were also implemented in SB, and therefore it could not rely on stub behavior to set up proper dispatch (i.e. it had to do the "real" thing).

However, with the advent of the separate MSG module, this is no longer the case. The sb_UT.c now uses/sets up MSG stubs to do the dispatch, but it was never converted to use the same wrapper that other modules do. Instead, the same setup code is repeated all over the tests.

Describe the solution you'd like
Convert oft-repeated sequences like:

UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false);
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false);
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false);
....
CFE_SB_ProcessCmdPipePkt(MsgPtr);

To be:

UT_CallTaskPipe(CFE_SB_ProcessCmdPipePkt, MsgPtr, Params...);

Additional context
This is initially for clean up and readability, but it greatly improves flexibility too - if/when the core modules switch to a more intelligent verification and dispatch method, only UT_CallTaskPipe needs to be updated to support the dispatch method, not dozens (or even hundreds) of different test cases.

Requester Info
Joseph Hickey, Vantage Systems, Inc.

jphickey added a commit to jphickey/cFE that referenced this issue Oct 6, 2021
Utilize the common setup/wrapper functions in ut_support.c whenever
possible MSG dispatching in the generic handler.
jphickey added a commit to jphickey/cFE that referenced this issue Oct 6, 2021
Utilize the common setup/wrapper functions in ut_support.c whenever
possible MSG dispatching in the generic handler.
jphickey added a commit to jphickey/cFE that referenced this issue Oct 6, 2021
Utilize the common setup/wrapper functions in ut_support.c whenever
possible MSG dispatching in the generic handler.
@astrogeco astrogeco self-assigned this Oct 28, 2021
astrogeco added a commit to astrogeco/cFE that referenced this issue Nov 3, 2021
Fix nasa#1988, consolidate repeated MSG stub setup in sb_UT
@skliper skliper added this to the Draco milestone Mar 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants