nasa / cFE

The Core Flight System (cFS) Core Flight Executive (cFE)
Apache License 2.0
413 stars 202 forks source link

MSG missing branch coverage, would require alternate/stub implementation and splitting up coverage executable #1887

Open skliper opened 3 years ago

skliper commented 3 years ago

Is your feature request related to a problem? Please describe. The software is implemented to support multiple options but currently just utilizes a single option to build one executable (see issue #1886) which means it's impossible to cover all the branches.

Example - can't hit the non-success case of the following branch since the selected implementation for CFE_MSG_GetType used internally can't fail (although conceptually an implementation could test the header version and reject if it doesn't match for example): https://github.com/nasa/cFE/blob/5e41330979586bcdb113f491ea6c38ff9975fc72/modules/msg/fsw/src/cfe_msg_sechdr_checksum.c#L79-L83

Describe the solution you'd like This could be solved by implementing #1886 (related to #631)

Describe alternatives you've considered None

Additional context Results in 6 branches not being exercised.

Requester Info Jacob Hageman - NASA/GSFC

avan989 commented 1 year ago

The current call to CFE_MSG_GetType in CFE_MSG_GenerateChecksum is to cfe/modules/msg/fsw/src/cfe_msg_ccsdspri.c. This function only returns CFE_SUCCESS. Cannot hit the Non-success case for "status" in CFE_MSG_GenerateChecksum with the current build. Full code coverage is not possible unless we follow what @skliper recommends or rewrite CFE_MSG_GenerateCheckSum. @dmknutsen @dzbaker

https://github.com/nasa/cFE/blob/5e41330979586bcdb113f491ea6c38ff9975fc72/modules/msg/fsw/src/cfe_msg_ccsdspri.c#L117-L135