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

selftests: vDSO - fix to return KSFT_SKIP when test couldn't be run

Fix to return KSFT_SKIP when test couldn't be run because AT_SYSINFO_EHDR
isn't found and gettimeofday isn't defined.

Signed-off-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>

+5 -2
+5 -2
tools/testing/selftests/vDSO/vdso_test.c
··· 15 15 #include <sys/auxv.h> 16 16 #include <sys/time.h> 17 17 18 + #include "../kselftest.h" 19 + 18 20 extern void *vdso_sym(const char *version, const char *name); 19 21 extern void vdso_init_from_sysinfo_ehdr(uintptr_t base); 20 22 extern void vdso_init_from_auxv(void *auxv); ··· 39 37 unsigned long sysinfo_ehdr = getauxval(AT_SYSINFO_EHDR); 40 38 if (!sysinfo_ehdr) { 41 39 printf("AT_SYSINFO_EHDR is not present!\n"); 42 - return 0; 40 + return KSFT_SKIP; 43 41 } 44 42 45 43 vdso_init_from_sysinfo_ehdr(getauxval(AT_SYSINFO_EHDR)); ··· 50 48 51 49 if (!gtod) { 52 50 printf("Could not find %s\n", name); 53 - return 1; 51 + return KSFT_SKIP; 54 52 } 55 53 56 54 struct timeval tv; ··· 61 59 (long long)tv.tv_sec, (long long)tv.tv_usec); 62 60 } else { 63 61 printf("%s failed\n", name); 62 + return KSFT_FAIL; 64 63 } 65 64 66 65 return 0;