nasa / cFE

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

TBL missing branch coverage of run-time endian logic (and sometimes line) #1900

Open skliper opened 3 years ago

skliper commented 3 years ago

Is your feature request related to a problem? Please describe. TBL suffers from the unfortunate pattern of run time checks for endian (and associated logic), which leads to uncovered branches and possibly uncovered code (depending on endian of platform).

    1158         [ +  - ]:         33 :                     if ((*(char *)&EndianCheck) == 0x04)
    1159                 :            :                     {
    1160                 :            :                         /* If this is a little endian processor, then the standard cFE Table Header,   */
    1161                 :            :                         /* which is in big endian format, must be swapped so that the data is readable */
    1162                 :         33 :                         CFE_TBL_ByteSwapTblHeader(TblFileHeaderPtr);
    1163                 :            :                     }

https://github.com/nasa/cFE/blob/5e41330979586bcdb113f491ea6c38ff9975fc72/modules/tbl/fsw/src/cfe_tbl_internal.c#L1158-L1163

same pattern in: https://github.com/nasa/cFE/blob/5e41330979586bcdb113f491ea6c38ff9975fc72/modules/tbl/fsw/src/cfe_tbl_task_cmds.c#L740-L748

Describe the solution you'd like Complete coverage is possible if run on each system, but should be resolved in the future. Possibly in concert with #1209 and related abstraction such that this code doesn't care (whatever underlying API/implementation that handles raw data should do the appropriate conversion).

Describe alternatives you've considered None

Additional context Same as #1882 for FS

Requester Info Jacob Hageman - NASA/GSFC

avan989 commented 1 year ago

comment same as #1882