selftests: memfd: return Kselftest Skip code for skipped tests
authorShuah Khan (Samsung OSG) <shuah@kernel.org>
Fri, 4 May 2018 19:33:37 +0000 (13:33 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 3 Aug 2018 05:50:27 +0000 (07:50 +0200)
commit4312c2df0b7b77e45a8727fba5cf9a36729e07bc
tree18b83427a85e7f9bbb5d0336044551aafee189e2
parent9c8f3af662827d596ecde90c6c7ce069c0e404eb
selftests: memfd: return Kselftest Skip code for skipped tests

[ Upstream commit b27f0259e8cea74c627327c063742a83613dd460 ]

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

Added an explicit check for root user at the start of memfd hugetlbfs test
and return skip code if a non-root user attempts to run it.

In addition, return skip code when not enough huge pages are available to
run the test.

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>
Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
Signed-off-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
tools/testing/selftests/memfd/run_tests.sh