kunit: add unit test for filtering suites by names
authorDaniel Latypov <dlatypov@google.com>
Wed, 21 Apr 2021 02:04:27 +0000 (19:04 -0700)
committerShuah Khan <skhan@linuxfoundation.org>
Fri, 25 Jun 2021 17:44:37 +0000 (11:44 -0600)
commit1d71307a6f94df3750f8f884545a769e227172fe
tree5999bd6b588476c335c78f2b419c2a9c31fc249f
parent40eb5cf4cc913dbb615eb97d05f2353f0404a464
kunit: add unit test for filtering suites by names

This adds unit tests for kunit_filter_subsuite() and
kunit_filter_suites().

Note: what the executor means by "subsuite" is the array of suites
corresponding to each test file.

This patch lightly refactors executor.c to avoid the use of global
variables to make it testable.
It also includes a clever `kfree_at_end()` helper that makes this test
easier to write than it otherwise would have been.

Tested by running just the new tests using itself
$ ./tools/testing/kunit/kunit.py run '*exec*'

Signed-off-by: Daniel Latypov <dlatypov@google.com>
Reviewed-by: David Gow <davidgow@google.com>
Acked-by: Brendan Higgins <brendanhiggins@google.com>
Tested-by: Brendan Higgins <brendanhiggins@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
lib/kunit/executor.c
lib/kunit/executor_test.c [new file with mode: 0644]