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

Configure Feed

Select the types of activity you want to include in your feed.

selftests/powerpc: Add a helper for checking if we're on ppc64le

Some of our selftests have only been tested on ppc64le and crash or
behave weirdly on ppc64/ppc32. So add a helper for checking the UTS
machine.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

+19
+2
tools/testing/selftests/powerpc/include/utils.h
··· 48 48 } 49 49 #endif 50 50 51 + bool is_ppc64le(void); 52 + 51 53 /* Yes, this is evil */ 52 54 #define FAIL_IF(x) \ 53 55 do { \
+17
tools/testing/selftests/powerpc/utils.c
··· 11 11 #include <link.h> 12 12 #include <sched.h> 13 13 #include <stdio.h> 14 + #include <string.h> 14 15 #include <sys/stat.h> 15 16 #include <sys/types.h> 17 + #include <sys/utsname.h> 16 18 #include <unistd.h> 17 19 18 20 #include "utils.h" ··· 105 103 106 104 printf("No cpus in affinity mask?!\n"); 107 105 return -1; 106 + } 107 + 108 + bool is_ppc64le(void) 109 + { 110 + struct utsname uts; 111 + int rc; 112 + 113 + errno = 0; 114 + rc = uname(&uts); 115 + if (rc) { 116 + perror("uname"); 117 + return false; 118 + } 119 + 120 + return strcmp(uts.machine, "ppc64le") == 0; 108 121 }