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

Fix #49, aligned buffer for all test commands #79

Merged
merged 1 commit into from
Dec 8, 2021

Conversation

jphickey
Copy link
Contributor

@jphickey jphickey commented Dec 1, 2021

Where ever a unit test is generating a buffer on the stack to send to a command processing function, this typically needs to be represented as a CFE_SB_Buffer_t* pointer, which by definition is supposed to be aligned to the worst-possible case, which may be greater than the alignment requirement of the actual command type.

To avoid warnings when converting between types, use a union to ensure the stack object meets the alignment requirements for CFE_SB_Buffer_t.

Furthermore, ensure all buffers instantiated on the stack are cleared (memset to 0) before operating on them or passing them to a CF function.

Fixes #49

Where ever a unit test is generating a buffer on the stack to send to a
command processing function, this typically needs to be represented as
a CFE_SB_Buffer_t* pointer, which by definition is supposed to be
aligned to the worst-possible case, which may be greater than the
alignment requirement of the actual command type.

To avoid warnings when converting between types, use a union to ensure
the stack object meets the alignment requirements for CFE_SB_Buffer_t.

Furthermore, ensure all buffers instantiated on the stack are cleared
(memset to 0) before operating on them or passing them to a CF function.
@jphickey jphickey added the CCB:Ready Ready for discussion at the Configuration Control Board (CCB) label Dec 1, 2021
@astrogeco astrogeco removed the CCB:Ready Ready for discussion at the Configuration Control Board (CCB) label Dec 8, 2021
@astrogeco
Copy link
Contributor

CCB:2021-12-08 - APPROVED

@astrogeco astrogeco closed this Dec 8, 2021
@astrogeco astrogeco reopened this Dec 8, 2021
@astrogeco astrogeco added the unit-test Related to coverage or functional tests label Dec 8, 2021
@astrogeco astrogeco merged commit fdbfa3b into nasa:main Dec 8, 2021
@jphickey jphickey deleted the fix-49-ut-command-union branch December 9, 2021 16:39
@skliper skliper added this to the Draco milestone Mar 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CCB:Approved draco-rc1 unit-test Related to coverage or functional tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CF command tests need to use union when instantiating objects of type CFE_SB_Buffer_t
3 participants