]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
selftests: revocable: Add kselftest cases
authorTzung-Bi Shih <tzungbi@kernel.org>
Fri, 16 Jan 2026 08:02:35 +0000 (08:02 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 16 Jan 2026 15:16:51 +0000 (16:16 +0100)
commit9d4502fef00fa7a798d3c0806d4da4466a7ffc6f
tree6ca4a1a2e449a88b93eb0f63dcbc0a296f28f61e
parentcd7693419bb5abd91ad2f407dab69c480e417a61
selftests: revocable: Add kselftest cases

Add kselftest cases for the revocable API.

The test consists of three parts:
- A kernel module (revocable_test.ko) that creates a debugfs interface
  with `/provider` and `/consumer` files.
- A user-space C program (revocable_test) that uses the kselftest
  harness to interact with the debugfs files.
- An orchestrating shell script (test-revocable.sh) that loads the
  module, runs the C program, and unloads the module.

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().

Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
Link: https://patch.msgid.link/20260116080235.350305-4-tzungbi@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
MAINTAINERS
tools/testing/selftests/Makefile
tools/testing/selftests/drivers/base/revocable/Makefile [new file with mode: 0644]
tools/testing/selftests/drivers/base/revocable/revocable_test.c [new file with mode: 0644]
tools/testing/selftests/drivers/base/revocable/test-revocable.sh [new file with mode: 0755]
tools/testing/selftests/drivers/base/revocable/test_modules/Makefile [new file with mode: 0644]
tools/testing/selftests/drivers/base/revocable/test_modules/revocable_test.c [new file with mode: 0644]