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

Replace direct ref to UT assert structure with macro #59

Closed
jphickey opened this issue Apr 16, 2021 · 0 comments · Fixed by #60 or #61
Closed

Replace direct ref to UT assert structure with macro #59

jphickey opened this issue Apr 16, 2021 · 0 comments · Fixed by #60 or #61

Comments

@jphickey
Copy link
Contributor

Describe the bug
A test in sample_lib is directly referencing the ArgPtr member inside the Context object from the hook call. Since the time this was initially implemented, the Ut Assert framework has improved, and now offers a UT_Hook_GetArgValueByName macro get this value.

Directly referencing the value is not a good design and is likely to break as Ut Assert continues to evolve.

Expected behavior
This should be updated to use the preferred macro, UT_Hook_GetArgValueByName, which is more future-proof and reflects current best practice/recommendations for new tests.

Code snips

if (Context->ArgCount > 0 && strcmp(Context->ArgPtr[0], "SAMPLE_LIB_Function called, buffer=\'%s\'\n") == 0)

System observed on:
Ubuntu 20.04

Additional context
The specific thing pointed to by ArgPtr depends on how the stub was implemented, and the macro abstracts this detail to give a consistent result to the caller. This is why it is important to use the macro.

Reporter Info
Joseph Hickey, Vantage Systems, Inc.

jphickey added a commit to jphickey/sample_lib that referenced this issue Apr 16, 2021
The UT_Hook_GetArgValueByName macro provided by UT assert is the preferred
way to get an argument in the current version.  Reading the pointer directly
is not advised as it depends on how the stub was actually implemented,
whereas the macro should produce consistent results.
jphickey added a commit to jphickey/sample_lib that referenced this issue Apr 16, 2021
The UT_Hook_GetArgValueByName macro provided by UT assert is the preferred
way to get an argument in the current version.  Reading the pointer directly
is not advised as it depends on how the stub was actually implemented,
whereas the macro should produce consistent results.
jphickey added a commit to jphickey/sample_lib that referenced this issue Apr 16, 2021
The UT_Hook_GetArgValueByName macro provided by UT assert is the preferred
way to get an argument in the current version.  Reading the pointer directly
is not advised as it depends on how the stub was actually implemented,
whereas the macro should produce consistent results.
astrogeco added a commit that referenced this issue Apr 28, 2021
Fix #59, replace direct ref to ArgPtr with macro
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant