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

ut_sb_stubs.c decription comment for CFE_SB_RcvMsg does not match code #715

Closed
asgibson opened this issue May 22, 2020 · 1 comment · Fixed by #1015
Closed

ut_sb_stubs.c decription comment for CFE_SB_RcvMsg does not match code #715

asgibson opened this issue May 22, 2020 · 1 comment · Fixed by #1015

Comments

@asgibson
Copy link
Contributor

Describe the bug
In ut_sb_stubs.c description comment for CFE_SB_RcvMsg incorrectly states that first call returns CFE_SUCCESS, while additional calls return -1. It appears that it will always return CFE_SUCCESS.

To Reproduce
Steps to reproduce the behavior:

  1. Write a test where CFE_SB_RcvMsg is called at least twice.
  2. Check result on first call == CFE_SUCCESS, will pass
  3. Check result on second call == -1, will fail (result is CFE_SUCCESS instead)
  4. additional calls have same result as 3 above.

Expected behavior
Rewrite comment to show that result returned is always CFE_SUCCESS, unless the commented behavior is what is desired, then fix code to accomplish that.

Code snips

/*****************************************************************************/
/**
** \brief CFE_SB_RcvMsg stub function
**
** \par Description
**        This function is used to mimic the response of the cFE SB function
**        CFE_SB_RcvMsg.  By default it will return the TIMEOUT error response,
**        unless the test setup sequence has indicated otherwise.
**
** \par Assumptions, External Events, and Notes:
**        None
**
** \returns
**        Returns CFE_SUCCESS on the first call, then -1 on the second.
**
******************************************************************************/
int32 CFE_SB_RcvMsg(CFE_SB_MsgPtr_t *BufPtr,
                    CFE_SB_PipeId_t PipeId,
                    int32 TimeOut)
{
    int32 status;
    static union
    {
        CFE_SB_Msg_t Msg;
        uint8 Ext[CFE_MISSION_SB_MAX_SB_MSG_SIZE];
    } Buffer;

    status = UT_DEFAULT_IMPL(CFE_SB_RcvMsg);

    if (status >= 0)
    {
        if (UT_Stub_CopyToLocal(UT_KEY(CFE_SB_RcvMsg), (uint8*)BufPtr, sizeof(*BufPtr)) < sizeof(*BufPtr))
        {
            memset(&Buffer, 0, sizeof(Buffer));
            *BufPtr = &Buffer.Msg;
        }
    }

    return status;
}

System observed on:

  • Hardware: PC
  • OS: RHEL Workstation 7.6 (Maipo), Linux 3.10.0-1062.1.2.el7.x86_64
  • Versions cFE 6.7

Additional context
Add any other context about the problem here.

Reporter Info
Alan Gibson, NASA, GSFC-0587

@skliper skliper added this to the 7.0.0 milestone Jan 11, 2021
@skliper skliper linked a pull request Jan 11, 2021 that will close this issue
@skliper
Copy link
Contributor

skliper commented Jan 11, 2021

This function was deprecated in #1015, closing issue.

@skliper skliper closed this as completed Jan 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants