Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests: gpio: return Kselftest Skip code for skipped tests

When gpio test is skipped because of unmet dependencies and/or
unsupported configuration, it exits with error which is treated as
a fail by the Kselftest framework. This leads to false negative
result even when the test could not be run.

Change it to return kselftest skip code when a test gets skipped to
clearly report that the test could not be run.

Kselftest framework SKIP code is 4 and the framework prints appropriate
messages to indicate that the test is skipped.

Signed-off-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>

+8 -4
+8 -4
tools/testing/selftests/gpio/gpio-mockup.sh
··· 2 2 # SPDX-License-Identifier: GPL-2.0 3 3 4 4 #exit status 5 - #1: run as non-root user 5 + #1: Internal error 6 6 #2: sysfs/debugfs not mount 7 7 #3: insert module fail when gpio-mockup is a module. 8 - #4: other reason. 8 + #4: Skip test including run as non-root user. 9 + #5: other reason. 9 10 10 11 SYSFS= 11 12 GPIO_SYSFS= ··· 15 14 GPIO_DEBUGFS= 16 15 dev_type= 17 16 module= 17 + 18 + # Kselftest framework requirement - SKIP code is 4. 19 + ksft_skip=4 18 20 19 21 usage() 20 22 { ··· 38 34 msg="skip all tests:" 39 35 if [ $UID != 0 ]; then 40 36 echo $msg must be run as root >&2 41 - exit 1 37 + exit $ksft_skip 42 38 fi 43 39 SYSFS=`mount -t sysfs | head -1 | awk '{ print $3 }'` 44 40 if [ ! -d "$SYSFS" ]; then ··· 77 73 die() 78 74 { 79 75 remove_module 80 - exit 4 76 + exit 5 81 77 } 82 78 83 79 test_chips()