You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
CFE_ES_RunLoop uses UT_DEFAULT_IMPL which typically returns CFE_SUCCESS, which happens to also equal 0. CFE_ES_RunLoop returns UT_DEFAULT_IMPL !=0, which causes the default return to be false (0 != 0). Is that the desired default behavior?
To Reproduce
Steps to reproduce the behavior:
Write a unit test that expects CFE_ES_RunLoop to succeed by default.
Run test, see that is not the behavior.
Expected behavior
I had expected 'true' to be the default.
To run a single loop for a unit test, this is required: UT_SetForceFail(UT_KEY(CFE_ES_RunLoop), true); UT_SetDeferredRetcode(UT_KEY(CFE_ES_RunLoop), 2, false);
The main reason this requirement does not make sense is UT_SetForceFail makes one think it should fail, not succeed.
System observed on:
RHEL 7.6
Additional context
If this is the desired behavior, close and disregard this issue.
Reporter Info
Alan Gibson NASA GSFC/587
The text was updated successfully, but these errors were encountered:
Yes, to default to false is indeed desired behavior, because in the typical use-case this function is the conditional on a while loop. So if defaulted to true one would have an infinite loop if no return code was configured.
Defaulting to false is just an easy way to keep it simple and avoid an infinite loop if the test case forgets to explicitly configure something. If you want one loop you should be able to just do:
The single loop was an example, so yes many iterations will require the force fail.
Where is the behavior for CFE_ES_RunLoop stub defined outside of the code? Do all bool return functions for stubs have this same behavior or just this one because of the loop usage?
Describe the bug
CFE_ES_RunLoop uses UT_DEFAULT_IMPL which typically returns CFE_SUCCESS, which happens to also equal 0. CFE_ES_RunLoop returns UT_DEFAULT_IMPL !=0, which causes the default return to be false (0 != 0). Is that the desired default behavior?
To Reproduce
Steps to reproduce the behavior:
Expected behavior
I had expected 'true' to be the default.
Code snips
cFE/fsw/cfe-core/ut-stubs/ut_es_stubs.c
Lines 1085 to 1089 in 8a7dc8f
To run a single loop for a unit test, this is required:
UT_SetForceFail(UT_KEY(CFE_ES_RunLoop), true);
UT_SetDeferredRetcode(UT_KEY(CFE_ES_RunLoop), 2, false);
The main reason this requirement does not make sense is UT_SetForceFail makes one think it should fail, not succeed.
System observed on:
RHEL 7.6
Additional context
If this is the desired behavior, close and disregard this issue.
Reporter Info
Alan Gibson NASA GSFC/587
The text was updated successfully, but these errors were encountered: