[PATCH] selftests/gpio: skip when gpio-mockup is not available
From: Eva Kurchatova
Date: Fri Sep 25 2026 - 09:46:52 EST
The test drives the gpio-mockup debugfs interface, but checks only that
debugfs is mounted. On a kernel built without the driver every case
fails on a missing device rather than reporting that the driver is not
there:
# ls: cannot access '/sys/kernel/debug/gpio-mockup': No such file
# GPIO gpio-mockup test FAIL
Skip instead. Accept the driver either as a module modinfo can find, or
as one already loaded or built in, which /sys/module/gpio-mockup reports;
the test runs perfectly well in the built-in case.
Signed-off-by: Eva Kurchatova <eva.kurchatova@xxxxxxxxxxxxx>
---
tools/testing/selftests/gpio/gpio-mockup.sh | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tools/testing/selftests/gpio/gpio-mockup.sh b/tools/testing/selftests/gpio/gpio-mockup.sh
index fc2dd4c24d06..b13ccecd4a71 100755
--- a/tools/testing/selftests/gpio/gpio-mockup.sh
+++ b/tools/testing/selftests/gpio/gpio-mockup.sh
@@ -51,6 +51,9 @@ prerequisite()
DEBUGFS=$(grep -w debugfs /proc/mounts | cut -f2 -d' ')
[ -d "$DEBUGFS" ] || skip "debugfs is not mounted"
+ modinfo $module >/dev/null 2>&1 || [ -d /sys/module/$module ] ||
+ skip "$module module is not available"
+
GPIO_DEBUGFS=$DEBUGFS/$module
}
--
2.55.0