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

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>

authored by

Alexey Dobriyan and committed by
Andrew Morton
5cc81d5c 33cd3003

+2 -1
+2 -1
tools/testing/selftests/proc/proc-uptime-002.c
··· 17 17 // while shifting across CPUs. 18 18 #undef NDEBUG 19 19 #include <assert.h> 20 + #include <errno.h> 20 21 #include <unistd.h> 21 22 #include <sys/syscall.h> 22 23 #include <stdlib.h> ··· 55 54 len += sizeof(unsigned long); 56 55 free(m); 57 56 m = malloc(len); 58 - } while (sys_sched_getaffinity(0, len, m) == -EINVAL); 57 + } while (sys_sched_getaffinity(0, len, m) == -1 && errno == EINVAL); 59 58 60 59 fd = open("/proc/uptime", O_RDONLY); 61 60 assert(fd >= 0);