-
Notifications
You must be signed in to change notification settings - Fork 217
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 #1344, UT assert stub return values #1352
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Improves default support for return values of sizes other than 32 bits. Previously this required a custom handler for any value that was not a 32 bit integer. With this update any integer value can be used, and a value translation will occur if the size is differnt. Thus boolean values, 8,16, and 64-bit ints can be configured through the same basic API without needing to add a handler.
--StubPtr->Data.Rc.Count; | ||
/* For "unknown" types the pointer is stored directly - this allows for ANY return type of ANY size, | ||
* but requires that the caller maintain the buffer in scope until the test completes */ | ||
StubPtr->Data.Rvc.Buf.IndirectPtr = ValuePtr; |
Check warning
Code scanning / CodeQL-security
Local variable address stored in non-local memory
A stack address which arrived via a [parameter](1) may be assigned to a non-local variable.
dzbaker
added
the
CCB:Ready
Pull request is ready for discussion at the Configuration Control Board (CCB)
label
Jan 19, 2023
CCB 19 January 2023: Will review after next release. |
chillfig
approved these changes
Jan 24, 2023
2 tasks
dzbaker
added
CCB:Approved
Indicates code review and approval by community CCB
and removed
CCB:Ready
Pull request is ready for discussion at the Configuration Control Board (CCB)
labels
Feb 2, 2023
2 tasks
dzbaker
added a commit
to nasa/cFS
that referenced
this pull request
Feb 2, 2023
*Combines:* osal v6.0.0-rc4+dev187 **Includes:** *osal* - nasa/osal#1352 Co-authored by: Joseph Hickey <jphickey@users.noreply.github.com>
dzbaker
added a commit
to nasa/cFS
that referenced
this pull request
Feb 2, 2023
*Combines:* osal v6.0.0-rc4+dev187 **Includes:** *osal* - nasa/osal#1352 Co-authored by: Joseph Hickey <jphickey@users.noreply.github.com>
dzbaker
added a commit
to nasa/cFS
that referenced
this pull request
Feb 3, 2023
*Combines:* osal v6.0.0-rc4+dev191 **Includes:** *osal* - nasa/osal#1352 - nasa/osal#1362 Co-authored by: Joseph Hickey <jphickey@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Checklist (Please check before submitting)
Describe the contribution
Improves default support for return values of sizes other than 32 bits. Previously this required a custom handler for any value that was not a 32 bit integer. With this update any integer value can be used, and a value translation will occur if the size is different. Thus boolean values, 8,16, and 64-bit ints can be configured through the same basic API without needing to add a handler.
Fixes #1344
Testing performed
Build and run all tests, including CFS app tests, to confirm all still run as expected.
Expected behavior changes
No change to existing behavior - all currently-implemented test cases should continue to behave as they have in the past, whether they used a 32-bit integer return or if they had a custom hook/handler.
Going forward, it should no longer be required to implement a custom handler for the sole purpose of adjusting the size of the return value in case it is not a 32-bit integer. As a fallback default, any return value that is unset by a test will be memset to 0. So a pointer stub return will get
NULL
, a boolean will getFALSE
, and any numeric value of any time will be zero.The
UT_SetDeferredRetcode
andUT_SetDefaultReturnValue
functions now accept aUT_IntReturn_t
value instead ofint32
. This typedef is defined using the C99ptrdiff_t
type, which will be 64 bits in size on modern hardware. When passing by value from an int32, this should be transparent, but it is large enough to also allow test cases to pass in pointer values here without truncating.System(s) tested on
Debian
Additional context
API to set return values is still numeric in nature. This adds some framework to allow fully-typed values and abstract objects bigger than
ptrdiff_t
values to be returned, but there is no API yet - that can be added in a future change.Contributor Info - All information REQUIRED for consideration of pull request
Joseph Hickey, Vantage Systems, Inc.