From: Kevin Brodsky <[email protected]>

[ Upstream commit 1c6b1d4889d72a705c9f60f9916ebabbcfe25d30 ]

The pkey_sighandler_tests are bound to fail if either the kernel or CPU
doesn't support pkeys.  Skip the tests if pkeys support is missing.

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Kevin Brodsky <[email protected]>
Cc: Aruna Ramakrishna <[email protected]>
Cc: Catalin Marinas <[email protected]>
Cc: Dave Hansen <[email protected]>
Cc: Joey Gouly <[email protected]>
Cc: Keith Lucas <[email protected]>
Cc: Ryan Roberts <[email protected]>
Cc: Shuah Khan <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
(cherry picked from commit 1c6b1d4889d72a705c9f60f9916ebabbcfe25d30)
[Harshit: clean backport to 6.12.y, fixes tests on machines that don't
really have pkeys support, with this the tests are correctly skipped]
Signed-off-by: Harshit Mogalapalli <[email protected]>
---
 tools/testing/selftests/mm/pkey_sighandler_tests.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/testing/selftests/mm/pkey_sighandler_tests.c 
b/tools/testing/selftests/mm/pkey_sighandler_tests.c
index 6d1a521d6936..1c744cd71d33 100644
--- a/tools/testing/selftests/mm/pkey_sighandler_tests.c
+++ b/tools/testing/selftests/mm/pkey_sighandler_tests.c
@@ -505,6 +505,9 @@ int main(int argc, char *argv[])
        ksft_print_header();
        ksft_set_plan(ARRAY_SIZE(pkey_tests));
 
+       if (!is_pkeys_supported())
+               ksft_exit_skip("pkeys not supported\n");
+
        for (i = 0; i < ARRAY_SIZE(pkey_tests); i++)
                (*pkey_tests[i])();
 
-- 
2.47.3


Reply via email to