Skip to content

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

@jphickey

Description

@jphickey

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementunit-testTickets related to the OSAL unit testing (functional and/or coverage)

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions