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

UtAssert should enforce newline on messages only if its missing #1002

Closed
jphickey opened this issue May 12, 2021 · 0 comments · Fixed by #1006
Closed

UtAssert should enforce newline on messages only if its missing #1002

jphickey opened this issue May 12, 2021 · 0 comments · Fixed by #1006
Labels
enhancement unit-test Tickets related to the OSAL unit testing (functional and/or coverage)
Milestone

Comments

@jphickey
Copy link
Contributor

Is your feature request related to a problem? Please describe.
Currently the UT_BSP_DoText used by UtAssert appends a newline after every message, see here:

OS_BSP_ConsoleOutput_Impl("\n", 1);

However, in many calls to UtPrintf() the test author already included a \n in the format string, such as here:

UtPrintf("Starting GenericTask: %s, id: %lx\n", task_prop.name, OS_ObjectIdToInteger(task_id));

As a result there is extra whitespace in the log, example here:
https://gist.github.com/jphickey/ccb739d1f1cf6b36caca73e5ee9205cf#file-osal_core_ut-log-L391

Describe the solution you'd like
The append of the newline in UT_BSP_DoText() should only happen if the message did not have a trailing newline already. This will still accomplish the intent of making sure output messages end in a newline and do not run together, but will clean up extra unintended blank lines in the log files.

Additional context
This is mainly just a nitpick/pet peeve about the extra blank lines that come with "UtPrintf", but it also does potentially impact parsing log files with scripts.

Requester Info
Joseph Hickey, Vantage Systems, Inc.

jphickey added a commit to jphickey/osal that referenced this issue May 12, 2021
If messages (e.g. from UtPrintf, etc) already have a newline,
do not add another.
jphickey added a commit to jphickey/osal that referenced this issue May 12, 2021
If messages (e.g. from UtPrintf, etc) already have a newline,
do not add another.
@skliper skliper added the unit-test Tickets related to the OSAL unit testing (functional and/or coverage) label May 12, 2021
@skliper skliper added this to the 6.0.0 milestone May 12, 2021
astrogeco added a commit that referenced this issue May 12, 2021
Fix #1002, remove extra newlines in utassert logs
pepepr08 pushed a commit to pepepr08/osal that referenced this issue Jun 9, 2021
If messages (e.g. from UtPrintf, etc) already have a newline,
do not add another.
jphickey pushed a commit to jphickey/osal that referenced this issue Aug 10, 2022
jphickey pushed a commit to jphickey/osal that referenced this issue Aug 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement unit-test Tickets related to the OSAL unit testing (functional and/or coverage)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants