linux/Documentation/dev-tools/kunit
Daniel Latypov de2fcb3e62 Documentation: kunit: add tips for using current->kunit_test
As of commit 359a376081 ("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>
2021-04-07 16:40:37 -06:00
..
api
faq.rst KUnit: Docs: fix a wording typo 2020-11-10 13:36:36 -07:00
index.rst Documentation: kunit: add tips.rst for small examples 2021-02-08 15:41:11 -07:00
kunit-tool.rst Documentation: kunit: Remove references to --defconfig 2020-07-17 14:08:43 -06:00
start.rst Documentation: kunit: add tips.rst for small examples 2021-02-08 15:41:11 -07:00
style.rst KUnit: Docs: style: fix some Kconfig example issues 2020-11-10 13:39:26 -07:00
tips.rst Documentation: kunit: add tips for using current->kunit_test 2021-04-07 16:40:37 -06:00
usage.rst Documentation: kunit: include example of a parameterized test 2021-01-15 17:47:39 -07:00