kunit: tool: factor exec + parse steps into a function
authorDaniel Latypov <dlatypov@google.com>
Thu, 30 Sep 2021 22:20:46 +0000 (15:20 -0700)
committerShuah Khan <skhan@linuxfoundation.org>
Tue, 19 Oct 2021 20:18:50 +0000 (14:18 -0600)
commit7ef925ea819469b1341a9b704c3e72bacf62000c
treef0ff932a96d46ab0fdcab49a513da4586f29737b
parent9c6b0e1d8993e47a3fe437af71c6a23d4ee73e12
kunit: tool: factor exec + parse steps into a function

Currently this code is copy-pasted between the normal "run" subcommand
and the "exec" subcommand.

Given we don't have any interest in just executing the tests without
giving the user any indication what happened (i.e. parsing the output),
make a function that does both this things and can be reused.

This will be useful when we allow more complicated ways of running
tests, e.g. invoking the kernel multiple times instead of just once,
etc.

We remove input_data from the ParseRequest so the callers don't have to
pass in a dummy value for this field. Named tuples are also immutable,
so if they did pass in a dummy, exec_tests() would need to make a copy
to call parse_tests().

Removing it also makes KunitParseRequest match the other *Request types,
as they only contain user arguments/flags, not data.

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