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
This issue was imported from the GSFC issue tracking system
Imported from: [GSFCCFS-1733] CF method CF_Assert call branches cannot be tested during unit testing Originally submitted by: Gibson, Alan S. (GSFC-5870) on Wed Sep 22 16:31:48 2021
Original Description:
Calls to CF_Assert() cannot be stubbed by unit testing.
The reasons:
CF_Assert uses assert which will kill the running process and subsequently the unit test runner when called by code under test.
CF_Assert can be stubbed
a. The stub cannot stop the return to the code under test.
b. The value required to cover the branch will cause a segfault upon return -- as the intent of CF_Assert is to kill the app before it takes cFS with it.
c. There is currently no allowable way to have these branches tested during automated runs.
d. It is possible to run ad hoc tests to show the assert occurs, but the unit test will stop and not return to the original test code as the automated tests do.
The text was updated successfully, but these errors were encountered:
CF_Assert(sret!=CF_SEND_ERROR); /* CF_CFDP_SendFin does not return CF_SEND_ERROR */
What value does it add to assert that a local function did not return the value it does not return? In reality it only matters if it was CF_SEND_SUCCESS or not. Assertions like this unnecessary clutter in the code.
One possible solution here is to convert the assert statements into DEBUG asserts, and default to compiling them out. This way the information is still preserved in the code (i.e. that the value must be within some range or not NULL, etc) but these are not flagged as branches that are not covered in the tests. This way a user could still turn them back on if they want to.
Changes CF_Assert to be opt-in rather than opt-out, so that under normal
verification and validation the asserts will _not_ be included, but they
can still be added back during development, if desired.
They mainly exist as notes to developers as to what is supposed to be true,
once debugged it is impossible to get these conditions, by definition.
Also removes one channel calculation that was only for assert. Note that
the same condition is asserted later, so it was redundant anyway.
This issue was imported from the GSFC issue tracking system
Imported from: [GSFCCFS-1733] CF method CF_Assert call branches cannot be tested during unit testing
Originally submitted by: Gibson, Alan S. (GSFC-5870) on Wed Sep 22 16:31:48 2021
Original Description:
Calls to CF_Assert() cannot be stubbed by unit testing.
The reasons:
a. The stub cannot stop the return to the code under test.
b. The value required to cover the branch will cause a segfault upon return -- as the intent of CF_Assert is to kill the app before it takes cFS with it.
c. There is currently no allowable way to have these branches tested during automated runs.
d. It is possible to run ad hoc tests to show the assert occurs, but the unit test will stop and not return to the original test code as the automated tests do.
The text was updated successfully, but these errors were encountered: