linux/tools/testing/kunit
Daniel Latypov 142189f09c kunit: tool: print parsed test results fully incrementally
With the parser rework [1] and run_kernel() rework [2], this allows the
parser to print out test results incrementally.

Currently, that's held up by the fact that the LineStream eagerly
pre-fetches the next line when you call pop().
This blocks parse_test_result() from returning until the line *after*
the "ok 1 - test name" line is also printed.

One can see this with the following example:
$ (echo -e 'TAP version 14\n1..3\nok 1 - fake test'; sleep 2; echo -e 'ok 2 - fake test 2'; sleep 3; echo -e 'ok 3 - fake test 3') | ./tools/testing/kunit/kunit.py parse

Before this patch [1]: there's a pause before 'fake test' is printed.
After this patch: 'fake test' is printed out immediately.

This patch also adds
* a unit test to verify LineStream's behavior directly
* a test case to ensure that it's lazily calling the generator
* an explicit exception for when users go beyond EOF

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

Signed-off-by: Daniel Latypov <dlatypov@google.com>
Reviewed-by: David Gow <davidgow@google.com>
Reviewed-by: Brendan Higgins <brendanhiggins@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2021-12-13 13:37:38 -07:00
..
configs kunit: Remove the unused all_tests.config 2021-06-23 17:49:41 -06:00
qemu_configs kunit: tool: add support for QEMU 2021-06-11 16:10:23 -06:00
test_data kunit: tool: Report an error if any test has no subtests 2021-12-13 13:36:15 -07:00
.gitignore .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
kunit_config.py kunit: tool: add support for QEMU 2021-06-11 16:10:23 -06:00
kunit_json.py kunit: tool: fix --json output for skipped tests 2021-12-13 13:33:30 -07:00
kunit_kernel.py kunit: tool: fix typecheck errors about loading qemu configs 2021-10-29 13:05:47 -06:00
kunit_parser.py kunit: tool: print parsed test results fully incrementally 2021-12-13 13:37:38 -07:00
kunit_tool_test.py kunit: tool: print parsed test results fully incrementally 2021-12-13 13:37:38 -07:00
kunit.py kunit: tool: continue past invalid utf-8 output 2021-10-25 13:06:45 -06:00
qemu_config.py kunit: tool: add support for QEMU 2021-06-11 16:10:23 -06:00
run_checks.py kunit: add run_checks.py script to validate kunit changes 2021-12-13 13:35:22 -07:00