kunit: string-stream: Add option to make all lines end with newline
authorRichard Fitzgerald <rf@opensource.cirrus.com>
Mon, 28 Aug 2023 10:41:04 +0000 (11:41 +0100)
committerShuah Khan <skhan@linuxfoundation.org>
Mon, 18 Sep 2023 16:45:16 +0000 (10:45 -0600)
commita5abe7b201779b0000f1e8ab522e5c6fc0c413bf
tree4d116c7fac6208c19800510bd83f7a3ec64d8389
parent4551caca6ab67fb0b5199ca43580c4f8d27bf28a
kunit: string-stream: Add option to make all lines end with newline

Add an optional feature to string_stream that will append a newline to
any added string that does not already end with a newline. The purpose
of this is so that string_stream can be used to collect log lines.

This is enabled/disabled by calling string_stream_set_append_newlines().

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Reviewed-by: Rae Moar <rmoar@google.com>
Reviewed-by: David Gow <davidgow@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
lib/kunit/string-stream.c
lib/kunit/string-stream.h