[PATCH 0/2] gpio: virtuser: add a selftest

From: Lin Tzu Yang

Date: Tue Dec 01 2026 - 09:27:14 EST


gpio-virtuser has no selftest yet, while gpio-sim and gpio-aggregator
do. Patch 2 adds one, driving the consumer against a gpio-sim chip.
Writing it turned up a documentation mismatch, fixed in patch 1, and
two driver bugs, fixed separately against gpio/for-current:

- "gpio: virtuser: fix one-byte overflow in lookup entry key show"
(20261201024151.872725-1-rongh7426@xxxxxxxxx, sent earlier today):
test 2.3 reads back a 4095-byte key. Without that fix the read
still returns the right bytes, but KASAN reports the overflow.
- "gpio: virtuser: report the right dev_name before the device is
live" (sent just before this series): without it, test 1.1 fails
with "dev_name changed when the consumer was enabled".

Testing, in a QEMU/KVM arm64 guest (KASAN, configfs-next 2e0fad9d2eae,
gpio-sim and gpio-virtuser built in, busybox userspace):
- with both fixes: PASS in five runs, no kernel warnings
- without the dev_name fix: FAIL at 1.1, as expected
- with only the dev_name fix: PASS, plus two KASAN reports from 2.3

The series is against gpio/for-next.

This series was written with the help of an AI coding assistant
(Claude). I ran the tests above and reviewed the changes.

Lin Tzu Yang (2):
Documentation: gpio: virtuser: list the accepted direction values
selftests: gpio: add a test for gpio-virtuser

.../admin-guide/gpio/gpio-virtuser.rst | 5 +-
tools/testing/selftests/gpio/Makefile | 3 +-
tools/testing/selftests/gpio/config | 2 +
tools/testing/selftests/gpio/gpio-virtuser.sh | 420 ++++++++++++++++++
4 files changed, 427 insertions(+), 3 deletions(-)
create mode 100755 tools/testing/selftests/gpio/gpio-virtuser.sh

--
2.47.3