kunit: tool: add Python wrappers for running KUnit tests
authorFelix Guo <felixguoxiuping@gmail.com>
Mon, 23 Sep 2019 09:02:43 +0000 (02:02 -0700)
committerShuah Khan <skhan@linuxfoundation.org>
Mon, 30 Sep 2019 23:35:01 +0000 (17:35 -0600)
commit6ebf5866f2e870cf9451a2068c787bc2b30025e9
treebadc05098585300fa25c5e68406fdad713b214f2
parent73ba5aaf93b41e641a250530f48274d783dd56fc
kunit: tool: add Python wrappers for running KUnit tests

The ultimate goal is to create minimal isolated test binaries; in the
meantime we are using UML to provide the infrastructure to run tests, so
define an abstract way to configure and run tests that allow us to
change the context in which tests are built without affecting the user.
This also makes pretty and dynamic error reporting, and a lot of other
nice features easier.

kunit_config.py:
  - parse .config and Kconfig files.

kunit_kernel.py: provides helper functions to:
  - configure the kernel using kunitconfig.
  - build the kernel with the appropriate configuration.
  - provide function to invoke the kernel and stream the output back.

kunit_parser.py: parses raw logs returned out by kunit_kernel and
displays them in a user friendly way.

test_data/*: samples of test data for testing kunit.py, kunit_config.py,
etc.

Signed-off-by: Felix Guo <felixguoxiuping@gmail.com>
Signed-off-by: Brendan Higgins <brendanhiggins@google.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
Reviewed-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
12 files changed:
tools/testing/kunit/.gitignore [new file with mode: 0644]
tools/testing/kunit/kunit.py [new file with mode: 0755]
tools/testing/kunit/kunit_config.py [new file with mode: 0644]
tools/testing/kunit/kunit_kernel.py [new file with mode: 0644]
tools/testing/kunit/kunit_parser.py [new file with mode: 0644]
tools/testing/kunit/kunit_tool_test.py [new file with mode: 0755]
tools/testing/kunit/test_data/test_is_test_passed-all_passed.log [new file with mode: 0644]
tools/testing/kunit/test_data/test_is_test_passed-crash.log [new file with mode: 0644]
tools/testing/kunit/test_data/test_is_test_passed-failure.log [new file with mode: 0644]
tools/testing/kunit/test_data/test_is_test_passed-no_tests_run.log [new file with mode: 0644]
tools/testing/kunit/test_data/test_output_isolated_correctly.log [new file with mode: 0644]
tools/testing/kunit/test_data/test_read_from_file.kconfig [new file with mode: 0644]