]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
selftests/vm: skip 128TBswitch on unsupported arch
authorAdam Sindelar <adam@wowsignal.io>
Mon, 4 Jul 2022 12:38:13 +0000 (14:38 +0200)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Wed, 3 Aug 2022 18:17:10 +0000 (14:17 -0400)
The test va_128TBswitch.c exercises a feature only supported on PPC and
x86_64, but it's run on other 64-bit archs as well.  Before this patch,
the test did nothing and returned 0 for KSFT_PASS.  This patch makes it
return the KSFT codes from kselftest.h, including KSFT_SKIP when
appropriate.

Verified on arm64 and x86_64.

Link: https://lkml.kernel.org/r/20220704123813.427625-1-adam@wowsignal.io
Signed-off-by: Adam Sindelar <adam@wowsignal.io>
Cc: David Vernet <void@manifault.com>
Cc: Shuah Khan <shuah@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
tools/testing/selftests/vm/va_128TBswitch.c

index da6ec3b53ea8d4232b71ced67dd50acfddb8e174..1d206898988396dfeac14748f7c0d1e74d4318d3 100644 (file)
@@ -231,7 +231,7 @@ static struct testcase hugetlb_testcases[] = {
 static int run_test(struct testcase *test, int count)
 {
        void *p;
-       int i, ret = 0;
+       int i, ret = KSFT_PASS;
 
        for (i = 0; i < count; i++) {
                struct testcase *t = test + i;
@@ -242,13 +242,13 @@ static int run_test(struct testcase *test, int count)
 
                if (p == MAP_FAILED) {
                        printf("FAILED\n");
-                       ret = 1;
+                       ret = KSFT_FAIL;
                        continue;
                }
 
                if (t->low_addr_required && p >= (void *)(ADDR_SWITCH_HINT)) {
                        printf("FAILED\n");
-                       ret = 1;
+                       ret = KSFT_FAIL;
                } else {
                        /*
                         * Do a dereference of the address returned so that we catch
@@ -280,7 +280,7 @@ int main(int argc, char **argv)
        int ret;
 
        if (!supported_arch())
-               return 0;
+               return KSFT_SKIP;
 
        ret = run_test(testcases, ARRAY_SIZE(testcases));
        if (argc == 2 && !strcmp(argv[1], "--run-hugetlb"))