Skip to content

Sample tests should not use CFE_SB_InitMsg stub to initialize a message #89

@asgibson

Description

@asgibson

Describe the bug
CFE_SB_InitMsg is used in coveragetest_sample_app.c to initialize a message so that the CFE_SB_SendMsg stub has a valid message to use. This is not proper form. A unit test should not be calling a stub to provide this setup. Stubs are to be used by production code in place of the actual calls in order for a unit test to isolate the code under test, they should not be used as utility functions for the unit tests.

To Reproduce
See Code snips.

Expected behavior
Provide a ut_assert utility that has the functionality to create a cFS message for use by a unit test.

Code snips

CFE_SB_InitMsg(&SAMPLE_AppData.HkBuf.MsgHdr,
SAMPLE_APP_HK_TLM_MID,
sizeof(SAMPLE_AppData.HkBuf),
true);

System observed on:
RHEL 7.6

Additional context
This is related to a cFE issue. If the CFE_SB_SendMsg stub worked as described in there, most situations where this is used would not even be required (just verifying the message pointer instead of the actual message itself).
nasa/cFE#818

Reporter Info
Alan Gibson NASA GSFC/587

Metadata

Metadata

Assignees

No one assigned

    Labels

    invalidThis doesn't seem right

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions