Re: [PATCH v2] kunit: add run_checks.py script to validate kunit changes

From: Brendan Higgins
Date: Tue Dec 07 2021 - 15:11:54 EST


On Wed, Nov 3, 2021 at 12:22 AM Daniel Latypov <dlatypov@xxxxxxxxxx> wrote:
>
> This formalizes the checks KUnit maintainers have been running (or in
> other cases: forgetting to run).
>
> This script also runs them all in parallel to minimize friction (pytype
> can be fairly slow, but not slower than running kunit.py).
>
> Example output:
> $ ./tools/testing/kunit/run_checks.py
> Waiting on 4 checks (kunit_tool_test.py, kunit smoke test, pytype, mypy)...
> kunit_tool_test.py: PASSED
> mypy: PASSED
> pytype: PASSED
> kunit smoke test: PASSED
>
> On failure or timeout (5 minutes), it'll dump out the stdout/stderr.
> E.g. adding in a type-checking error:
> mypy: FAILED
> > kunit.py:54: error: Name 'nonexistent_function' is not defined
> > Found 1 error in 1 file (checked 8 source files)
>
> mypy and pytype are two Python type-checkers and must be installed.
> This file treats them as optional and will mark them as SKIPPED if not
> installed.
>
> This tool also runs `kunit.py run --kunitconfig=lib/kunit` to run
> KUnit's own KUnit tests and to verify KUnit kernel code and kunit.py
> play nicely together.
>
> It uses --build_dir=kunit_run_checks so as not to clobber the default
> build_dir, which helps make it faster by reducing the need to rebuild,
> esp. if you're been passing in --arch instead of using UML.
>
> Signed-off-by: Daniel Latypov <dlatypov@xxxxxxxxxx>
> Reviewed-by: David Gow <davidgow@xxxxxxxxxx>

Reviewed-by: Brendan Higgins <brendanhiggins@xxxxxxxxxx>