The gpio-mockup test begins with:

    remove_module || fail "can't remove existing $module module"

where remove_module is simply 'modprobe -r -q gpio-mockup'. On a kernel
built without CONFIG_GPIO_MOCKUP (which is the case for many distro
kernels, including RHEL), the module file does not exist, modprobe -r
returns non-zero, and the test is reported as FAIL even though there
is nothing for it to test. Detect this case early and skip cleanly.

After this:

    # GPIO gpio-mockup test SKIP
    ok 1 selftests: gpio: gpio-mockup.sh # SKIP

instead of:

    not ok 1 selftests: gpio: gpio-mockup.sh # exit=1

Signed-off-by: Eva Kurchatova <[email protected]>

https://virtuozzo.atlassian.net/browse/VSTOR-134202
Feature: fix selftests

---
 tools/testing/selftests/gpio/gpio-mockup.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/gpio/gpio-mockup.sh 
b/tools/testing/selftests/gpio/gpio-mockup.sh
index fc2dd4c24d06..1d815692d4f1 100755
--- a/tools/testing/selftests/gpio/gpio-mockup.sh
+++ b/tools/testing/selftests/gpio/gpio-mockup.sh
@@ -51,12 +51,15 @@ prerequisite()
        DEBUGFS=$(grep -w debugfs /proc/mounts | cut -f2 -d' ')
        [ -d "$DEBUGFS" ] || skip "debugfs is not mounted"
 
+       modinfo -n $module >/dev/null 2>&1 || skip "$module module is not 
available"
+
        GPIO_DEBUGFS=$DEBUGFS/$module
 }
 
 remove_module()
 {
-       modprobe -r -q $module
+       # Ignore errors when the module is not present
+       modprobe -r -q $module || true
 }
 
 cleanup()
-- 
2.47.3

_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to