Skip to content

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

@skliper

Description

@skliper

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                 :            :                     }

if ((*(char *)&EndianCheck) == 0x04)
{
/* If this is a little endian processor, then the standard cFE Table Header, */
/* which is in big endian format, must be swapped so that the data is readable */
CFE_TBL_ByteSwapTblHeader(TblFileHeaderPtr);
}

same pattern in:

/* Determine if this is a little endian processor */
if ((*(char *)&EndianCheck) == 0x04)
{
/* If this is a little endian processor, then byte swap the header to a big endian format */
/* to maintain the cFE Header standards */
/* NOTE: FOR THE REMAINDER OF THIS FUNCTION, THE CONTENTS OF THE HEADER IS UNREADABLE BY */
/* THIS PROCESSOR! THE DATA WOULD NEED TO BE SWAPPED BACK BEFORE READING. */
CFE_TBL_ByteSwapTblHeader(&TblFileHeader);
}

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions