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: default avatarShuah Khan (Samsung OSG) <shuah@kernel.org>
parent 29ee9239
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
#include <sys/auxv.h> #include <sys/auxv.h>
#include <sys/time.h> #include <sys/time.h>
#include "../kselftest.h"
extern void *vdso_sym(const char *version, const char *name); extern void *vdso_sym(const char *version, const char *name);
extern void vdso_init_from_sysinfo_ehdr(uintptr_t base); extern void vdso_init_from_sysinfo_ehdr(uintptr_t base);
extern void vdso_init_from_auxv(void *auxv); extern void vdso_init_from_auxv(void *auxv);
...@@ -37,7 +39,7 @@ int main(int argc, char **argv) ...@@ -37,7 +39,7 @@ int main(int argc, char **argv)
unsigned long sysinfo_ehdr = getauxval(AT_SYSINFO_EHDR); unsigned long sysinfo_ehdr = getauxval(AT_SYSINFO_EHDR);
if (!sysinfo_ehdr) { if (!sysinfo_ehdr) {
printf("AT_SYSINFO_EHDR is not present!\n"); printf("AT_SYSINFO_EHDR is not present!\n");
return 0; return KSFT_SKIP;
} }
vdso_init_from_sysinfo_ehdr(getauxval(AT_SYSINFO_EHDR)); vdso_init_from_sysinfo_ehdr(getauxval(AT_SYSINFO_EHDR));
...@@ -48,7 +50,7 @@ int main(int argc, char **argv) ...@@ -48,7 +50,7 @@ int main(int argc, char **argv)
if (!gtod) { if (!gtod) {
printf("Could not find %s\n", name); printf("Could not find %s\n", name);
return 1; return KSFT_SKIP;
} }
struct timeval tv; struct timeval tv;
...@@ -59,6 +61,7 @@ int main(int argc, char **argv) ...@@ -59,6 +61,7 @@ int main(int argc, char **argv)
(long long)tv.tv_sec, (long long)tv.tv_usec); (long long)tv.tv_sec, (long long)tv.tv_usec);
} else { } else {
printf("%s failed\n", name); printf("%s failed\n", name);
return KSFT_FAIL;
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment