]> git.baikalelectronics.ru Git - kernel.git/commit
Documentation: kunit: add tips for using current->kunit_test
authorDaniel Latypov <dlatypov@google.com>
Tue, 6 Apr 2021 22:51:00 +0000 (15:51 -0700)
committerShuah Khan <skhan@linuxfoundation.org>
Wed, 7 Apr 2021 22:40:37 +0000 (16:40 -0600)
commitd7d1c8b21f73b8c9337d591dfa1e2f730d8394f9
tree4fe1ac52aee812021d33a964a9428f37e88618b8
parent280313e0059130ef98d4ce619c7473b824430bdb
Documentation: kunit: add tips for using current->kunit_test

As of commit 5583124ef54b ("kunit: support failure from dynamic analysis
tools"), we can use current->kunit_test to find the current kunit test.

Mention this in tips.rst and give an example of how this can be used in
conjunction with `test->priv` to pass around state and specifically
implement something like mocking.
There's a lot more we could go into on that topic, but given that
example is already longer than every other "tip" on this page, we just
point to the API docs and leave filling in the blanks as an exercise to
the reader.

Also give an example of kunit_fail_current_test().

Signed-off-by: Daniel Latypov <dlatypov@google.com>
Reviewed-by: Brendan Higgins <brendanhiggins@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Documentation/dev-tools/kunit/tips.rst