-
Notifications
You must be signed in to change notification settings - Fork 236
Description
Describe the bug
cFE/fsw/cfe-core/unit-test/ut_support.c
Lines 153 to 166 in e0d1ce8
| /* | |
| * Set up for the CFE_SB_RcvMsg() call. | |
| * | |
| * The existing test cases assume that this will return success once, | |
| * followed by a timeout response followed by a different error. | |
| * | |
| * Specific test cases may provide an actual message buffer to return for | |
| * the first call, or they may override this default behavior entirely. | |
| * | |
| * The default behavior of the CFE_SB_RcvMsg stub is to return success with a zero-ed out | |
| * buffer returned to the caller. | |
| */ | |
| UT_SetDeferredRetcode(UT_KEY(CFE_SB_RcvMsg), 2, CFE_SB_TIME_OUT); | |
| UT_SetDeferredRetcode(UT_KEY(CFE_SB_RcvMsg), 3, -1); |
Description above makes it sound like calls to CFE_SB_RcvMsg will return: 0, CFE_SB_TIME_OUT, -1. In practice it returns 0, CFE_SB_TIME_OUT, 0, 0, -1 since each call to UT_SetDeferredRetcode sets up another entry in the table, and each entry is processed until complete before moving on to the next (which restarts the counter).
The osal description is clear, it's just not used correctly in cFE:
https://github.com/nasa/osal/blob/5a8f0afa3a6ef6945661d6fc893d4592d9360b5a/ut_assert/inc/utstubs.h#L120-L139
To Reproduce
Set more than one UT_SetDeferredRetcode on the same key, observe response.
Expected behavior
Set up so it will do 0, CFE_SB_TIME_OUT, -1:
UT_SetDeferredRetcode(UT_KEY(CFE_SB_RcvMsg), 2, CFE_SB_TIME_OUT);
UT_SetDeferredRetcode(UT_KEY(CFE_SB_RcvMsg), 1, -1);
Code snips
See above
System observed on:
- Hardware: cFS Dev Server
- OS: Ubuntu 18.04
- Versions Bundle main
Additional context
None.
Reporter Info
Jacob Hageman - NASA/GSFC