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

Unit test fails when VER_2 headers are used #87

Closed
skliper opened this issue Aug 7, 2020 · 3 comments · Fixed by #94, #98 or #99
Closed

Unit test fails when VER_2 headers are used #87

skliper opened this issue Aug 7, 2020 · 3 comments · Fixed by #94, #98 or #99
Labels
bug Something isn't working
Milestone

Comments

@skliper
Copy link
Contributor

skliper commented Aug 7, 2020

Describe the bug
Event test strings are different when the MsgId size changes, but test looks for explict message:

CFE_EVS_SendEvent(SAMPLE_INVALID_MSGID_ERR_EID,
CFE_EVS_EventType_ERROR,
"SAMPLE: invalid command packet,MID = 0x%x",
(unsigned int)CFE_SB_MsgIdToValue(MsgId));

UT_CheckEvent_Setup(&EventTest, SAMPLE_INVALID_MSGID_ERR_EID, "SAMPLE: invalid command packet,MID = 0xffff");

UT_CheckEvent_Setup(&EventTest, SAMPLE_LEN_ERR_EID, "Invalid Msg length: ID = 0xFFFF, CC = 0, Len = 18, Expected = 8");

!VER_2 = 0xffff, VER_2 =0xffffffff (or capitalized based on the format string)

To Reproduce
Set MESSAGE_FORMAT_IS_CCSDS_VER_2, build and run unit tests.

Expected behavior
Unit tests should pass with either configuration

Code snips
See above.

System observed on:

  • Hardware: cFS Dev VM
  • OS: Ubuntu 18.04
  • Versions: main bundle

Additional context
None

Reporter Info
Jacob Hageman - NASA/GSFC

@skliper
Copy link
Contributor Author

skliper commented Aug 7, 2020

Probably easiest to just remove the explicit string check (pass in blank).

@jphickey
Copy link
Contributor

jphickey commented Aug 7, 2020

Yeah, this is why I don't like to check derived output in UT. My recommendation is (and has always been) to only check the direct outputs of the unit under test, which in this case is the format string (i.e. "SAMPLE: invalid command packet,MID = 0x%x") not the fully formed output string, which is dependent on a number of factors outside the control of the unit under test.

IIRC there were some folks specifically wanting to do this type of test and hence why it was included in sample_app example.

A possible compromise would be to only check the format string.

@skliper
Copy link
Contributor Author

skliper commented Sep 11, 2020

Note with nasa/cFE#880 the reported error is now consistent since message ID base type is uint32.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants