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

selftests/vm: skip 128TBswitch on unsupported arch

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>

authored by

Adam Sindelar and committed by
akpm
ac3ced5f 3b8e7f5c

+4 -4
+4 -4
tools/testing/selftests/vm/va_128TBswitch.c
··· 231 231 static int run_test(struct testcase *test, int count) 232 232 { 233 233 void *p; 234 - int i, ret = 0; 234 + int i, ret = KSFT_PASS; 235 235 236 236 for (i = 0; i < count; i++) { 237 237 struct testcase *t = test + i; ··· 242 242 243 243 if (p == MAP_FAILED) { 244 244 printf("FAILED\n"); 245 - ret = 1; 245 + ret = KSFT_FAIL; 246 246 continue; 247 247 } 248 248 249 249 if (t->low_addr_required && p >= (void *)(ADDR_SWITCH_HINT)) { 250 250 printf("FAILED\n"); 251 - ret = 1; 251 + ret = KSFT_FAIL; 252 252 } else { 253 253 /* 254 254 * Do a dereference of the address returned so that we catch ··· 280 280 int ret; 281 281 282 282 if (!supported_arch()) 283 - return 0; 283 + return KSFT_SKIP; 284 284 285 285 ret = run_test(testcases, ARRAY_SIZE(testcases)); 286 286 if (argc == 2 && !strcmp(argv[1], "--run-hugetlb"))