summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/proc
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2022-10-24 21:08:09 +0300
committerAndrew Morton <akpm@linux-foundation.org>2022-11-19 00:55:08 +0300
commit5cc81d5c81af0dee54da9a67a3ebe4be076a13db (patch)
treecbea24d7d606cc79b5c2748599f46340247bd58a /tools/testing/selftests/proc
parent33cd3003644b2f64a1b1c27e10ba2ed55792e1cc (diff)
downloadlinux-5cc81d5c81af0dee54da9a67a3ebe4be076a13db.tar.xz
proc: fixup uptime selftest
syscall(3) returns -1 and sets errno on error, unlike "syscall" instruction. Systems which have <= 32/64 CPUs are unaffected. Test won't bounce to all CPUs before completing if there are more of them. Link: https://lkml.kernel.org/r/Y1bUiT7VRXlXPQa1@p183 Fixes: 1f5bd0547654 ("proc: selftests: test /proc/uptime") Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'tools/testing/selftests/proc')
-rw-r--r--tools/testing/selftests/proc/proc-uptime-002.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/testing/selftests/proc/proc-uptime-002.c b/tools/testing/selftests/proc/proc-uptime-002.c
index e7ceabed7f51..7d0aa22bdc12 100644
--- a/tools/testing/selftests/proc/proc-uptime-002.c
+++ b/tools/testing/selftests/proc/proc-uptime-002.c
@@ -17,6 +17,7 @@
// while shifting across CPUs.
#undef NDEBUG
#include <assert.h>
+#include <errno.h>
#include <unistd.h>
#include <sys/syscall.h>
#include <stdlib.h>
@@ -54,7 +55,7 @@ int main(void)
len += sizeof(unsigned long);
free(m);
m = malloc(len);
- } while (sys_sched_getaffinity(0, len, m) == -EINVAL);
+ } while (sys_sched_getaffinity(0, len, m) == -1 && errno == EINVAL);
fd = open("/proc/uptime", O_RDONLY);
assert(fd >= 0);