linux/tools/testing/kunit
Daniel Latypov 060352e141 kunit: tool: fix extra trailing \n in raw + parsed test output
For simplcity, strip all trailing whitespace from parsed output.
I imagine no one is printing out meaningful trailing whitespace via
KUNIT_FAIL() or similar, and that if they are, they really shouldn't.

`isolate_kunit_output()` yielded liens with trailing \n, which results
in artifacty output like this:

$ ./tools/testing/kunit/kunit.py run
[16:16:46] [FAILED] example_simple_test
[16:16:46]     # example_simple_test: EXPECTATION FAILED at lib/kunit/kunit-example-test.c:29

[16:16:46]     Expected 1 + 1 == 3, but

[16:16:46]         1 + 1 == 2

[16:16:46]         3 == 3

[16:16:46]     not ok 1 - example_simple_test

[16:16:46]

After this change:
[16:16:46]     # example_simple_test: EXPECTATION FAILED at lib/kunit/kunit-example-test.c:29
[16:16:46]     Expected 1 + 1 == 3, but
[16:16:46]         1 + 1 == 2
[16:16:46]         3 == 3
[16:16:46]     not ok 1 - example_simple_test
[16:16:46]

We should *not* be expecting lines to end with \n in kunit_tool_test.py
for this reason.

Do the same for `raw_output()` as well which suffers from the same
issue.

This is a followup to [1], but rebased onto kunit-fixes to pick up the
other raw_output() fix and fixes for kunit_tool_test.py.

[1] https://lore.kernel.org/linux-kselftest/20201020233219.4146059-1-dlatypov@google.com/

Signed-off-by: Daniel Latypov <dlatypov@google.com>
Reviewed-by: David Gow <davidgow@google.com>
Tested-by: David Gow <davidgow@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2020-11-10 13:44:35 -07:00
..
configs kunit: tool: fix --alltests flag 2020-09-23 15:52:11 -06:00
test_data kunit: tools: fix kunit_tool tests for parsing test plans 2020-10-26 13:25:40 -06:00
.gitignore .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
kunit.py kunit: Do not pollute source directory with generated files (.kunitconfig) 2020-11-10 13:12:54 -07:00
kunit_config.py kunit: kunit_config: Fix parsing of CONFIG options with space 2020-06-26 14:27:35 -06:00
kunit_json.py kunit: tool: allow generating test results in JSON 2020-08-31 15:40:00 -06:00
kunit_kernel.py kunit: tool: print out stderr from make (like build warnings) 2020-11-10 13:43:22 -07:00
kunit_parser.py kunit: tool: fix extra trailing \n in raw + parsed test output 2020-11-10 13:44:35 -07:00
kunit_tool_test.py kunit: tool: fix extra trailing \n in raw + parsed test output 2020-11-10 13:44:35 -07:00