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

selftests: memory-hotplug: return Kselftest Skip code for skipped tests

When memory-hotplug test is skipped because of unmet dependencies and/or
unsupported configuration, it returns non-zero value hich 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>

+7 -4
+7 -4
tools/testing/selftests/memory-hotplug/mem-on-off-test.sh
··· 3 3 4 4 SYSFS= 5 5 6 + # Kselftest framework requirement - SKIP code is 4. 7 + ksft_skip=4 8 + 6 9 prerequisite() 7 10 { 8 11 msg="skip all tests:" 9 12 10 13 if [ $UID != 0 ]; then 11 14 echo $msg must be run as root >&2 12 - exit 0 15 + exit $ksft_skip 13 16 fi 14 17 15 18 SYSFS=`mount -t sysfs | head -1 | awk '{ print $3 }'` 16 19 17 20 if [ ! -d "$SYSFS" ]; then 18 21 echo $msg sysfs is not mounted >&2 19 - exit 0 22 + exit $ksft_skip 20 23 fi 21 24 22 25 if ! ls $SYSFS/devices/system/memory/memory* > /dev/null 2>&1; then 23 26 echo $msg memory hotplug is not supported >&2 24 - exit 0 27 + exit $ksft_skip 25 28 fi 26 29 27 30 if ! grep -q 1 $SYSFS/devices/system/memory/memory*/removable; then 28 31 echo $msg no hot-pluggable memory >&2 29 - exit 0 32 + exit $ksft_skip 30 33 fi 31 34 } 32 35