-
Notifications
You must be signed in to change notification settings - Fork 56
Description
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
sample_app/unit-test/coveragetest/coveragetest_sample_app.c
Lines 414 to 417 in c1348d6
| 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