]> git.baikalelectronics.ru Git - kernel.git/commit
kunit: tool: move kunitconfig parsing into __init__, make it optional
authorDaniel Latypov <dlatypov@google.com>
Fri, 15 Jan 2021 00:39:13 +0000 (16:39 -0800)
committerShuah Khan <skhan@linuxfoundation.org>
Sat, 16 Jan 2021 00:52:12 +0000 (17:52 -0700)
commit77613e594a587ae5f1dbf3b507293ab74b05c5eb
tree633b99df19b32d606f0191286cdbf0609242fbc5
parent5724d8626b0d51eb708c0e96a1d19ab6a75fb2a5
kunit: tool: move kunitconfig parsing into __init__, make it optional

LinuxSourceTree will unceremoniously crash if the user doesn't call
read_kunitconfig() first in a number of functions.

And currently every place we create an instance, the caller also calls
create_kunitconfig() and read_kunitconfig().
Move these instead into __init__() so they can't be forgotten and to
reduce copy-paste.

The https://github.com/google/pytype type-checker complained that
_config wasn't initialized. With this, kunit_tool now type checks
under both pytype and mypy.

Add an optional boolean that can be used to disable this for use cases
in the future where we might not need/want to load the config.

Signed-off-by: Daniel Latypov <dlatypov@google.com>
Reviewed-by: Brendan Higgins <brendanhiggins@google.com>
Tested-by: Brendan Higgins <brendanhiggins@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/testing/kunit/kunit.py
tools/testing/kunit/kunit_kernel.py