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

Add better support for pointer return values in UT assert #1344

Closed
jphickey opened this issue Dec 8, 2022 · 0 comments · Fixed by #1352
Closed

Add better support for pointer return values in UT assert #1344

jphickey opened this issue Dec 8, 2022 · 0 comments · Fixed by #1352
Assignees
Milestone

Comments

@jphickey
Copy link
Contributor

jphickey commented Dec 8, 2022

Is your feature request related to a problem? Please describe.
Currently, UT assert only as built-in support for 32-bit integer return values, in the form of UT_SetDefaultReturnValue and UT_SetDeferredRetcode. The majority of CFE/CFS APIs have a 32-bit integer return value, so this has been good enough.

However, there are also a fair number of CFE functions that return pointer values, and these int32 APIs do not currently work for pointer returns. Any stub that returns a pointer must have its own custom handler function to help set the return value, and so support is spotty. Every function that has a pointer return may have a slightly different way to control the return value, and a different range of things that can be done by the test to modify its behavior.

Describe the solution you'd like
Add two new APIs to UT assert:

  • UT_SetDefaultReturnObject
  • UT_SetDeferredReturnObject

These would work like the current integer functions, respectively, but accept pointers with a size instead of an integer. This type of signature could support ALL types of return values, including 8-bit, 16-bit, 64-bit, and potentially even larger structures (even though code should not output large structures via return value, it could be done).

Describe alternatives you've considered
A halfway point could be to just add generic reusable handlers that return a pointer, and could be registered to any function. But that would not be as clean, and would still need a separate function for each type.

Additional context
This can be added without breaking any currently-existing tests or stubs, because its only a new type of return record. It would not change anything about the existing logic, just extend it.

Requester Info
Joseph Hickey, Vantage Systems, Inc.

@jphickey jphickey self-assigned this Jan 19, 2023
dzbaker added a commit that referenced this issue Feb 2, 2023
@dzbaker dzbaker closed this as completed in c11a4f3 Feb 2, 2023
@chillfig chillfig added this to the Draco milestone Feb 7, 2023
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.

2 participants