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

MSG missing branch coverage, would require alternate/stub implementation and splitting up coverage executable #1887

Open
skliper opened this issue Aug 25, 2021 · 1 comment

Comments

@skliper
Copy link
Contributor

skliper commented Aug 25, 2021

Is your feature request related to a problem? Please describe.
The software is implemented to support multiple options but currently just utilizes a single option to build one executable (see issue #1886) which means it's impossible to cover all the branches.

Example - can't hit the non-success case of the following branch since the selected implementation for CFE_MSG_GetType used internally can't fail (although conceptually an implementation could test the header version and reject if it doesn't match for example):

status = CFE_MSG_GetType(MsgPtr, &type);
if (status != CFE_SUCCESS || type != CFE_MSG_Type_Cmd || !hassechdr)
{
return CFE_MSG_WRONG_MSG_TYPE;
}

Describe the solution you'd like
This could be solved by implementing #1886 (related to #631)

Describe alternatives you've considered
None

Additional context
Results in 6 branches not being exercised.

Requester Info
Jacob Hageman - NASA/GSFC

@avan989
Copy link
Contributor

avan989 commented Jun 2, 2023

The current call to CFE_MSG_GetType in CFE_MSG_GenerateChecksum is to cfe/modules/msg/fsw/src/cfe_msg_ccsdspri.c. This function only returns CFE_SUCCESS. Cannot hit the Non-success case for "status" in CFE_MSG_GenerateChecksum with the current build. Full code coverage is not possible unless we follow what @skliper recommends or rewrite CFE_MSG_GenerateCheckSum. @dmknutsen @dzbaker

CFE_Status_t CFE_MSG_GetType(const CFE_MSG_Message_t *MsgPtr, CFE_MSG_Type_t *Type)
{
if (MsgPtr == NULL || Type == NULL)
{
return CFE_MSG_BAD_ARGUMENT;
}
if ((MsgPtr->CCSDS.Pri.StreamId[0] & (CFE_MSG_TYPE_MASK >> 8)) != 0)
{
*Type = CFE_MSG_Type_Cmd;
}
else
{
*Type = CFE_MSG_Type_Tlm;
}
return CFE_SUCCESS;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants