-
Notifications
You must be signed in to change notification settings - Fork 204
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
fix #1055 - CFE_SB_ReceiveBuffer stub returns timeout or empty if buffer #1061
fix #1055 - CFE_SB_ReceiveBuffer stub returns timeout or empty if buffer #1061
Conversation
How about only setting the return codes if status is != 0? I'd expect if I force the return code (non-zero) it should always work... currently it would override any non-zero forced return code. |
Good question, I can see if I can figure out if the default return value has been changed or deferred and not override the return value if it has...But are there cases where someone would override the return value and not provide a buffer? |
All I was thinking is for the if (UT_Stub_CopyToLocal <= 0), add && status == 0 prior to modifying the return status code locally |
FYI - When a stub needs to "know" if a return code was explicitly set by the test case or not, easiest way is to use a "sentinel" value that differs from the default or any other known error, i.e. INT32_MAX or something like that. Use the |
After letting it sink in a bit - I'm actually OK with it as is if you want. Like it was said, there probably isn't a valid use case for a >= 0 forced return value if the buffer wasn't set. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My recommendation is to minimize the amount of "special sauce" in the stubs, such as special return codes, whenever possible. This special info should be in the test case setup, not in the stub. The exceptions to this are where we had existing test cases that depended on the stub behaving a certain way (such as several TIMEOUT responses, in the case of the old CFE_SB_RcvMsg). But since this is a new stub, we shouldn't have to do that hack.
In cases where there is an output data buffer required then the stub just contains an internal one (i.e. a static local variable) and that is output/returned if the test case didn't register one. It can be just zeroed out.
But at the end of the day, returning CFE_SUCCESS
is fine, if the test case didn't register anything. By definition, if the test case actually cares about having a specific/non-success error code from this function, it should register that status code in its setup.
CCB 2021-01-06 MODIFY
|
20200106 - CCB rejected, suggested correcting documentation to remove reference to timeout, cdknight will re-create pull to correct comments. |
32381af
to
54e1187
Compare
@CDKnightNASA have you worked on refactoring this? |
This is OBE, erroneous documentation was removed as part of stub refactor (update to stub/handler model). |
Closes #1055
This changes the return value returned by the
CFE_SB_ReceiveBuffer()
stub when there has not been a buffer defined.Testing performed
Tested with SB and SBN unit tests.
Contributor Info - All information REQUIRED for consideration of pull request
Christopher.D.Knight@nasa.gov