Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
skliper opened this issue Aug 26, 2021 · 1 comment
Open

Comments

@skliper
Copy link
Contributor

skliper commented Aug 26, 2021

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

@avan989
Copy link
Contributor

avan989 commented Jun 5, 2023

comment same as #1882

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants