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

Functional test crc results are implementation (and possibly endian) dependent, fail vs hard coded expected value #1957

Closed
skliper opened this issue Sep 16, 2021 · 0 comments · Fixed by #1958
Assignees
Milestone

Comments

@skliper
Copy link
Contributor

skliper commented Sep 16, 2021

Is your feature request related to a problem? Please describe.
CRC calculations can depend on implementation or endianness of data being tested (test fails on MCP750 which is big endian):

void TestCalculateCRC(void)
{
const char *Data = "Random Stuff";
uint8 Data2[12];
uint32 expectedCrc = 20824;
uint32 inputCrc = 345353;
uint32 expectedBlockCrc = 2688;
UtPrintf("Testing: CFE_ES_CalculateCRC");
UtAssert_UINT32_EQ(CFE_ES_CalculateCRC(Data, sizeof(Data), 0, CFE_MISSION_ES_DEFAULT_CRC), expectedCrc);
memset(Data2, 1, sizeof(Data2));
UtAssert_UINT32_EQ(CFE_ES_CalculateCRC(&Data2, sizeof(Data2), inputCrc, CFE_MISSION_ES_CRC_16), expectedBlockCrc);
UtAssert_UINT32_EQ(CFE_ES_CalculateCRC(Data, sizeof(Data), 0, CFE_MISSION_ES_CRC_8), 0);
UtAssert_UINT32_EQ(CFE_ES_CalculateCRC(Data, sizeof(Data), 0, CFE_MISSION_ES_CRC_32), 0);
UtAssert_UINT32_EQ(CFE_ES_CalculateCRC(NULL, sizeof(Data), expectedCrc, CFE_MISSION_ES_CRC_16), expectedCrc);
UtAssert_UINT32_EQ(CFE_ES_CalculateCRC(Data, 0, expectedBlockCrc, CFE_MISSION_ES_CRC_16), expectedBlockCrc);
}

Describe the solution you'd like
Convert to MIR

Describe alternatives you've considered
None

Additional context
None

Requester Info
Jacob Hageman - NASA/GSFC

@skliper skliper added this to the 7.0.0 milestone Sep 16, 2021
@skliper skliper self-assigned this Sep 16, 2021
skliper added a commit to skliper/cFE that referenced this issue Sep 16, 2021
astrogeco added a commit that referenced this issue Sep 21, 2021
Fix #1957, Functional CRC converted to MIR to handle different implementations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant