]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
revocable: Add Kunit test cases
authorTzung-Bi Shih <tzungbi@kernel.org>
Fri, 16 Jan 2026 08:02:34 +0000 (08:02 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 16 Jan 2026 15:16:51 +0000 (16:16 +0100)
commitcd7693419bb5abd91ad2f407dab69c480e417a61
tree78d109bc820f7661aeec3bb5d641259c744179cc
parent62eb557580eb2177cf16c3fd2b6efadff297b29a
revocable: Add Kunit test cases

Add Kunit test cases for the revocable API.

The test cases cover the following scenarios:
- Basic: Verifies that a consumer can successfully access the resource
  provided via the provider.
- Revocation: Verifies that after the provider revokes the resource,
  the consumer correctly receives a NULL pointer on a subsequent access.
- Try Access Macro: Same as "Revocation" but uses the
  REVOCABLE_TRY_ACCESS_WITH() and REVOCABLE_TRY_ACCESS_SCOPED().

A way to run the test:
$ ./tools/testing/kunit/kunit.py run \
        --kconfig_add CONFIG_REVOCABLE_KUNIT_TEST=y \
        revocable_test

Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
Link: https://patch.msgid.link/20260116080235.350305-3-tzungbi@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
MAINTAINERS
drivers/base/Kconfig
drivers/base/Makefile
drivers/base/revocable_test.c [new file with mode: 0644]