kunit: tool: simplify code since build_dir can't be None
authorDaniel Latypov <dlatypov@google.com>
Tue, 18 Jan 2022 19:09:22 +0000 (11:09 -0800)
committerShuah Khan <skhan@linuxfoundation.org>
Mon, 4 Apr 2022 20:25:58 +0000 (14:25 -0600)
commitaa1c05558e71422564a664fc4cafbf5999f1de0f
tree33ce19c2e0a6ef281b58259a18dcf7714a6ef9f8
parente6f61920653925e6fa9aceb5cdb47ecf543986c8
kunit: tool: simplify code since build_dir can't be None

--build_dir is set to a default of '.kunit' since commit ddbd60c779b4
("kunit: use --build_dir=.kunit as default"), but even before then it
was explicitly set to ''.

So outside of one unit test, there was no way for the build_dir to be
ever be None, and we can simplify code by fixing the unit test and
enforcing that via updated type annotations.

E.g. this lets us drop `get_file_path()` since it's now exactly
equivalent to os.path.join().

Note: there's some `if build_dir` checks that also fail if build_dir is
explicitly set to '' that just guard against passing "O=" to make.
But running `make O=` works just fine, so drop these checks.

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>
tools/testing/kunit/kunit_json.py
tools/testing/kunit/kunit_kernel.py
tools/testing/kunit/kunit_tool_test.py