]> www.infradead.org Git - users/jedix/linux-maple.git/commit
kunit: tool: misc fixes (unused vars, imports, leaked files)
authorDaniel Latypov <dlatypov@google.com>
Tue, 28 Sep 2021 22:11:11 +0000 (15:11 -0700)
committerShuah Khan <skhan@linuxfoundation.org>
Tue, 19 Oct 2021 20:18:49 +0000 (14:18 -0600)
commita54ea2e0572537b283cb0edd95851c5f1fb20a90
treef39a6fb76a31c3b2a7d6355e5c18faa200e9108a
parentcd94fbc2cafb61cc1394cdba3f92b99ce07b03ae
kunit: tool: misc fixes (unused vars, imports, leaked files)

Drop some variables in unit tests that were unused and/or add assertions
based on them.

For ExitStack, it was imported, but the `es` variable wasn't used so it
didn't do anything, and we were leaking the file objects.
Refactor it to just use nested `with` statements to properly close them.

And drop the direct use of .close() on file objects in the kunit tool
unit test, as these can be leaked if test assertions fail.

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